Skip to content

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.

feat: added disabled prop to date range plugin (#5031)

Joaquin Coromina8ba7c3427649
diff --git a/frontend/src/plugins/impl/DateRangePlugin.tsx b/frontend/src/plugins/impl/DateRangePlugin.tsx
index 57986e7c5b..efbc49314a 100644
--- a/frontend/src/plugins/impl/DateRangePlugin.tsx
+++ b/frontend/src/plugins/impl/DateRangePlugin.tsx
@@ -14,6 +14,7 @@ interface Data {
stop: string;
step?: string;
fullWidth: boolean;
+ disabled?: boolean;
}
export class DateRangePickerPlugin implements IPlugin<T, Data> {
@@ -26,6 +27,7 @@ export class DateRangePickerPlugin implements IPlugin<T, Data> {
stop: z.string(),
step: z.string().optional(),
fullWidth: z.boolean().default(false),
+ disabled: z.boolean().optional(),
});
render(props: IPluginProps<T, Data>): JSX.Element {
@@ -72,6 +74,7 @@ const DateRangePickerComponent = (props: DateRangePickerProps): JSX.Element => {
aria-label={props.label ?? "date range picker"}
minValue={parseDate(props.start)}
maxValue={parseDate(props.stop)}
+ isDisabled={props.disabled}
/>
</Labeled>
);
diff --git a/marimo/_plugins/ui/_impl/dates.py b/marimo/_plugins/ui/_impl/dates.py
index 35ffbbbbce..253af6ee47 100644
--- a/marimo/_plugins/ui/_impl/dates.py
+++ b/marimo/_plugins/ui/_impl/dates.py
@@ -355,6 +355,7 @@ class date_range(UIElement[tuple[str, str], tuple[dt.date, dt.date]]):
label (str, optional): Markdown label for the element.
on_change (Callable[[Tuple[datetime.date, datetime.date]], None], optional): Optional callback to run when this element's value changes.
full_width (bool, optional): Whether the input should take up the full width of its container.
+ disabled (bool, optional): Whether the input should be disabled.
"""
_name: Final[str] = "marimo-date-range"
@@ -369,6 +370,7 @@ class date_range(UIElement[tuple[str, str], tuple[dt.date, dt.date]]):
label: Optional[str] = None,
on_change: Optional[Callable[[tuple[dt.date, dt.date]], None]] = None,
full_width: bool = False,
+ disabled: bool = False,
):
if isinstance(start, str):
start = self._convert_single_value(start)
@@ -410,6 +412,7 @@ class date_range(UIElement[tuple[str, str], tuple[dt.date, dt.date]]):
"start": self._start.isoformat(),
"stop": self._stop.isoformat(),
"full-width": full_width,
+ "disabled": disabled,
},
on_change=on_change,
)