Skip to content

Commit

Permalink
Merge pull request #58 from posit-dev/fix/components-shinylive-links
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie authored Jan 4, 2024
2 parents 7d3e006 + c047424 commit c85d169
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions components/inputs/action-button.qmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: "Action Button"
sidebar: components
sidebar: components
previewapp: |
from shiny import App, reactive, render, ui
app_ui = ui.page_fluid(
ui.input_action_button("action_button", "Action"),
ui.input_action_button("action_button", "Action"),
ui.output_text("counter"),
{"class": "vh-100 d-flex justify-content-center align-items-center px-4"}
)
Expand All @@ -20,7 +20,7 @@ listing:
template: ../_partials/components-detail.ejs
contents:
- title: Action Button
preview: https://shinylive.io/py/app/#h=0&code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxM6cKITIcAbnAlSIAEzh0JAVw4AdaOgD6OpgF4mOrFADmcQzQA2O1QAp9TDxY4YGAdzcQnkFeGCROMBAuAGza3lyoWmSGMnKkhgBGiWSkbiiyHGmZZNkQuvhMZQCSEIRSUCxwTAByWjDpGmUAlJ0S7sEelmGtkTEhxIkJSRQAHmS5JFrkHWCdGFCqqoaEDvUsuaocLKg72AC0AKxMbacADF09ff0gZdu7ZYgVYPJspwCMNzcmAArLQsOQ0M4kJbkU6ESgUOhMKAODjWCCnDgUGAsWHwjRMVDTC5lAC+jyYq3Wm1eLD2ZRmZFxSzoXQ8+k6+nUNFYGkUdBc8USEnGZEmEgatIKEHFZCgQi41kM8mRWka5hunUQ5IW5DMkmk+UUGAAaiq4C4wXK5BBFcqnHAOaVAp4AAJ1Q1wDAAURoNDgsnJboNciNcEU5AFEEma3yhSypEdQS5TEMLk15KCOrIGAacyzaaYAGomL9HYGVOo6BgGeTk1mNGmtc7+lIyFo6IEaGUQPnOmSwPpBwZUHqxKgXGhUMYOOLeRpHWASQBdIA
preview: https://shinylive.io/py/app/#h=0&code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxM6cKITIcAbnAlSIAEzh0JAVw4AdCPrSoA+jqYBeJjqxQA5nGM0ANjtUAKfUy9WOGBgHcPCG8QnwwSFxgINwA2bV8uVC0yYxk5UmMAI2SyUg8UWQ4M7LJcg3wmXTAASQhCKSgWOCYAOS0YTI0qgEpuvE9Qr2sI9ui4sOJkpJSKAA8yfJItci6wbowoVVVjQidGlnzVDhZUPewAWgBWJg7zgAYevoHBkCrd-arESrB5NnOARjudyYACstCw5DQLiQVuRzoRKBQ6EwoE4OLYIOcOBQYCx4YiNExULMrlUAL79YLedabbbvFgHKpzMj4lZ0Hr6br6blqOA0VgaRR0NyJZISSZkaYSJoMooQbqIZ5MJbkCySaSFRQYABqqK0cDcdy5BipXgAAg1NXAMABRGg0OCyJUWjVyLVwRTkEUQaYbQrFHKkY0hdT84xuBVKkIqsgYJoLGMRpgAaiY-2NzpU6joGGZStDysmbIjitNoSkZC0dGCNCqIET3TJVR5hnQarEqDcRlMHGlgo0xrAZIAukA
height: 200px
code: |
from shiny import App, reactive, render, ui
Expand Down Expand Up @@ -52,18 +52,18 @@ listing:

## Details

An action button appears as a button and has a value that increments each time the user presses the button.
An action button appears as a button and has a value that increments each time the user presses the button.

Follow these steps to add an action button to your app:

1. Add `ui.input_action_button()` to the UI of your app to create an action button. Where you call this function will determine where the button will appear within the app's layout.
2. Specify the `id` and `label` parameters of `ui.input_action_button()` to define the button's identifier and label.

2. Specify the `id` and `label` parameters of `ui.input_action_button()` to define the button's identifier and label.

The value of an input component is accessible as a reactive value within the `server()` function. To access the value of an action button:

1. Use `input.<action_button_id()>` (e.g., `input.action_button()`) to access the value of the action button. The server value of an action button is an integer representing the number of clicks.
1. Use `input.<action_button_id()>` (e.g., `input.action_button()`) to access the value of the action button. The server value of an action button is an integer representing the number of clicks.

See also: [Action Link](action-link.qmd)


