ZeroGravity UI

Interfacestable

Detent

Segmented control

A segmented control built on native radios, with a thumb that slides to the selection.

Customize

Layoutequal segments, native radios
variant
fullWidth
disabled

Usage

TSX
import { Detent } from "zerogravity/detent"

<Detent
    label="View"
    options={[
        { value: "grid", label: "Grid" },
        { value: "list", label: "List" },
        { value: "board", label: "Board" },
    ]}
/>

Generated from the controls above. Only props that differ from their defaults are shown.

Props

9 documented props on Detent
PropertyTypeDefaultDescription
variant"pixel" | "classic" | "minimal" | "glass""pixel"Style.
fullWidthbooleanfalseFull width.
disabledbooleanfalseDisabled.
options{ value: string | number; label: ReactNode; disabled?: boolean }[]—The segments, in order.
labelstring—Accessible name of the group.
valuestring | number—Controlled selection.
defaultValuestring | numberfirst enabled optionUncontrolled starting selection.
onChange(value) => void—Receives the selected option's own value.
namestringgeneratedForm field name.

Dependencies

0 external runtime dependencies

Ships with nothing but React.