ki-segment
@kimen/elements/ki-segment- Source
- Agent reference
Use ki-segment inside ki-segmented-control.
Each option needs a distinct value. Use disabled to make an option unavailable.
<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
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
aria-label | accessibleLabel | string | 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. |
disabled | disabled | boolean | false | Excludes the option from selection and keyboard navigation. |
value | value | string | – | Required nonempty option identifier. Each value must be unique in its group. |
Slots
| Slot | Description |
|---|---|
| (default) | Noninteractive visible option label. |
start | Decorative leading icon. Supply aria-label for an icon-only option. |
CSS parts
| Part | Description |
|---|---|
button | The 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.
| Token | Description |
|---|---|
--ki-density-control-offset | Added 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-min | The 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-color | Colour of the keyboard focus ring every focusable component draws: 3:1 or more against the page in every theme and scheme. |
--ki-focus-ring-width | Thickness 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-size | Text size of medium and small segments. |
--ki-segment-font-weight | Font weight of segment labels. |
--ki-segment-gap | Gap between the leading icon and label. |
--ki-segment-icon-size | Size of leading artwork. |
--ki-segment-line-height | Line height of medium and small segments. |
--ki-segment-padding-inline | Inline padding of a medium or small segment. |
--ki-segmented-control-track-size-md | Medium track height before density adjustment. |
--ki-segmented-item-backdrop-filter | Complete CSS backdrop filter behind an unselected segment. |
--ki-segmented-item-bg | Resting surface of an unselected segment, matching the track by default. |
--ki-segmented-item-bg-image | Optional image layered over an unselected segment surface. |
--ki-segmented-item-disabled-fg | Ink of an unavailable segment. |
--ki-segmented-item-fg | Resting ink of an unselected segment, strengthened in contrast-more. |
--ki-segmented-item-radius | Corner radius of each segment. |
--ki-segmented-selected-backdrop-filter | Complete CSS backdrop filter behind the selected segment. |
--ki-segmented-selected-bg | Raised selected surface, lighter than the track in both schemes. |
--ki-segmented-selected-bg-image | Optional image layered over the selected segment. |
--ki-segmented-selected-border-color | High-contrast selection boundary when elevation or surface differences are subtle. |
--ki-segmented-selected-border-width | Width of the selection boundary. |
--ki-segmented-selected-fg | Ink of the selected segment. |
--ki-segmented-selected-shadow | Elevation of the selected segment. |
--ki-segmented-track-padding | Inset between the track and its segments. |
--ki-typography-family-body | semantic font family for typography family body. |