Merge pull request #32178 from Vivek1819/docs/select-disabled-options

docs: add example for disabling individual Select options
This commit is contained in:
Fredrik Adelöw
2026-01-07 16:11:04 +01:00
committed by GitHub
2 changed files with 26 additions and 0 deletions
+13
View File
@@ -14,6 +14,7 @@ import {
selectSearchableSnippet,
selectMultipleSnippet,
selectSearchableMultipleSnippet,
selectDisabledOptionsSnippet,
} from './select.props';
import { PageTitle } from '@/components/PageTitle';
import { Theming } from '@/components/Theming';
@@ -91,6 +92,18 @@ Here's a view when the select is disabled.
code={selectDisabledSnippet}
/>
### Disabled options
You can disable specific options within the Select component using `disabledKeys`.
<Snippet
align="center"
py={4}
open
preview={<SelectSnippet story="DisabledOption" />}
code={selectDisabledOptionsSnippet}
/>
### Searchable
Here's a view when the select has searchable filtering.
+13
View File
@@ -209,3 +209,16 @@ export const selectSearchableMultipleSnippet = `<Select
// ... more options
]}
/>`;
export const selectDisabledOptionsSnippet = `<Select
name="font"
label="Font Family"
placeholder="Select a font"
disabledKeys={['cursive', 'serif']}
options={[
{ value: 'sans', label: 'Sans-serif' },
{ value: 'serif', label: 'Serif' },
{ value: 'mono', label: 'Monospace' },
{ value: 'cursive', label: 'Cursive' },
]}
/>`;