ArtificialSenseDocs

Docs / Components

SenseSelectComponent

Combobox-style select from @artificialsenselabs/ui — composes sense-icon, sense-icon-button, and sense-spinner.

Live demo: run nx serve showcase and open /components/select (port 4202).

Overview

Category: Form / inputs. Selector: sense-select. Import: import { SenseSelectComponent } from '@artificialsenselabs/ui';

<sense-select
  label="Country"
  [options]="countries"
  [searchable]="true"
  [(ngModel)]="country"
/>

Groups, filtering and checkboxes

options takes plain options and { label, items } groups, mixed freely (SenseSelectOptionGroup). A group label is a non-selectable heading; groups with no matching option are hidden while filtering.

searchable filters by label, ignoring case and diacritics (sao finds São Paulo). Pass filterMatch to match on something else. showCheckboxes draws a checkbox on each row in multiple mode; clearable (default true until 1.0, then false) controls the clear button and cleared reports its use; it replaces the deprecated showClear.

<sense-select
  label="Sites"
  [options]="[
    { label: 'Remote', value: 'remote' },
    { label: 'Europe', items: [{ label: 'Zürich', value: 'zrh' }] },
  ]"
  [multiple]="true"
  [searchable]="true"
  [showCheckboxes]="true"
  [(ngModel)]="sites"
/>

API

Generated from libs/ui/src/lib/select/sense-select/sense-select.component.ts — run pnpm run docs:api to refresh.

Inputs
InputTypeDefaultDescription
optionsSenseSelectItem[][] Options rendered in the listbox. Entries may be plain options or `{ label, items }` groups, mixed freely; groups render as labelled, non-selectable headings.
sizeSenseSelectSize'md' Trigger control scale token.
variantSenseSurfaceVariant'outlined' Field chrome: `outlined` (default), `filled`, or `ghost`.
multiplebooleanfalse Allow multiple selections; the CVA value becomes an array.
searchablebooleanfalse Turns the control into a filter field; typing narrows the listbox. Matching is by label, case- and diacritic-insensitive, unless `filterMatch` replaces it.
filterMatchSenseSelectFilterFn | nullnull Replaces the default label match while `searchable`. `null` keeps the built-in matcher.
clearableboolean | undefinedundefined Shows the clear button while a value is selected. Left unset, it follows the deprecated `showClear` (default `true`); when both are set, `clearable` wins. The default becomes `false` at 1.0 (ADR-0056 D3a).
showCleardeprecatedbooleantrue Shows the clear button while a value is selected. Deprecated: Use `clearable` — removed in 1.0 (ADR-0056 D3).
showCheckboxesbooleanfalse In `multiple` mode, draws a checkbox in front of each option. Visual only — selection state is still carried by `aria-selected` on the option.
placeholderstring'' Placeholder shown on the trigger when nothing is selected.
disabledbooleanfalse Disables interaction and dims the control.
loadingbooleanfalse Shows a busy indicator and suppresses interaction while options load.
labelstring | nullnull Visible label text.
hintstring | nullnull Supporting hint rendered below the label and wired via `aria-describedby`.
errorstring | nullnull Validation error message; sets `aria-invalid` and a live alert region.
ariaLabelstring | nullnull Accessible name override when no visible `label` is provided.
ariaLabelledbystring | nullnull `id` of an external element labelling the control (`aria-labelledby`).
ariaLabelledBydeprecatedstring | nullnull Alias for . When both are set, `ariaLabelledby` wins. Deprecated: Use `ariaLabelledby` — removed in 1.0 (ADR-0056 D6).
invalidbooleanfalse Marks the control invalid for ARIA and error styling (use with or without `error`).
requiredbooleanfalse Marks the control required for validation and ARIA.
autofocusbooleanfalse Focuses the combobox element after the first render when true.
valueSenseSelectValue | SenseSelectValue[] | nullnull Selected value — an array when `multiple`, otherwise a single value or `null`. Two-way bindable via `[(value)]` or forms CVA. Its `valueChange` is the canonical change event (ADR-0056 D1/D2).
Outputs
OutputTypeDescription
selectionChangeSenseSelectChangeEventEmitted when the user changes the selection or clears the value.
clearedvoidEmitted when the user clears the value with the clear button (after `selectionChange`).
selectFocusFocusEventEmitted when the combobox element receives focus.
selectBlurFocusEventEmitted when the combobox element loses focus.

Accessibility

  • The combobox element inside the host (the filter input when searchable) carries aria-expanded, aria-controls and aria-activedescendant.
  • Groups render as role="group" named by their heading via aria-labelledby; arrow keys move between options and never land on a heading.
  • Row checkboxes are decoration (aria-hidden); aria-selected carries the state.
  • Visible labels use aria-labelledby; standalone controls use aria-label.
  • Searchable mode announces filtered result counts via a polite live region.
  • Keyboard: Arrow keys, Enter/Space, Home/End, Escape, and typeahead.