Skip to content
Okaapiأوكابي
Framework for the code
Theme
Okaapi on GitHub

Chapter 05 Choices

Segmented control

One choice from two to five short options, side by side: a view, a period, a size. Radio buttons underneath, so Tab reaches the group and the arrow keys move the choice. The chosen one is lifted onto a tile with an edge, not just coloured.

Use it in Angular
import { SegmentedControlComponent } from '@okaapi-ui/angular';
// Works with formControlName, [formControl] and ngModel.

A period

Angular
<ui-segmented-control label="Period" [options]="periods" formControlName="period" />

periods = [
  { value: 'day', label: 'Day' },
  { value: 'week', label: 'Week' },
  { value: 'month', label: 'Month' },
];

Icons only

The words stay for screen readers. Keep icons that everyone reads the same way.

Angular
<ui-segmented-control label="View" iconOnly [options]="views" formControlName="view" />

views = [
  { value: 'list', label: 'List', icon: 'list' },
  { value: 'grid', label: 'Grid', icon: 'layout-grid' },
];

Full width

block shares the width equally, as in a narrow panel or on a phone.

Angular
<ui-segmented-control label="Delivery" block [options]="delivery" formControlName="speed" />

In Arabic

Angular
<ui-segmented-control label="الفترة" [options]="periods" formControlName="period" />

When to use something else

If you needUse
Show different panels of contentTabs
A choice sent with a formRadio group
One option that is on or offToggle

Inputs

NameTypeDefaultWhat it does
labelstring — Names the group for screen readers.
options{ value, label, icon?, disabled? }[] — Two to five short options.
iconOnlybooleanfalseShows only the icons; the words are still read.
blockbooleanfalseFills the width, segments sharing it.

Keyboard and screen readers

KeysWhat they do
Tab Reach the group, on the chosen option.
Arrow keys Move the choice to the next or previous option.
  • Radio buttons underneath; the chosen option is lifted onto a tile with an edge, not only coloured.