A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
feat: added disabled prop to number field (#4919)
Joaquin Corominaa78dc626fb79
diff --git a/frontend/src/plugins/impl/NumberPlugin.tsx b/frontend/src/plugins/impl/NumberPlugin.tsxindex f9bb6c4870..4e9d3becd1 100644--- a/frontend/src/plugins/impl/NumberPlugin.tsx+++ b/frontend/src/plugins/impl/NumberPlugin.tsx@@ -17,6 +17,7 @@ interface Data {label: string | null;debounce: boolean;fullWidth: boolean;+ disabled?: boolean;}export class NumberPlugin implements IPlugin<T | null, Data> {@@ -30,6 +31,7 @@ export class NumberPlugin implements IPlugin<T | null, Data> {step: z.number().optional(),debounce: z.boolean().default(false),fullWidth: z.boolean().default(false),+ disabled: z.boolean().optional(),});render(props: IPluginProps<T | null, Data>): JSX.Element {@@ -76,6 +78,7 @@ const NumberComponent = (props: NumberComponentProps): JSX.Element => {onChange={onChange}id={id}aria-label={props.label || "Number input"}+ isDisabled={props.disabled}/></Labeled>);diff --git a/marimo/_plugins/ui/_impl/input.py b/marimo/_plugins/ui/_impl/input.pyindex c4037cdb78..d93494e70d 100644--- a/marimo/_plugins/ui/_impl/input.py+++ b/marimo/_plugins/ui/_impl/input.py@@ -77,6 +77,7 @@ class number(UIElement[Optional[Numeric], Optional[Numeric]]):label (str): Markdown label for the element. Defaults to an empty string.on_change (Optional[Callable[[Optional[Numeric]], None]]): Optional callback to run when this element's value changes. Defaults to None.full_width (bool): Whether the input should take up the full width of its container. Defaults to False.+ disabled (bool, optional): Whether the input is disabled. Defaults to False.Methods:from_series(series: DataFrameSeries, **kwargs: Any) -> number:@@ -96,6 +97,7 @@ class number(UIElement[Optional[Numeric], Optional[Numeric]]):label: str = "",on_change: Optional[Callable[[Optional[Numeric]], None]] = None,full_width: bool = False,+ disabled: bool = False,) -> None:validate_range(min_value=start, max_value=stop)validate_between_range(value, min_value=start, max_value=stop)@@ -124,6 +126,7 @@ class number(UIElement[Optional[Numeric], Optional[Numeric]]):"step": step if step is not None else None,"debounce": debounce,"full-width": full_width,+ "disabled": disabled,},on_change=on_change,)