Use single-line Python to define input widgets and retrieve their values in code
.value
on the variable, you can access the actual widget value. For example:
File Input
label
: string string value (required)default
: string latch data path string used as the default widget valuerequired
: boolean a boolean that sets the input as requiring input by user and errored when emptyappearance
: dict containing widget appearance attributes:"placeholder"
: string placeholder value displayed before a set value"detail"
: string secondary label text displayed after thet label"help_text"
: string informative text displayed below input"error_text"
: string error text displayed below input that replaceshelp_text
and sets the input state as errored"description"
: string longer description text displayed in a hoverable tooltip next to the label
Registry Table Input
label
: string label (required)default
: string id of a registry tablerequired
: boolean that sets the input as requiring input by user and errored when emptyappearance
: dict containing widget appearance attributes:"placeholder"
: string placeholder value displayed before a set value"detail"
: string secondary label text displayed after thet label"help_text"
: string informative text displayed below input"error_text"
: string error text displayed below input that replaceshelp_text
and sets the input state as errored"description"
: string longer description text displayed in a hoverable tooltip next to the label
id
: string id of registry tableMethodsTable.get_dataframe()
: returns a pandas dataframe for the provided registry table idDatasource
Text Input
label
: string label (required)default
: default string value for inputrequired
: a boolean that sets the input as requiring input by user and errored when emptyappearance
: a dict containing widget appearance attributes:"placeholder"
: placeholder value displayed before a set value"detail"
: secondary label text displayed after thet label"help_text"
: informative text displayed below input"error_text"
: error text displayed below input that replaceshelp_text
and sets the input state as errored"description"
: longer description text displayed in a hoverable tooltip next to the label
Select Input
label
: string label (required)options
: list of values for the selectdefault
: default option from optionsrequired
: a boolean that sets the input as requiring input by user and errored when emptyappearance
: a dict containing widget appearance attributes:"placeholder"
: placeholder value displayed before a set value"detail"
: secondary label text displayed after thet label"help_text"
: informative text displayed below input"error_text"
: error text displayed below input that replaceshelp_text
and sets the input state as errored"description"
: longer description text displayed in a hoverable tooltip next to the label
Multiselect Input
label
: string label (required)options
: list of values for the selectdefault
: list of default options from optionsrequired
: a boolean that sets the input as requiring input by user and errored when emptyappearance
: a dict containing widget appearance attributes:"placeholder"
: placeholder value displayed before a set value"detail"
: secondary label text displayed after thet label"help_text"
: informative text displayed below input"error_text"
: error text displayed below input that replaceshelp_text
and sets the input state as errored"description"
: longer description text displayed in a hoverable tooltip next to the label
Radio Group Input
Checkbox Input
Mutliple Widgets in a Row
Button Widget
appearance
: a dict containing widget appearance attributes:
"placeholder"
: placeholder value displayed before a set value"detail"
: secondary label text displayed after thet label"help_text"
: informative text displayed below input"error_text"
: error text displayed below input that replaceshelp_text
and sets the input state as errored"description"
: longer description text displayed in a hoverable tooltip next to the label
a
is the writer. When the user inputs a new value, it updates the Signal associated with a
.a.value
makes the cell a listener. Whenever the input in a changes, the cell will automatically re-run. Calling a.value
also returns the widget’s current value.a.value
, ensuring they also re-execute when a is updated..value
. However, there are times when you don’t want to trigger an automatic cell run when the widget value updates, especially if the cells using widget.value
are computationally expensive. There are two solutions to this problem:
.sample()
sample()
.sample()
to access the widget’s value without triggering a cell rerun. Think of .sample()
as capturing a snapshot of the widget’s value at the precise moment you click the “Run” button in the upper right corner of a cell.
Examples:
The following code cell will automatically rerun whenever the widget value changes: