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(ui): support disabled on dropdown and multiselect (#9600)
Kiran Gadhave078ee3666688
diff --git a/frontend/src/components/data-table/charts/components/form-fields.tsx b/frontend/src/components/data-table/charts/components/form-fields.tsxindex 065f686371..bae1728800 100644--- a/frontend/src/components/data-table/charts/components/form-fields.tsx+++ b/frontend/src/components/data-table/charts/components/form-fields.tsx@@ -789,6 +789,7 @@ export const TooltipSelect = ({<FormControl><Multiselectoptions={fields?.map((field) => field.name) ?? []}+ disabled={false}value={values}setValue={(values) => {const selectedValues =diff --git a/frontend/src/components/ui/combobox.tsx b/frontend/src/components/ui/combobox.tsxindex 6cd8cf9964..738c38e501 100644--- a/frontend/src/components/ui/combobox.tsx+++ b/frontend/src/components/ui/combobox.tsx@@ -39,6 +39,7 @@ interface ComboboxCommonProps<TValue> {className?: string;id?: string;keepPopoverOpenOnSelect?: boolean;+ disabled?: boolean;}type ComboboxFilterProps =@@ -95,6 +96,7 @@ export const Combobox = <TValue,>({chipsClassName,keepPopoverOpenOnSelect,id,+ disabled = false,...rest}: ComboboxProps<TValue>) => {const [open = false, setOpen] = useControllableState({@@ -168,16 +170,26 @@ export const Combobox = <TValue,>({return (<div className={cn("relative")} {...rest}>- <Popover open={open} onOpenChange={setOpen}>+ <Popover+ open={open}+ onOpenChange={(v) => {+ if (disabled && v) {+ return;+ }+ setOpen(v);+ }}+ ><PopoverTrigger asChild={true}><buttonid={id}type="button"className={cn(- "flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50",+ "flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid",+ disabled && "cursor-not-allowed opacity-50",className,)}aria-expanded={open}+ aria-disabled={disabled}><span className="truncate flex-1 min-w-0">{renderValue()}</span><ChevronDownIcon className="ml-3 w-4 h-4 opacity-50 shrink-0" />@@ -216,9 +228,15 @@ export const Combobox = <TValue,>({{displayValue?.(val) ?? String(val)}<XCircleonClick={() => {+ if (disabled) {+ return;+ }handleSelect(val);}}- className="w-3 h-3 opacity-50 hover:opacity-100 ml-1 cursor-pointer"+ className={cn(+ "w-3 h-3 opacity-50 hover:opacity-100 ml-1 cursor-pointer",+ disabled && "pointer-events-none",+ )}/></Badge>);diff --git a/frontend/src/plugins/impl/DropdownPlugin.tsx b/frontend/src/plugins/impl/DropdownPlugin.tsxindex 47f6a81312..0567e21ef7 100644--- a/frontend/src/plugins/impl/DropdownPlugin.tsx+++ b/frontend/src/plugins/impl/DropdownPlugin.tsx@@ -13,6 +13,7 @@ interface Data {allowSelectNone: boolean;fullWidth: boolean;searchable: boolean;+ disabled: boolean;}export class DropdownPlugin implements IPlugin<string[], Data> {@@ -25,6 +26,7 @@ export class DropdownPlugin implements IPlugin<string[], Data> {allowSelectNone: z.boolean(),fullWidth: z.boolean().default(false),searchable: z.boolean().default(false),+ disabled: z.boolean().default(false),});render(props: IPluginProps<string[], Data>): JSX.Element {@@ -61,7 +63,15 @@ interface DropdownProps extends Data {const EMPTY_VALUE = "--";const Dropdown = (props: DropdownProps): JSX.Element => {- const { label, options, value, setValue, allowSelectNone, fullWidth } = props;+ const {+ label,+ options,+ value,+ setValue,+ allowSelectNone,+ fullWidth,+ disabled,+ } = props;const id = useId();@@ -85,6 +95,7 @@ const Dropdown = (props: DropdownProps): JSX.Element => {})}value={singleValue}id={id}+ disabled={disabled}>{allowSelectNone ? (<option value={EMPTY_VALUE} selected={value.length === 0}>diff --git a/frontend/src/plugins/impl/MultiselectPlugin.tsx b/frontend/src/plugins/impl/MultiselectPlugin.tsxindex 6e11edaa4e..46f6736a53 100644--- a/frontend/src/plugins/impl/MultiselectPlugin.tsx+++ b/frontend/src/plugins/impl/MultiselectPlugin.tsx@@ -14,6 +14,7 @@ interface Data {options: string[];fullWidth: boolean;maxSelections?: number | undefined;+ disabled: boolean;}type T = string[];@@ -27,6 +28,7 @@ export class MultiselectPlugin implements IPlugin<T, Data> {options: z.array(z.string()),fullWidth: z.boolean().default(false),maxSelections: z.number().optional(),+ disabled: z.boolean().default(false),});render(props: IPluginProps<string[], Data>): JSX.Element {@@ -63,6 +65,7 @@ export const Multiselect = ({setValue,fullWidth,maxSelections,+ disabled,}: MultiselectProps): JSX.Element => {const id = useId();const [searchQuery, setSearchQuery] = useState<string>("");@@ -199,6 +202,7 @@ export const Multiselect = ({shouldFilter={false}search={searchQuery}onSearchChange={setSearchQuery}+ disabled={disabled}>{renderList()}</Combobox>diff --git a/frontend/src/plugins/impl/SearchableSelect.tsx b/frontend/src/plugins/impl/SearchableSelect.tsxindex 9ddcdcb9b3..b7bee98352 100644--- a/frontend/src/plugins/impl/SearchableSelect.tsx+++ b/frontend/src/plugins/impl/SearchableSelect.tsx@@ -13,12 +13,21 @@ interface SearchableSelectProps {label: string | null;allowSelectNone: boolean;fullWidth: boolean;+ disabled: boolean;}const NONE_KEY = "__none__";export const SearchableSelect = (props: SearchableSelectProps): JSX.Element => {- const { options, value, setValue, label, allowSelectNone, fullWidth } = props;+ const {+ options,+ value,+ setValue,+ label,+ allowSelectNone,+ fullWidth,+ disabled,+ } = props;const id = useId();const [searchQuery, setSearchQuery] = useState<string>("");@@ -113,6 +122,7 @@ export const SearchableSelect = (props: SearchableSelectProps): JSX.Element => {shouldFilter={false}search={searchQuery}onSearchChange={setSearchQuery}+ disabled={disabled}data-testid="marimo-plugin-searchable-dropdown">{renderList()}diff --git a/frontend/src/plugins/impl/__tests__/DropdownPlugin.test.tsx b/frontend/src/plugins/impl/__tests__/DropdownPlugin.test.tsxindex 2e7cbc4cd0..f285e85f08 100644--- a/frontend/src/plugins/impl/__tests__/DropdownPlugin.test.tsx+++ b/frontend/src/plugins/impl/__tests__/DropdownPlugin.test.tsx@@ -36,6 +36,7 @@ describe("DropdownPlugin", () => {fullWidth: false,searchable: true,initialValue: [],+ disabled: false,},value: [],setValue: vi.fn(),@@ -48,6 +49,58 @@ describe("DropdownPlugin", () => {).toBeInTheDocument();});+ it("renders disabled native select when disabled is true", () => {+ const plugin = new DropdownPlugin();+ const host = document.createElement("div");+ const props: IPluginProps<+ string[],+ z.infer<(typeof plugin)["validator"]>+ > = {+ data: {+ label: "Test Label",+ options: ["Option 1", "Option 2"],+ allowSelectNone: false,+ fullWidth: false,+ searchable: false,+ disabled: true,+ initialValue: [],+ },+ value: [],+ setValue: vi.fn(),+ host,+ functions: {},+ };+ render(plugin.render(props));+ expect(screen.getByTestId("marimo-plugin-dropdown")).toBeDisabled();+ });++ it("renders disabled searchable combobox with aria-disabled", () => {+ const plugin = new DropdownPlugin();+ const host = document.createElement("div");+ const props: IPluginProps<+ string[],+ z.infer<(typeof plugin)["validator"]>+ > = {+ data: {+ label: "Test Label",+ options: ["Option 1", "Option 2"],+ allowSelectNone: false,+ fullWidth: false,+ searchable: true,+ disabled: true,+ initialValue: [],+ },+ value: [],+ setValue: vi.fn(),+ host,+ functions: {},+ };+ render(plugin.render(props));+ const trigger = screen.getByTestId("marimo-plugin-searchable-dropdown")+ .firstChild as HTMLElement;+ expect(trigger).toHaveAttribute("aria-disabled", "true");+ });+it("renders default dropdown when searchable is false", () => {const plugin = new DropdownPlugin();const host = document.createElement("div");@@ -62,6 +115,7 @@ describe("DropdownPlugin", () => {fullWidth: false,searchable: false,initialValue: [],+ disabled: false,},value: [],setValue: vi.fn(),@@ -87,6 +141,7 @@ describe("DropdownPlugin", () => {fullWidth: false,searchable: true,initialValue: [],+ disabled: false,},value: [],setValue,@@ -129,6 +184,7 @@ describe("DropdownPlugin", () => {fullWidth: false,searchable: true,initialValue: [],+ disabled: false,},value: ["Apple"],setValue,diff --git a/frontend/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap b/frontend/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snapindex 30aab5dec9..16417801c9 100644--- a/frontend/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap+++ b/frontend/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap@@ -29,9 +29,10 @@ exports[`renderZodSchema > should render a form aggregate 1`] = `><buttonaria-controls="radix-_r_27_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_26_-form-item"type="button"@@ -84,9 +85,10 @@ exports[`renderZodSchema > should render a form aggregate 1`] = `><buttonaria-controls="radix-_r_29_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_28_-form-item"type="button"@@ -401,9 +403,10 @@ exports[`renderZodSchema > should render a form explode_columns 1`] = `><buttonaria-controls="radix-_r_2p_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_2o_-form-item"type="button"@@ -598,9 +601,10 @@ exports[`renderZodSchema > should render a form group_by 1`] = `><buttonaria-controls="radix-_r_1p_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_1o_-form-item"type="button"@@ -653,9 +657,10 @@ exports[`renderZodSchema > should render a form group_by 1`] = `><buttonaria-controls="radix-_r_1r_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_1q_-form-item"type="button"@@ -800,9 +805,10 @@ exports[`renderZodSchema > should render a form pivot 1`] = `><buttonaria-controls="radix-_r_3b_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_3a_-form-item"type="button"@@ -855,9 +861,10 @@ exports[`renderZodSchema > should render a form pivot 1`] = `><buttonaria-controls="radix-_r_3d_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_3c_-form-item"type="button"@@ -910,9 +917,10 @@ exports[`renderZodSchema > should render a form pivot 1`] = `><buttonaria-controls="radix-_r_3f_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_3e_-form-item"type="button"@@ -1300,9 +1308,10 @@ exports[`renderZodSchema > should render a form select_columns 1`] = `><buttonaria-controls="radix-_r_4_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_3_-form-item"type="button"@@ -1583,9 +1592,10 @@ exports[`renderZodSchema > should render a form unique 1`] = `><buttonaria-controls="radix-_r_32_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_31_-form-item"type="button"@@ -1742,9 +1752,10 @@ exports[`renders custom forms column_id_array 1`] = `><buttonaria-controls="radix-_r_41_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_40_-form-item"type="button"@@ -1792,9 +1803,10 @@ exports[`renders custom forms column_id_dot_array 1`] = `><buttonaria-controls="radix-_r_43_"+ aria-disabled="false"aria-expanded="false"aria-haspopup="dialog"- class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid disabled:cursor-not-allowed disabled:opacity-50 min-w-[180px]"+ class="flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid min-w-[180px]"data-state="closed"id="_r_42_-form-item"type="button"diff --git a/marimo/_plugins/ui/_impl/input.py b/marimo/_plugins/ui/_impl/input.pyindex 5a980780f4..9a3b72988f 100644--- a/marimo/_plugins/ui/_impl/input.py+++ b/marimo/_plugins/ui/_impl/input.py@@ -996,6 +996,7 @@ class dropdown(UIElement[list[str], Any]):this element's value changes. Defaults to None.full_width (bool, optional): Whether the input should take up the full widthof its container. Defaults to False.+ disabled (bool, optional): Whether the dropdown is disabled. Defaults to False."""_FORCE_SEARCHABLE: Final[int] = 1000@@ -1013,6 +1014,7 @@ class dropdown(UIElement[list[str], Any]):label: str = "",on_change: Callable[[Any], None] | None = None,full_width: bool = False,+ disabled: bool = False,) -> None:# Force searchable if there are too many options# This makes the list 'virtualized' on the frontend@@ -1050,6 +1052,7 @@ class dropdown(UIElement[list[str], Any]):"allow-select-none": allow_select_none,"searchable": searchable,"full-width": full_width,+ "disabled": disabled,},on_change=on_change,)@@ -1118,6 +1121,7 @@ class multiselect(UIElement[list[str], list[object]]):of its container. Defaults to False.max_selections (int, optional): Maximum number of items that can be selected.Defaults to None.+ disabled (bool, optional): Whether the multiselect is disabled. Defaults to False."""_MAX_OPTIONS: Final[int] = 100000@@ -1132,6 +1136,7 @@ class multiselect(UIElement[list[str], list[object]]):on_change: Callable[[list[object]], None] | None = None,full_width: bool = False,max_selections: int | None = None,+ disabled: bool = False,) -> None:if len(options) > multiselect._MAX_OPTIONS:raise ValueError(@@ -1169,6 +1174,7 @@ class multiselect(UIElement[list[str], list[object]]):"options": list(self.options.keys()),"full-width": full_width,"max-selections": max_selections,+ "disabled": disabled,},on_change=on_change,)diff --git a/tests/_plugins/ui/_impl/test_input.py b/tests/_plugins/ui/_impl/test_input.pyindex 71643f6f68..0712676a36 100644--- a/tests/_plugins/ui/_impl/test_input.py+++ b/tests/_plugins/ui/_impl/test_input.py@@ -466,6 +466,14 @@ def test_dropdown_lots_of_options() -> None:assert dropdown._component_args["searchable"] is True+def test_dropdown_disabled() -> None:+ dd = ui.dropdown(options=["1", "2", "3"])+ assert dd._component_args["disabled"] is False++ dd = ui.dropdown(options=["1", "2", "3"], disabled=True)+ assert dd._component_args["disabled"] is True++@pytest.mark.skipif(not HAS_PANDAS, reason="pandas not installed")def test_dropdown_from_dataframe() -> None:import pandas as pd@@ -587,6 +595,14 @@ def test_multiselect_too_many_options() -> None:assert "maximum number" in str(e.value)+def test_multiselect_disabled() -> None:+ ms = ui.multiselect(options=["1", "2", "3"])+ assert ms._component_args["disabled"] is False++ ms = ui.multiselect(options=["1", "2", "3"], disabled=True)+ assert ms._component_args["disabled"] is True++@pytest.mark.skipif(not HAS_PANDAS, reason="pandas not installed")def test_multiselect_from_dataframe() -> None:import pandas as pd