docs/components/input/SegmentedControl

SegmentedControl

Segmented option control.

import { SegmentedControl } from '@ybouhjira/hyperkit';

#Playground

Edit the code — the preview recompiles and re-renders as you type.

Live playground
Loading preview…

#More Examples

Many Options

<SegmentedControl
  options={[
      { label: '1H', value: '1h' },
      { label: '4H', value: '4h' },
      { label: '1D', value: '1d' },
      { label: '1W', value: '1w' },
      { label: '1M', value: '1m' },
      { label: '1Y', value: '1y' }
    ]}
  defaultValue="1d"
  size="sm"
/>

Full Width

<SegmentedControl
  options={[
      { label: 'List', value: 'list' },
      { label: 'Grid', value: 'grid' },
      { label: 'Kanban', value: 'kanban' }
    ]}
  defaultValue="list"
  fullWidth
/>

#Props

PropTypeDefaultDescription
options *SegmentedControlOption[]Options to display in the control.
valuestringControlled selected value.
defaultValuestringInitial selected value for uncontrolled mode.
onChange(value: string) => voidCalled when the selected option changes.
size'sm' | 'md' | 'lg''md'Size variant.
fullWidthbooleanfalseStretch to fill the full width of the container.
disabledbooleanfalseDisable all options.
classstringAdditional CSS classes.
styleJSX.CSSPropertiesInline styles.
unstyledbooleanfalseStrip default styling classes.
'aria-label'stringAccessible label for the radiogroup.

* required prop.

#Design Tokens

This component reads the following CSS custom properties. Override them globally or per-instance to restyle it — see the CSS Variables guide.

  • --sk-accent
  • --sk-bg-secondary
  • --sk-bg-tertiary
  • --sk-border
  • --sk-duration-fast
  • --sk-ease-default
  • --sk-font-size-base
  • --sk-font-size-lg
  • --sk-font-size-sm
  • --sk-height-lg
  • --sk-height-md
  • --sk-height-sm
  • --sk-segmented-control-bg
  • --sk-segmented-control-border
  • --sk-segmented-control-indicator-bg
  • --sk-segmented-control-option-color
  • --sk-segmented-control-option-hover-bg
  • --sk-segmented-control-option-selected-color
  • --sk-space-2xs
  • --sk-space-lg
  • --sk-space-md
  • --sk-space-sm
  • --sk-text-on-accent
  • --sk-text-primary
  • --sk-text-secondary