Selector @astryx-svelte/core v0.3.0 · Selector

Usage

A dropdown selector for choosing a single value from a list of options. Supports labels, validation, descriptions, and required/optional states. Use it in forms and settings when presenting a moderate number of options.
ts
import { Selector } from '@astryx-svelte/core';

Best practices

GuidancePractices
DoProvide a visible label so users understand what they are selecting.
DoUse sections and dividers to organize options when the list exceeds ~8 items.
DoUse renderOption for custom option rows. Do not pass SelectorOption directly as JSX children.
DoSet a meaningful placeholder that hints at the expected selection (e.g. "Choose a country" not "Select...").
DoUse inside InputGroup only when the selector needs a short prefix or suffix addon as part of one decorated input surface.
DoUse variant="ghost" when a selector sits in a toolbar with ghost buttons. If validation status is needed there, prefer statusVariant="tooltip" so the toolbar height stays compact.
Don'tUse for action menus; use Dropdown Menu for triggering commands or navigation.
Don'tUse when there are only two options; use a SegmentedControl or radio buttons instead.
Don'tUse Selector for navigation; links should be links, not dropdown options.
Don'tUse for yes/no or on/off choices; use Switch or CheckboxInput instead.
Don'tPut more than ~20 options without sections; consider Typeahead for large lists.
Don'tWrap a disabled Selector in Tooltip to explain why it is disabled; disabled triggers swallow the hover events the wrapper needs. Use the disabledMessage prop instead.

Examples

Common configurations, variations, and states.
Selector — Clearable
Selector with a clear button to reset the selected value.
Selector — Ghost Toolbar
Borderless Selector variant composed with ghost buttons in a toolbar.
Selector — Grouped Sections
Selector with options grouped into labeled sections.
Selector — Validation States
Selector showing error, warning, and success validation states.