MCPcopy Create free account
hub / github.com/kobaltedev/kobalte / DefaultValueExample

Function DefaultValueExample

apps/docs/src/examples/select.tsx:41–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39}
40
41export function DefaultValueExample() {
42 return (
43 <Select
44 defaultValue="Blueberry"
45 options={STRING_OPTIONS}
46 placeholder="Select a fruit…"
47 itemComponent={(props) => (
48 <Select.Item item={props.item} class={style.select__item}>
49 <Select.ItemLabel>{props.item.rawValue}</Select.ItemLabel>
50 <Select.ItemIndicator class={style["select__item-indicator"]}>
51 <CheckIcon />
52 </Select.ItemIndicator>
53 </Select.Item>
54 )}
55 >
56 <Select.Trigger class={style.select__trigger} aria-label="Fruit">
57 <Select.Value<string> class={style.select__value}>
58 {(state) => state.selectedOption()}
59 </Select.Value>
60 <Select.Icon class={style.select__icon}>
61 <CaretSortIcon />
62 </Select.Icon>
63 </Select.Trigger>
64 <Select.Portal>
65 <Select.Content class={style.select__content}>
66 <Select.Listbox class={style.select__listbox} />
67 </Select.Content>
68 </Select.Portal>
69 </Select>
70 );
71}
72
73export function ControlledExample() {
74 const [value, setValue] = createSignal("Blueberry");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected