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 to datetime (#5046)

Joaquin Coromina183491793040
diff --git a/frontend/src/plugins/impl/DateTimePickerPlugin.tsx b/frontend/src/plugins/impl/DateTimePickerPlugin.tsx
index 177c410c62..d0f46921a8 100644
--- a/frontend/src/plugins/impl/DateTimePickerPlugin.tsx
+++ b/frontend/src/plugins/impl/DateTimePickerPlugin.tsx
@@ -14,6 +14,7 @@ interface Data {
stop: string;
step?: string;
fullWidth: boolean;
+ disabled?: boolean;
}
export class DateTimePickerPlugin implements IPlugin<T, Data> {
@@ -26,6 +27,7 @@ export class DateTimePickerPlugin 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 {
@@ -66,6 +68,7 @@ const DateTimePickerComponent = (props: DateTimePickerProps): JSX.Element => {
aria-label={props.label ?? "date time picker"}
minValue={parseDateTime(props.start)}
maxValue={parseDateTime(props.stop)}
+ isDisabled={props.disabled}
/>
</Labeled>
);
diff --git a/marimo/_plugins/ui/_impl/dates.py b/marimo/_plugins/ui/_impl/dates.py
index 253af6ee47..2358535ea4 100644
--- a/marimo/_plugins/ui/_impl/dates.py
+++ b/marimo/_plugins/ui/_impl/dates.py
@@ -209,6 +209,7 @@ class datetime(UIElement[Optional[str], Optional[dt.datetime]]):
label (str, optional): Markdown label for the element.
on_change (Callable[[Optional[datetime.datetime]], 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. Defaults to False.
"""
_name: Final[str] = "marimo-datetime"
@@ -223,6 +224,7 @@ class datetime(UIElement[Optional[str], Optional[dt.datetime]]):
label: Optional[str] = None,
on_change: Optional[Callable[[Optional[dt.datetime]], None]] = None,
full_width: bool = False,
+ disabled: bool = False,
):
if isinstance(start, str):
start = self._convert_value(start)
@@ -264,6 +266,7 @@ class datetime(UIElement[Optional[str], Optional[dt.datetime]]):
"start": self._start.strftime(self.DATETIME_FORMAT),
"stop": self._stop.strftime(self.DATETIME_FORMAT),
"full-width": full_width,
+ "disabled": disabled,
},
on_change=on_change,
)