Segmented
Compact single-choice control for switching related views or modes.
Segmented composes a container component with projected native buttons marked by kuiSegment.
import { KuiSegmentDirective, KuiSegmentedComponent } from '@kikita-labs/ui';Bind the selected segment with a signal and keep each projected button native.
Selected view: list
<div class="basic-segmented-example">
<kui-segmented [(value)]="view" aria-label="Project view">
<button kuiSegment value="list">List</button>
<button kuiSegment value="board">Board</button>
<button kuiSegment value="timeline">Timeline</button>
</kui-segmented>
<p>Selected view: {{ view() }}</p>
</div>Inputs verified against @kikita-labs/ui v1.6.1 public typings.
| Name | Type | Default | Description |
|---|---|---|---|
| [(value)] | string | '' | Selected segment value. Implements FormValueControl for [formField] integration, or bind directly for standalone use. |
| [(selected)] | string | '' | Deprecated alias for value, kept in sync with it. Use value instead; planned for removal in the next major version. |
| size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Control height and spacing for the whole segmented group. |
| disabled | boolean | false | Disables every segment. Set by [formField] or directly. |
| invalid | boolean | false | Marks the control as having validation errors. Set by [formField]. |
| errors | readonly WithOptionalFieldTree<ValidationError>[] | [] | Current validation errors. Set by [formField]. |
| touched | boolean | false | Whether the control has been touched. Set by [formField]. |
| (touch) | void | - | Emitted when a segment is selected; marks the control as touched in the form system. |
| button[kuiSegment].value | string | '' | Value emitted when the segment is selected. |
| button[kuiSegment].disabled | boolean | false | Disables one segment and removes it from keyboard selection. |
Changes introduced in @kikita-labs/ui v1.5.0 that affect existing markup.
- Segmented now implements
FormValueControl<string>and accepts[formField]directly onkui-segmentedfor Signal Forms integration. - The
selected/selectedChangemodel is deprecated in favor ofvalue/valueChange. Existing[(selected)]bindings keep working and stay in sync withvalue, but are planned for removal in the next major version. New markup should use[(value)].
Segmented uses radiogroup semantics while preserving native button focus.
- The container renders
role="radiogroup". - Each segment button renders
role="radio"and selection state. - Disabled segments cannot be selected.
- Use an accessible label on the segmented group when nearby text is not enough.