list Basic
Selected:
nonesearch Searchable
Selected:
noneview_agenda Header & Footer slots
Selected:
noneverified Validation states
States
Select states
Normal
Hint
Error
Success
Disabled
Searchable
Svelte
<script lang="ts">
let country: string | undefined = $state(undefined);
const countries = [
{ value: "fr", label: "France" },
{ value: "de", label: "Germany" },
{ value: "es", label: "Spain" },
];
</script>
<Select
bind:value={country}
options={countries}
label="Country"
placeholder="Choose a country"
hint="Select your country of residence"
/> API
package_2
import type { PopoverPalette, PopoverElevation, PopoverDirection, PopoverAlign } from '@abhc/spektral-ui';| Prop | Type | Default |
|---|---|---|
| value | T | β |
| options | readonly (T | OptionEntry)[] | β |
| placeholder | string | "Select an option" |
| label | string | β |
| hint | string | β |
| error | string | β |
| success | string | β |
| size | "sm" | "md" | "lg" | "md" |
| disabled | boolean | false |
| required | boolean | false |
| searchable | boolean | false |
| searchPlaceholder | string | "Search..." |
| name | string | β |
| id | string | β |
| onchange | (value: T) => void | β |
| leading | Snippet | β |
| trailing | Snippet | β |
| palette | "tone" | "accent" | "accentbg" | "tone" |
| rounded | boolean | false |
| elevation | "none" | "subtle" | "hard" | "none" |
| direction | "bottom" | "top" | "left" | "right" | "bottom" |
Prop value
Type
TDefault
βProp options
Type
readonly (T | OptionEntry)[]Default
βProp placeholder
Type
stringDefault
"Select an option"Prop label
Type
stringDefault
βProp hint
Type
stringDefault
βProp error
Type
stringDefault
βProp success
Type
stringDefault
βProp size
Type
"sm" | "md" | "lg"Default
"md"Prop disabled
Type
booleanDefault
falseProp required
Type
booleanDefault
falseProp searchable
Type
booleanDefault
falseProp searchPlaceholder
Type
stringDefault
"Search..."Prop name
Type
stringDefault
βProp id
Type
stringDefault
βProp onchange
Type
(value: T) => voidDefault
βProp leading
Type
SnippetDefault
βProp trailing
Type
SnippetDefault
βProp palette
Type
"tone" | "accent" | "accentbg"Default
"tone"Prop rounded
Type
booleanDefault
falseProp elevation
Type
"none" | "subtle" | "hard"Default
"none"Prop direction
Type
"bottom" | "top" | "left" | "right"Default
"bottom"