Skip to content

Commit 42f5e14

Browse files
committed
chore(ListBox): update docs
1 parent dc6cafd commit 42f5e14

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/components/fields/ListBox/ListBox.docs.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ The `mods` property accepts the following modifiers you can override:
126126
- Array of keys for items that should be disabled
127127
- Disabled items cannot be selected and are visually distinguished
128128

129+
### Visual Styling
130+
131+
**type** (`'card' | 'plain' | 'popover'`, default: `'card'`)
132+
- Controls the visual styling of the ListBox container
133+
- `card`: Standard card styling with border and margin (default)
134+
- `plain`: No border, no margin, no radius - suitable for embedded use
135+
- `popover`: No border, but keeps margin and radius - suitable for overlay use
136+
- Use `plain` when embedding ListBox directly into another component
137+
- Use `popover` when using ListBox inside overlays (Dialog, ComboBox, Picker)
138+
129139
### Focus and Interaction
130140

131141
**focusOnHover** (`boolean`, default: `true`)
@@ -515,6 +525,30 @@ const [selectedKey, setSelectedKey] = useState('apple');
515525
</ListBox>
516526
```
517527

528+
### Visual Type Variants
529+
530+
<Story of={ListBoxStories.TypeVariants} />
531+
532+
```jsx
533+
{/* Card type (default) - with border and margin */}
534+
<ListBox type="card" label="Select a fruit" selectionMode="single">
535+
<ListBox.Item key="apple">Apple</ListBox.Item>
536+
<ListBox.Item key="banana">Banana</ListBox.Item>
537+
</ListBox>
538+
539+
{/* Plain type - no border, no margin, no radius */}
540+
<ListBox type="plain" label="Select a fruit" selectionMode="single">
541+
<ListBox.Item key="apple">Apple</ListBox.Item>
542+
<ListBox.Item key="banana">Banana</ListBox.Item>
543+
</ListBox>
544+
545+
{/* Popover type - no border, but keeps margin and radius */}
546+
<ListBox type="popover" label="Select a fruit" selectionMode="single">
547+
<ListBox.Item key="apple">Apple</ListBox.Item>
548+
<ListBox.Item key="banana">Banana</ListBox.Item>
549+
</ListBox>
550+
```
551+
518552
### Custom Escape Handling
519553

520554
<Story of={ListBoxStories.EscapeKeyHandling} />

0 commit comments

Comments
 (0)