Forms

Segmented control

@xui/segmented-control

A single-choice control as a row of segments — a compact toggle between a few mutually exclusive options. role="radiogroup" with one tab stop; arrow keys move between segments. Full ControlValueAccessor.

Install

pnpm add @xui/segmented-control

Add the barrel to a standalone component's imports:

import { XuiSegmentedControlImports } from '@xui/segmented-control';

@Component({
  imports: [XuiSegmentedControlImports],
  // …
})

Examples

Default

Loading preview…

Small

Loading preview…

Fill

Loading preview…

API

XuiSegmentedControl

componentxui-segmented-control

A single-choice control laid out as a row of segments — a compact toggle between a few mutually exclusive options.

Variants

AxisOptionsDefaultsizemdsmmdfilltruefalsefalse

Inputs

NameTypeDefaultclassClassValueThe user-defined classes. Merged last so they win over the variant classes.''sizeXuiSegmentedControlVariants['size']Control height, from the shared control scale.this.config.sizefillbooleanStretch the segments to share the control's full width equally.this.config.filloptionsreadonly XuiSegmentedOption<T>[]The segments, in order. Each carries the value it selects, its label, and whether it is disabled.[]ariaLabelstring | nullAccessible name for the control — what is being switched between.nullvaluetwo-wayT | nullThe chosen value. Two-way, and via ngModel/formControl.nulldisabledbooleanDisable every segment at once.false

Source

libs/ui/segmented-control/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.