Skip to content

Commit

Permalink
add to sidebar nav, indentation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gregswinehart committed Nov 9, 2023
1 parent d79d32d commit 8f43eec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
1 change: 1 addition & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ website:
- components/outputs/datatable.qmd
- components/outputs/plot.qmd
- components/outputs/text.qmd
- components/outputs/ui.qmd
- components/outputs/value-box.qmd
- components/outputs/verbatim-text.qmd
- section: "![](/images/chat-dots-fill.svg){.sidebar-icon .sidebar-subtitle}__Display Messages__"
Expand Down
39 changes: 18 additions & 21 deletions components/outputs/ui.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ listing:
ui.output_ui("uiElement"), #<<
)
def server(input, output, session):
@render.ui #<<
@reactive.event(input.add_button) #<<
Expand Down Expand Up @@ -56,32 +55,30 @@ listing:
ui.output_ui("uiElement"), #<<
)
def server(input, output, session):
@render.ui #<<
def uiElement(): #<<
return ui.input_slider("slider", "Current number:", min=1, max=10, value=input.number()), #<<
app = App(app_ui, server)
- title: Toggle to show or hide an input
description: Use an input control to switch between showing or hiding a UI output element.
preview: https://shinylive.io/py/app/#h=0&code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxM6cKITIcAbnAlSIAEzh0JAVw4AdCPrSoA+jqYBeJjqxQA5nGM0ANjtUAKfUy9WOGLqi0yYxYAdw4yQjYPMHZiEOCnDnU6XXwmVIBlNjjWROTUgEo8T29rYkCAoJ1onQBRJzh4ckLiiAL9DrU4GlYNRTo3f0CJcrJKiRY4FhYOUgLEEq8AARVkjB1FpnUeuoamsjd5ze9eHsGISoxY+JY8jUOjiBPn7ykyLTon6yGg26T71J-fJpVIAYWyxEmTCgTAgWhgACMNKkJDAuOYAIyoqAAD0xAAYJPIoC44OYAKztAzQdAWUToNxGUwcCZ9DQFMAAXwAukA
code: |
from shiny import App, reactive, render, ui
app_ui = ui.page_fluid(
ui.input_switch("show_slider", "Show slider"),
ui.output_ui("uiElement"), #<<
)
def server(input, output, session):
@render.ui #<<
def uiElement(): #<<
if (input.show_slider()): #<<
return ui.input_slider("slider", "Choose a number", min=1, max=10, value=5) #<<
app = App(app_ui, server)
- title: Toggle to show or hide an input
description: Use an input control to switch between showing or hiding a UI output element.
preview: https://shinylive.io/py/app/#h=0&code=NobwRAdghgtgpmAXGKAHVA6VBPMAaMAYwHsIAXOcpMAMwCdiYACAZwAsBLCbJjmVYnTJMAgujxM6cKITIcAbnAlSIAEzh0JAVw4AdCPrSoA+jqYBeJjqxQA5nGM0ANjtUAKfUy9WOGLqi0yYxYAdw4yQjYPMHZiEOCnDnU6XXwmVIBlNjjWROTUgEo8T29rYkCAoJ1onQBRJzh4ckLiiAL9DrU4GlYNRTo3f0CJcrJKiRY4FhYOUgLEEq8AARVkjB1FpnUeuoamsjd5ze9eHsGISoxY+JY8jUOjiBPn7ykyLTon6yGg26T71J-fJpVIAYWyxEmTCgTAgWhgACMNKkJDAuOYAIyoqAAD0xAAYJPIoC44OYAKztAzQdAWUToNxGUwcCZ9DQFMAAXwAukA
code: |
from shiny import App, reactive, render, ui
app_ui = ui.page_fluid(
ui.input_switch("show_slider", "Show slider"),
ui.output_ui("uiElement"), #<<
)
def server(input, output, session):
@render.ui #<<
def uiElement(): #<<
if (input.show_slider()): #<<
return ui.input_slider("slider", "Choose a number", min=1, max=10, value=5) #<<
app = App(app_ui, server)
---

Expand Down

0 comments on commit 8f43eec

Please sign in to comment.