Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
FormsGlass surface

Select

Provides an enhanced single-choice list when text search is not needed.

FrameworksAstro · React · Elements

Registry commandlumen add Select

InteractionEnhanced runtime

01

See it and copy it

Framework example

Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroSame visual contract, native framework API

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { Select } from '@santi020k/lumen-astro'
---

<div style="display: grid; gap: 0.75rem; max-width: 20rem;">
  <label for="ex-select-framework">Framework</label>
  <Select id="ex-select-framework" name="framework" placeholder="Pick a framework">
    <option value="astro">Astro</option>
    <option value="react">React</option>
    <option value="elements">Web Components</option>
  </Select>
  <label for="ex-select-region">Region</label>
  <Select
    id="ex-select-region"
    name="region"
    options={[
      { label: 'US East', value: 'us-east' },
      { label: 'EU West', value: 'eu-west' },
      { disabled: true, label: 'APAC (soon)', value: 'apac' }
    ]}
    placeholder="Options via prop"
    size="sm"
  />
  <label for="ex-select-density">Density</label>
  <Select id="ex-select-density" name="density" placeholder="Large select" size="lg">
    <option value="compact">Compact</option>
    <option value="comfortable">Comfortable</option>
  </Select>
  <label for="ex-select-surface">Surface</label>
  <Select
    glass="subtle"
    id="ex-select-surface"
    name="surface"
    options={['Canvas', 'Surface', 'Glass']}
    placeholder="Glass enhanced select"
  />
</div>
Edit Select in browser
02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add Select
lumen add Select

Glass

Add the glass prop to apply the shared blur, saturation, border, and highlight tokens. Glass reads best over vivid content, so place the surface above imagery or color.

AstroSame visual contract, native framework API

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { Field, Label, Select } from '@santi020k/lumen-astro'
---

<div class="docs-glass-demo" style="justify-items: center;">
  <Field style="min-width: min(100%, 22rem);">
    <Label for="glass-framework">Framework</Label>
    <Select
      id="glass-framework"
      glass="strong"
      options={['Astro', 'React', 'Web Components']}
      placeholder="Choose a framework"
    />
  </Field>
</div>
Edit Select in browser

API reference

Lumen-specific props and runtime attributes for the Astro primitive. React props follow the same names; Elements use equivalent kebab-case attributes where custom elements expose them.

AttributeValuesDefaultDescription
glassboolean | "subtle" | "strong"falseApplies the tokenized liquid-glass surface treatment with backdrop-filter fallbacks; "subtle" and "strong" adjust the fill intensity.
optionsArray<string | { label, value, disabled? }>[]Creates native option elements.
placeholderstring-Adds a disabled placeholder option and trigger placeholder text.
size"default" | "sm" | "md" | "lg""default"Controls select height and font size. The md value maps to the default size.
disabledbooleanfalseDisables the native select and enhanced trigger.
requiredbooleanfalseForwards required validation to the native select.
valuestring | number-Selects the matching option value.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Keyboard interactions

Keyboard behavior provided by the Astro UIPrimitives runtime for this component.

KeyAction
Printable key on trigger or optionOpen the listbox and focus the next enabled option whose text starts with the typed buffer.
Escape on trigger or optionClose the listbox. Escape on an option also returns focus to the trigger.
ArrowDown, ArrowUp on triggerOpen the listbox and focus the next or previous enabled option.
Home, End on triggerOpen the listbox and focus the first or last enabled option.
Enter, Space on triggerOpen the listbox and focus the selected option, or the first enabled option.
Enter, Space on an optionSelect the focused option, sync the native select, and dispatch native input and change events from the select.
ArrowDown, ArrowUp on an optionMove focus through enabled options, wrapping at the ends.
Home, End on an optionMove focus to the first or last enabled option.

Web docsFull catalog