Skip to content

Commit 3054830

Browse files
export select description
1 parent 2b60e47 commit 3054830

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { component$, useStyles$ } from '@builder.io/qwik';
2+
import { Select } from '@qwik-ui/headless';
3+
4+
export default component$(() => {
5+
useStyles$(styles);
6+
const users = ['Tim', 'Ryan', 'Jim', 'Jessie', 'Abby'];
7+
8+
return (
9+
<Select.Root class="select">
10+
<Select.Label>Logged in users</Select.Label>
11+
<Select.Trigger class="select-trigger">
12+
<Select.DisplayValue placeholder="Select an option" />
13+
</Select.Trigger>
14+
<Select.Description>Select a user to see their profile</Select.Description>
15+
<Select.Popover class="select-popover">
16+
<Select.Listbox class="select-listbox">
17+
{users.map((user) => (
18+
<Select.Item class="select-item" key={user}>
19+
<Select.ItemLabel>{user}</Select.ItemLabel>
20+
<Select.ItemIndicator>
21+
<LuCheck />
22+
</Select.ItemIndicator>
23+
</Select.Item>
24+
))}
25+
</Select.Listbox>
26+
</Select.Popover>
27+
</Select.Root>
28+
);
29+
});
30+
31+
// internal
32+
import styles from '../snippets/select.css?inline';
33+
import { LuCheck } from '@qwikest/icons/lucide';

apps/website/src/routes/docs/headless/select/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ The native select element is created when a form name has been given to `<Select
177177

178178
Above is an example of submitting a multi-select form.
179179

180+
### Descriptions
181+
182+
Provide more information to assistive technologies by adding a description to the select.
183+
184+
<Showcase name="description" />
185+
180186
## Component state
181187

182188
We can select an initial uncontrolled value by passing the `value` prop to the `<Select.Root />` component.

packages/kit-headless/src/components/select/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export { HSelectGroupLabel as GroupLabel } from './select-group-label';
99
export { HSelectItem as Item } from './select-item';
1010
export { HSelectItemLabel as ItemLabel } from './select-item-label';
1111
export { HSelectItemIndicator as ItemIndicator } from './select-item-indicator';
12+
export { HSelectDescription as Description } from './select-description';
1213
export { HHiddenNativeSelect as HiddenNativeSelect } from './hidden-select';

0 commit comments

Comments
 (0)