-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs for Express modules (#1535)
- Loading branch information
Showing
5 changed files
with
57 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
import datetime | ||
from shiny import App, render, ui | ||
|
||
from shiny.express import input, render, ui | ||
app_ui = ui.page_fluid( | ||
ui.input_text("name", "Name", "Socrates"), | ||
ui.input_text("years", "Years", "470-399 BC"), | ||
ui.output_ui("person"), | ||
) | ||
|
||
with ui.card(id="card"): | ||
ui.input_slider("val", "slider", 0, 100, 50) | ||
"Text outside of render express call" | ||
ui.tags.br() | ||
f"Rendered time: {str(datetime.datetime.now())}" | ||
|
||
def server(input, output, session): | ||
|
||
@render.express | ||
def render_express(): | ||
"Text inside of render express call" | ||
ui.tags.br() | ||
"Dynamic slider value: " | ||
input.val() | ||
ui.tags.br() | ||
f"Rendered time: {str(datetime.datetime.now())}" | ||
def person(): | ||
from shiny.express import ui | ||
|
||
with ui.card(class_="mt-3"): | ||
ui.h3(input.name()) | ||
input.years() | ||
|
||
|
||
app = App(app_ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from shiny.express import input, render, ui | ||
|
||
ui.input_text("name", "Name", "Socrates") | ||
ui.input_text("years", "Years", "470-399 BC") | ||
|
||
|
||
@render.express | ||
def person(): | ||
with ui.card(class_="mt-3"): | ||
ui.h3(input.name()) | ||
input.years() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters