Select
vig-select ng-template[vigSelectOption]
import { Select, SelectOptionTemplate } from '@vigdx/ui/select';Basic
options as SelectOption objects ( value , label , optional icon and disabled ) and bind [(value)] . Values can be strings, numbers or any other primitive and are compared with === ; the value is null while nothing is selected.
Country: none · Page size: 25
Icons and disabled options
icon names a registered icon shown before the label, in the list and in the field. An option with disabled: true stays visible but cannot be chosen and is skipped by the arrow keys.
Filter and clear
filter adds a search box at the top of the list; clearable adds a button that sets the value back to null . filterPlaceholder , filterAriaLabel , emptyMessage and clearAriaLabel translate the texts per instance.
Custom option template
<ng-template vigSelectOption let-option> inside the select renders each option and the selected value in the field. option is the whole SelectOption ; bind the same list to [vigSelectOptionOf] (like ngForOf ) so its value is typed. Use the template for icon fonts, avatars or colour dots.
Label on top and hidden label
labelPosition="top" puts the label above the field. In dense toolbars such as table filters, hideLabel drops the visible label but keeps it as the accessible name; pair it with a placeholder .
Hint, error, states and sizes
hint adds help text; errors show once the field is touched and invalid . disabled blocks the field, readonly keeps it focusable but does not open the list. size is sm , md (default) or lg .
Used for billing and tax.
Reactive Forms
VigValueAccessor next to the component to use formControlName , [formControl] or ngModel . Type the control with the option value type plus null .
Signal Forms
vig-select implements FormValueControl<T | null> . Clearing writes null , so type model fields of clearable selects as nullable.
{
"country": null,
"status": "active"
}Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="select"][data-part="field"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="select"]
| Part | Element | data-state |
|---|---|---|
field | — | |
label | — | |
trigger | role="combobox" button. | open, closed |
value | — | |
placeholder | — | |
indicator | — | |
clear | clearable ). | — |
panel | — | |
listbox | role="listbox" list inside the panel. | — |
option | aria-selected , aria-disabled ). | — |
empty | — | |
filter | filter ). | — |
check | — | |
hint | vig-hint (a display: contents host; style its text part). | — |
disabled-reason | vig-hint with the disabled reason ( display: contents ). | — |
error | vig-field-error (a display: contents host; style its message part). | — |
Accessibility
- Follows the APG select-only combobox pattern: the field is a
role="combobox"witharia-expandedandaria-controls, the list arole="listbox"ofrole="option"items witharia-selected. - Focus stays on the field; the highlighted option is exposed through
aria-activedescendantand drawn with an outline that forced-colors mode keeps. Withfilter, the trigger opens a labelledrole="dialog"(aria-haspopup="dialog") holding the filter box, itself a combobox (aria-autocomplete="list") driving the list. ArrowDown, ArrowUp, Enter and Space open the list; the arrows, Home and End move, Enter or Space select, Escape closes and typing jumps to the first matching label. - The field is named by its
label(also withhideLabel);ariaLabeloverrides the name. The clear button and filter box have their own translatable labels. required,readonlyand an invalid state setaria-required,aria-readonlyandaria-invalid; hint and error are linked througharia-describedby.- Icons and custom template content should be decorative; the option
labelis what screen readers announce.
API
Select
vig-select| Name | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | undefined | undefined | — |
clearable | boolean | false | — |
clearAriaLabel | string | undefined | undefined | — |
dirty | boolean | false | — |
disabled | boolean | false | — |
disabledReasons | readonly WithOptionalFieldTree<DisabledReason>[] | [] | — |
emptyMessage | string | undefined | undefined | — |
errorMessages | Record<string, string> | — | — |
errors | readonly ValidationError.WithOptionalFieldTree[] | [] | — |
filter | boolean | false | — |
filterAriaLabel | string | undefined | undefined | — |
filterPlaceholder | string | undefined | undefined | — |
hidden | boolean | false | — |
hideLabel | boolean | false | Visually hides the label — it still names the control for assistive tech — and drops the row reserved for it, giving a shorter control for dense toolbars such as table filters. Pair it with a placeholder. |
hint | string | undefined | undefined | — |
invalid | boolean | false | — |
label | string | — | — |
labelPosition | LabelPosition | 'float' |
|
name | string | '' | — |
options | readonly SelectOption<T>[] | [] | — |
pending | boolean | false | — |
placeholder | string | undefined | undefined | — |
readonly | boolean | false | — |
required | boolean | false | — |
size | FieldSize | 'md' | — |
touched | boolean | false | — |
value | T | null | null | — |
| Name | Payload | Description |
|---|---|---|
touch | void | — |
valueChange | T | null | — |
| Signature | Description |
|---|---|
focus(options?: FocusOptions): void | Moves focus to the control's interactive element (the input, or the
trigger of a popup control). Signal Forms calls it through
|
reset(): void | Closes the panel without moving focus or marking the field touched; see |
SelectOptionTemplate
ng-template[vigSelectOption]Custom rendering for options of vig-select, vig-multi-select,
vig-listbox and vig-select-button, replacing the default icon + label. vig-select also
uses it for the selected value shown in the trigger.
Bind the same options to vigSelectOptionOf (like ngForOf) to type
let-option in the template; without it the option value is unknown.
<vig-select label="Status" [options]="statuses">
<ng-template vigSelectOption [vigSelectOptionOf]="statuses" let-option>
<i [class]="option.value" aria-hidden="true"></i> {{ option.label }}
</ng-template>
</vig-select>| Name | Type | Default | Description |
|---|---|---|---|
vigSelectOptionOf | readonly SelectOption<T>[] | null | undefined | undefined | Type-only: the options the template renders, so the template type checker infers the option value type. Not read at runtime. |
VigValueAccessor
Bridges the vigdx form fields to Reactive Forms (formControl,
formControlName) and template-driven forms (ngModel). Import it next to
the component; Signal Forms ([formField]) need no accessor.
| Signature | Description |
|---|---|
registerOnChange(fn: (value: unknown) => void): void | — |
registerOnTouched(fn: () => void): void | — |
setDisabledState(disabled: boolean): void | — |
writeValue(value: unknown): void | — |