Expand Down
18 changes: 9 additions & 9 deletions components/inputs/action-link.qmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: "Action Link"
sidebar: components
sidebar: components
previewapp: |
from shiny import App, reactive, render, ui
app_ui = ui.page_fluid(
ui.input_action_link("action_link", "Action"),
ui.input_action_link("action_link", "Action"),
ui.output_text("counter"),
{"class": "vh-100 d-flex justify-content-center align-items-center px-4"}
)
Expand All @@ -20,22 +20,22 @@ listing:
template: ../_partials/components-detail.ejs
contents:
- title: Action Link
preview: https://shinylive.io/py/app/#h=0&code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxM6cKITIcAbnAlSIAEzh0JAVw4AdaOgD6OpgF4mOrFADmcQzQA2O1QAp9TDxY4YGAdzcQnkFeGCROMBAuAGza3lyoWmSGMnKkhg5cANZuKLIcaRkQmbr4TCUAkhCEUlAscEwAclowAEYaJQCUHRLuwR6WYc2RMSHEiQlJFAAeZDkkWuTtYB0YUKqqhoQOtSw5qhwsqNvYALQArEytJwAMnd29fSAlWzsliGVg8mwnAIzX10wAFZaFhyGinEiLcgnQiUCh0JhQDLWCAnDgUGAsGFwjRMVBTc4lAC+DyYKzWGxeLF2JWmZGxizonQ8+g6+nUNFYGkUdBc8USEjGZAmEjq1PyEFFZCgQi41kM8iRWnq5muHUQpPm5DMkmkeUUGAAakq4C5QTK5BB5YqnHA2RBSQABGr6uAYACiNBocFkTpdcgNcEU5D5EAmqzyBSy9qCHKYhhc6tJQS1ZAwdVmqcTTAA1Ewfva-ZR1HQMHTSXHUxpExrAn1dWQtHRAjQSiAsx0SWB9D2DKgdWJUC40KhjBxRdyNIWHTOwESALpAA
preview: https://shinylive.io/py/app/#h=0&code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxM6cKITIcAbnAlSIAEzh0JAVw4AdCPrSoA+jqYBeJjqxQA5nGM0ANjtUAKfUy9WOGBgHcPCG8QnwwSFxgINwA2bV8uVC0yYxk5UmMnLgBrDxRZDgysiGzdfCYygEkIQikoFjgmADktGAAjDTKASi68T1CvawjW6Liw4mSklIoADzI8ki1yTrAujChVVWNCJ3qWPNUOFlRd7ABaAFYmdrOABm7e-oGQMp29ssQKsHk2M4BGW63JgAKy0LDkNHOJGW5DOhEoFDoTCgWVsEDOHAoMBYcIRGiYqBmlzKAF8+sFvGsNls3ix9mVZmRccs6N19F19Jy1HAaKwNIo6G5EskJBMyFMJA06YUIF1EE8mItyBZJNICooMAA1FFaOBuW4cgwUrwAATq6rgGAAojQaHBZAqzWq5Bq4IpyEKIFN1gUijlDSF1LzjG45QqQkqyBgGvNI6GmABqJh-Q2OlTqOgYRkKoOKiYs0Py42hKRkLR0YI0MogONdEllLmGdAqsSoNxGUwcSX8jSGsAkgC6QA
height: 200px
code: |
from shiny import App, reactive, render, ui
app_ui = ui.page_fluid(
ui.input_action_link("action_link", "Action"), #<<
ui.output_text("counter")
)
def server(input, output, session):
@render.text()
@reactive.event(input.action_link)
def counter():
return f"{input.action_link()}"
app = App(app_ui, server)
relevantfunctions:
- title: ui.input_action_link
Expand All @@ -57,10 +57,10 @@ An action link appears as a link in your app and has a value that increments eac
Follow these steps to add an action link to your app:

1. Add `ui.input_action_link()` to the UI of your app to create an action link. Where you call this function will determine where the link appears within the app's layout.
2. Specify the `id` and `label` parameters of `ui.input_action_link()` to define the action link's identifier and label.
2. Specify the `id` and `label` parameters of `ui.input_action_link()` to define the action link's identifier and label.

The value of an input component is accessible as a reactive value within the `server()` function. To access the value of an action link:

1. Use `input.<action_link_id()>` (e.g., `input.action_link()`) to access the value of the action link. The server value of an action link is an integer representing the number of clicks.

See also: [Action Button](action-button.qmd)
See also: [Action Button](action-button.qmd)

0 comments on commit c85d169

Please sign in to comment.