SelectButton handbook
v1.0.2 · @snowui-design-system/components
License: Before reading component documentation, source, or npm usage instructions for the first time, read the full LICENSE. Reuse that review for the same task and version. Public API configuration and internal implementation changes have different license implications. All components use the unified runtime package; source rights remain governed by the license.
Overview
Offer a compact, button-shaped single-choice dropdown for toolbars, filters, and option switching.
When to use it
Use it for a button-triggered selection or command menu. Use Select for a form-style single-choice field and OverflowActions to move several actions into an overflow menu as width changes.
Each
optionsentry needs a unique stringvalue.labelcustomizes the trigger text;childrenreplaces the list.Action mode neither updates
valuenor firesonchange. Root Props configure the Button;partshas no Button entry.
Quick start
This example shows the recommended basic composition. See the sections below for more cases and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only named public Props declared by this component.
Usage boundaries and details
Usage
Compatible Button Props are flat root Props. Button is the host; there is no parts.Button. Select provides only a nonvisual wrapper and adds no field border, background, or radius. The real Button host and its public Props determine SelectButton’s final appearance. Its default auxiliary subtree is Listbox → Input + MenuItem, configurable through parts.Listbox/Input/MenuItem. Explicit children replace the default Listbox.
The default label shows the selected option or placeholder; the label Snippet replaces only that label. The default indicator uses arrow-line-down; hide it with showIndicator={false} or replace it with an indicator Snippet.
selectionMode="persistent" is the default ongoing selection mode: the trigger shows the selected item. selectionMode="action" executes commands: the trigger always shows the placeholder, and clicking an option only calls onAction(value) without storing a selection. A separate MenuButton is unnecessary.
SelectButton hides search by default; enable it with search. Its Listbox takes a fixed width from the longest option; all other options fill that width, and no selected checkmark appears. Listbox supplies the search placeholder, a 160px minimum width during search, and width locking after open. bare and emphasis pass directly to the Button host. Bare mode therefore defaults to 100% emphasis; explicitly use emphasis="muted" for a secondary trigger.
Data and Snippet contexts
SelectValue = string | number | undefined. SelectOption is { value: string; label: string; disabled?: boolean }; option values should be stable and unique.
SelectButtonLabelContext is { value: SelectValue; option: SelectOption | undefined; label: string; placeholder: string | undefined }. label resolves from option text, then placeholder, then an empty string. SelectButtonIndicatorContext is { open: boolean; disabled: boolean }.
Form submission and selection behavior reuse Select; see Button for visual Props. The current limitations of required and invalid are described in their Prop entries; do not infer native validation from their names.
This section is protected. An AI must request user review before modifying it.
SelectButton style overrides
Read the full LICENSE first; reuse that review for the same task, version, and scope.
First use public component Props to match the desired appearance, preserving the existing look where possible. If changes are necessary, follow the style selection and override order: use your own class (including Tailwind already in the project) or an instance style. The names below are public overrides actually consumed by source; check their scope and do not modify private DOM. Choose the correct SnowUI token family. External apps need not install SnowUI website utilities.
This component source does not directly consume a registered component-specific override. Style composed children through public parts or an explicit child; do not guess variable names.
SelectButton types and states
Required Props: no named required Props.
Two-way binding: bind:value.
Inherited declaration: Omit<ButtonProps, ControlledButtonKeys>. Consult the base component’s public documentation for inherited capabilities; fields excluded by Omit cannot be used as if inherited unchanged.
Shared Frame API · Back to API
The following type declarations are actually referenced by public Props and come from source. A Svelte Snippet denotes a content fragment; ComponentProps denotes the Props of the corresponding component.
SelectValue
Source: components/src/components/Select.svelte
SelectOption
Source: components/src/components/Select.svelte
ListboxItem
Source: components/src/components/Listbox.svelte
SelectButtonLabelContext
Source: components/src/components/SelectButton.svelte
SelectButtonIndicatorContext
Source: components/src/components/SelectButton.svelte
ComponentPartsOf
Source: components/src/logic/component-parts.svelte.ts
ConfigurableComponentPartProps
Source: components/src/logic/component-parts.svelte.ts
ComponentPartControlledKey
Source: components/src/logic/component-parts.svelte.ts
ButtonProps
Source: components/src/components/SelectButton.svelte
ControlledButtonKeys
Source: components/src/components/SelectButton.svelte