Select button
vig-select-button ng-template[vigSelectOption]
import { SelectButton } from '@vigdx/ui/select-button';
import { SelectOptionTemplate } from '@vigdx/ui/select';Basic
options as SelectOption objects and bind [(value)] . Clicking a segment selects it; as the segments are native radios, the arrow keys move and select in one step, following the visual order in right-to-left layouts.
Showing totals per week.
Icons and custom content
icon names a registered icon shown before the label. For other content, an <ng-template vigSelectOption let-option> replaces the icon and label of each segment.
Allow empty
allowEmpty , clicking the selected segment again clears the value to null . Useful for optional filters.
Click the selected priority again to clear the filter.
Filter: high
Without a visible label
label and set ariaLabel , which names the group for screen readers.
Orders
Disabled, read-only and error
disabled: true is skipped by the arrow keys. disabled disables every segment, readonly keeps them focusable but ignores selection, and errors show once the field is touched and invalid .
Reactive Forms
VigValueAccessor next to the component to use formControlName , [formControl] or ngModel . The field counts as touched once focus leaves the whole group.
Signal Forms
vig-select-button implements FormValueControl<T | null> , so [formField] binds value and validation.
Theme: system
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-button"][data-part="label"] { … }: 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-button"]
| Part | Element | data-state |
|---|---|---|
label | — | |
group | role="radiogroup" segment bar. | — |
option | <label> . | checked, unchecked |
input | — | |
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
- Each segment is a
<label>around a visually hidden native<input type="radio">in arole="radiogroup", likevig-radio-group: the single tab stop, the arrow keys (which move and select) and right-to-left order come from the browser. - The selected segment has a primary border besides its raised background, and switches to the system Highlight colors in forced-colors mode; the focus ring is drawn on the segment.
- Give the group a name: a visible
label, orariaLabelwhen there is none. required,readonlyand an invalid state setaria-required,aria-readonlyandaria-invalidon the group; hint and error are linked througharia-describedby.- Segment labels are the accessible names, so keep them short but self-explanatory; icons are decorative.
API
SelectButton
vig-select-buttonSegmented control for a small exclusive choice (PrimeNG p-selectbutton
territory). Each segment is a <label> around a visually hidden native
<input type="radio"> sharing one name, so the single tab stop, arrow
keys (which move and select) and form semantics come from the browser —
like vig-radio-group, with a segmented look. Deliberately single-select;
multi-pick lists belong to vig-multi-select.
| Name | Type | Default | Description |
|---|---|---|---|
allowEmpty | boolean | false | Clicking the selected segment deselects it (value becomes null). |
ariaLabel | string | undefined | undefined | — |
dirty | boolean | false | — |
disabled | boolean | false | — |
disabledReasons | readonly WithOptionalFieldTree<DisabledReason>[] | [] | — |
errorMessages | Record<string, string> | — | — |
errors | readonly ValidationError.WithOptionalFieldTree[] | [] | — |
hidden | boolean | false | — |
hint | string | undefined | undefined | — |
invalid | boolean | false | — |
label | string | '' | Visible group label; omit for toolbar use and pass |
name | string | '' | — |
options | readonly SelectOption<T>[] | [] | — |
pending | boolean | false | — |
readonly | boolean | false | — |
required | boolean | false | — |
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 | Returns the control to its pristine look: drops in-progress text, closes
an open popup, clears errors the component raised itself and the
submitted state of |
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 | — |