SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

segmentedItem

Draws one segment.

tsx
import { segmentedItem } from "@sdxc/ui/styles";

Usage

Draws one segment. A resting segment is muted ink on the track and takes a translucent wash on hover; the chosen one is a raised tile edged in the strong border role, which keeps at least 3:1 against the track in either scheme, with emphasis ink in semibold. The states compose into one rule, so the chosen state wins whatever order layers land in.

Signature

typescript
segmentedItem<Node extends Element = Element>(options?: SegmentedItemOptions): UtilityMixin<Node>

Returns a css() mixin ready for the segment's mix prop.

Parameters

ParameterTypeRequiredDescription
optionsSegmentedItemOptionsNoSelectors for the chosen and focused states.

Examples

tsx
<button aria-pressed={active ? "true" : "false"} mix={[segmentedItem()]}>{label}</button>;
tsx
<label mix={[segmentedItem({ selected: "&:has(input:checked)", focused: "&:has(input:focus-visible)" })]} />;

The events, constants and types its module publishes, each imported from @sdxc/ui/styles too.

Interface

SegmentedItemOptions

Options accepted by segmentedItem.

MemberTypeRequiredDescription
selectedstringNoSelector, relative to the segment, that matches while it is the chosen one.
focusedstringNoSelector, relative to the segment, that matches while keyboard focus is on it.
@sdxc/ui

Can’t find it? Contact us