Skip to content
Kimenpre-v1documentation home
Color scheme

ki-segment

Use ki-segment inside ki-segmented-control. Each option needs a distinct value. Use disabled to make an option unavailable.

Theme for this example
Color scheme for this example
List
<ki-segmented-control label="View">
<ki-segment value="list">List</ki-segment>
<ki-segment value="board" aria-label="Board">
<svg slot="start" viewBox="0 0 16 16" aria-hidden="true">
<path d="M2 2h4v12H2zm6 0h6v7H8z" fill="currentColor"></path>
</svg>
</ki-segment>
</ki-segmented-control>

Use the default slot for text and start for leading artwork. An icon-only choice needs aria-label. The same label appears in its tooltip on focus or hover.

The all-elements loader registers ki-tooltip. When using direct imports or framework wrappers, register it separately for icon-only options.

API reference

When to use: offer one mutually exclusive choice with text or a named icon.

When not to use: standalone, for navigation, or for form submission.

Properties & attributes

AttributePropertyTypeDefaultDescription
aria-labelaccessibleLabelstring | undefined–Accessible name of an icon-only option. An enabled icon-only option also shows this name on focus and hover when ki-tooltip is registered. The all-elements loader includes it. For a text option, use the visible label.
disableddisabledbooleanfalseExcludes the option from selection and keyboard navigation.
valuevaluestring–Required nonempty option identifier. Each value must be unique in its group.

Slots

SlotDescription
(default)Noninteractive visible option label.
startDecorative leading icon. Supply aria-label for an icon-only option.

CSS parts

PartDescription
buttonThe native option surface with radio semantics.

CSS custom properties

The public styling contract of ki-segment: reassign these tokens at :root or on a subtree — never override internals.

TokenDescription
--ki-density-control-offsetAdded to the block size of every scaled control and row (button, icon button, field, select, textarea, option, list item, tab). Components floor the result at ki.size.target-min.
--ki-density-target-minThe smallest pointer target any density may produce: 24 x 24 CSS px by default and in compact (WCAG 2.5.8 AA), 44 x 44 in touch (WCAG 2.5.5). It floors a shrinking control but never lifts what a control paints: a control painted smaller extends its target to it, invisibly; rows and tabs grow to it (spec 045 A1).
--ki-focus-ring-colorColour of the keyboard focus ring every focusable component draws: 3:1 or more against the page in every theme and scheme.
--ki-focus-ring-widthThickness of the keyboard focus ring every focusable component draws (its outline). One token instead of one per component, so a mode or a theme changes every ring at once.
--ki-segment-font-sizeText size of medium and small segments.
--ki-segment-font-weightFont weight of segment labels.
--ki-segment-gapGap between the leading icon and label.
--ki-segment-icon-sizeSize of leading artwork.
--ki-segment-line-heightLine height of medium and small segments.
--ki-segment-padding-inlineInline padding of a medium or small segment.
--ki-segmented-control-track-size-mdMedium track height before density adjustment.
--ki-segmented-item-backdrop-filterComplete CSS backdrop filter behind an unselected segment.
--ki-segmented-item-bgResting surface of an unselected segment, matching the track by default.
--ki-segmented-item-bg-imageOptional image layered over an unselected segment surface.
--ki-segmented-item-disabled-fgInk of an unavailable segment.
--ki-segmented-item-fgResting ink of an unselected segment, strengthened in contrast-more.
--ki-segmented-item-radiusCorner radius of each segment.
--ki-segmented-selected-backdrop-filterComplete CSS backdrop filter behind the selected segment.
--ki-segmented-selected-bgRaised selected surface, lighter than the track in both schemes.
--ki-segmented-selected-bg-imageOptional image layered over the selected segment.
--ki-segmented-selected-border-colorHigh-contrast selection boundary when elevation or surface differences are subtle.
--ki-segmented-selected-border-widthWidth of the selection boundary.
--ki-segmented-selected-fgInk of the selected segment.
--ki-segmented-selected-shadowElevation of the selected segment.
--ki-segmented-track-paddingInset between the track and its segments.
--ki-typography-family-bodysemantic font family for typography family body.

Open ki-segment in Storybook