diff --git a/packages/@mantine/core/src/components/Combobox/Combobox.types.ts b/packages/@mantine/core/src/components/Combobox/Combobox.types.ts index 089f88b1d31..1e30e8f07fd 100644 --- a/packages/@mantine/core/src/components/Combobox/Combobox.types.ts +++ b/packages/@mantine/core/src/components/Combobox/Combobox.types.ts @@ -34,7 +34,7 @@ export type ComboboxLikeStylesNames = Exclude ComboboxParsedItem[]; @@ -95,6 +95,7 @@ export interface OptionsDropdownProps { hidden?: boolean; hiddenWhenEmpty?: boolean; filterOptions?: boolean; + validateOptions?: boolean; withCheckIcon?: boolean; value?: string | string[] | null; checkIconPosition?: 'left' | 'right'; @@ -116,6 +117,7 @@ export function OptionsDropdown({ maxDropdownHeight, withScrollArea = true, filterOptions = true, + validateOptions = false, withCheckIcon = false, value, checkIconPosition, @@ -126,7 +128,9 @@ export function OptionsDropdown({ scrollAreaProps, 'aria-label': ariaLabel, }: OptionsDropdownProps) { - validateOptions(data); + if (validateOptions) { + validateOptionsFn(data); + } const shouldFilter = typeof search === 'string'; const filteredData = shouldFilter diff --git a/packages/@mantine/core/src/components/MultiSelect/MultiSelect.tsx b/packages/@mantine/core/src/components/MultiSelect/MultiSelect.tsx index 863a94bd861..125f85da8a6 100644 --- a/packages/@mantine/core/src/components/MultiSelect/MultiSelect.tsx +++ b/packages/@mantine/core/src/components/MultiSelect/MultiSelect.tsx @@ -189,6 +189,7 @@ export const MultiSelect = factory((_props, ref) => { required, mod, renderOption, + validateOptions, onRemove, onClear, scrollAreaProps, @@ -412,6 +413,7 @@ export const MultiSelect = factory((_props, ref) => { withScrollArea={withScrollArea} maxDropdownHeight={maxDropdownHeight} filterOptions={searchable} + validateOptions={validateOptions} value={_value} checkIconPosition={checkIconPosition} withCheckIcon={withCheckIcon} diff --git a/packages/@mantine/core/src/components/Select/Select.tsx b/packages/@mantine/core/src/components/Select/Select.tsx index 8fda3c2dc82..8ffafa3f608 100644 --- a/packages/@mantine/core/src/components/Select/Select.tsx +++ b/packages/@mantine/core/src/components/Select/Select.tsx @@ -145,6 +145,7 @@ export const Select = factory((_props, ref) => { clearButtonProps, hiddenInputProps, renderOption, + validateOptions, onClear, autoComplete, scrollAreaProps, @@ -300,6 +301,7 @@ export const Select = factory((_props, ref) => { withScrollArea={withScrollArea} maxDropdownHeight={maxDropdownHeight} filterOptions={searchable && selectedOption?.label !== search} + validateOptions={validateOptions} value={_value} checkIconPosition={checkIconPosition} withCheckIcon={withCheckIcon}