Forms

Select

Choose one option from a keyboard-accessible popover.

Open ↗
Select interaction recorded with the Blinc headless renderer
Hybrid · dark · native recording · 2×

Usage and properties

The value Signal owns the selection. Popover content lives in the overlay root, outside .catalog-demo; target .cn-select-content and .cn-select-item directly when restyling.

Use the installation guide to add blinc_cn and its component stylesheet. Create the fixture bindings once, and return the demo from your UI builder. Values marked Bound accept Signal/Computed sources where the API supports them; structural options configure the component at construction.

PropertyTypeUpdate modelThis example
valueSignal<String>Read/write bindingrust
labelStringBoundLanguage
disabledboolBoundfalse
optionsSelectOptionStructuralRust, TypeScript, Python
on_changeFn(&str)CallbackOptional user selection feedback

Keyboard and interaction

[data-state="open"], [data-placeholder], :hover, :disabled and :focus-visible. Enter/Space opens; arrows move; Enter selects; Escape dismisses.

Customizing it

Add application CSS after the default component layer. These selectors are the restyling surface for this component:

  • .cn-select-trigger
  • .cn-select-content
  • .cn-select-item
  • .cn-select-item--selected
  • .cn-chevron

Theme and component variables: --surface-elevated, --surface-overlay, --border, --primary, --focus-ring, --text-primary, --text-secondary.

Built-in themes

The Live theme control installs Blinc's own theme bundles, including their colours, focus rings, corner shapes and motion tokens.

pub fn theme_bundle_for(name: &str) -> blinc_theme::ThemeBundle {
    match name {
        "restrained" => blinc_theme::RestrainedTheme::bundle(),
        "expressive" => blinc_theme::ExpressiveTheme::bundle(),
        _ => blinc_theme::HybridTheme::bundle(),
    }
    .with_css(blinc_cn::cn_styles::CN_STYLES)
}

Download the default widget and component stylesheets. Sample assets and licenses are available in the asset guide.

Documentation

From the canonical component guide.

Dropdown selection, bound to a Signal<String> holding the selected value:

let fruit = ctx.use_signal(String::new());

cn::select(fruit)
    .label("Fruit")
    .option("apple", "Apple")
    .option("banana", "Banana")
    .option_disabled("durian", "Durian")
    .placeholder("Select a fruit...")
    .size(SelectSize::Medium)
    .w(240.0)
    .on_change(|value| println!("selected: {value}"))

.disabled(..) makes the whole select inert; it takes a bool, Signal or Computed.

The open list grows to 300px and then scrolls, and it opens with the chosen option in the middle. For a long list, .virtual_rows(row_height) builds only the rows in view, each row_height pixels tall, so hundreds of options open at once:

let year = ctx.use_signal("2026".to_string());

cn::select(year)
    .options((1900..=2100).map(|y| SelectOption::new(y.to_string(), y.to_string())))
    .virtual_rows(32.0)

Styling

The trigger is one element with the class cn-select-trigger. It has a disabled attribute while disabled, data-placeholder while nothing is chosen and data-state="open" while its list is showing, so its look is rules, eased by a transition: a faint tint on :hover, a stronger one on :active, a darker border while open, and the disabled palette. The shown text inherits the trigger's color, which the placeholder and disabled rules dim. Restyle it with rules of your own:

.cn-select-trigger[data-state="open"] { border-color: #16a34a; }

Platforms and version

The component API is available in Blinc 0.6.0. The Live example runs in a dedicated worker and requires a compatible GPU surface. Preview and Code remain available when Live cannot start. The canvas has a descriptive label; a full screen-reader DOM mirror is not provided. The gallery integration is based on revision e2e55c24e078.

Recordings and live demos use the default Hybrid theme with bundled Noto Sans. The recording uses a 560 × 320 logical viewport at twice that resolution. Live follows its container and actual display density. Source base revision · Exact build source · Artifact versions and checksums · Font license.