SpecOS SpecOS icon Styleguide

Select

A select component that allows users to choose a single option from a dropdown list. Features smooth transitions, customizable styles, optional icons, and keyboard navigation support.

Import

import Select from "$lib/components/Select.svelte";

Usage

Examples showing different select configurations.

With Icon and Label
Selected:
Without Icon
Selected:
<script lang="ts"> let value = ""; const options = [ { value: "light-monochrome", label: "Light Monochrome" }, { value: "dark-green", label: "Dark Green" }, { value: "svelte-orange", label: "Svelte Orange" }, { value: "punk-pink", label: "Punk Pink" } ]; </script> <Select bind:value {options} name="theme" id="theme" label="Select Theme" icon="Palette" placeholder="Select a theme" />

Properties

value
Type
string
Default: ""
The selected value of the select
name
Type
string
Default: -
The name attribute for the hidden input
id
Type
string
Default: -
The id attribute for the select trigger
label
Type
string
Default: -
The label text for the select
icon
Type
string | null
Default: null
Optional icon to display in the trigger
options
Type
{ value: string; label: string }[]
Default: []
Array of options to display in the select
placeholder
Type
string
Default: "Select an option"
Placeholder text when no option is selected
rootClass
Type
string
Default: ""
Additional classes for the root element