Select
A value and a button to open/close a list of choices.
Code
<script lang="ts">
import { Select, ListItem } from '@geoffcox/sterling-svelte';
let selectedValue : string;
let items = [/* list of items */];
</script>
<Select bind:selectedValue>
{#each items as item}
<ListItem value={item} />
{/each}
</Select>
Members
| Property Name | Type | Default | Comment |
---|
| buttonSnippet | Snippet | undefined | undefined |
| disabled | boolean | null | undefined | false |
| listClass | string | undefined | undefined |
| onPending | (value: string) => void | undefined |
| onSelect | (value: string) => void | undefined |
| open | boolean | null | undefined | false |
| selectedValue | string | undefined | undefined |
| valueSnippet | Snippet<[string | undefined]> | undefined | undefined |
| Method Name | Parameters | Return Type | Comment |
---|
| scrollToSelectedItem | | |
Considerations
- Due to lack of styling capabilities with <select>, the Select component does not use <select>
- Includes HTMLDivElement props, events, and methods.
Anatomy
select (<div>)
value (<div>)
value (Snippet) | selectedValue (string) |
button (<div>)
button (Snippet) | chevron (<div>)
popover (<Popover>)
content <div>)
list (<List>)
children (Snippet)