docs/components/input/SegmentedBar

SegmentedBar

Segmented control / pill selector.

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

#Playground

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

Live playground
Loading preview…

#More Examples

Tall

<SegmentedBar
  height={16}
  segments={[
      { value: 50, color: 'var(--sk-accent)', label: 'DNS' },
      { value: 30, color: 'var(--sk-success)', label: 'Connect' },
      { value: 20, color: 'var(--sk-warning)', label: 'TTFB' }
    ]}
/>

Animated

<SegmentedBar
  animated
  segments={[
      { value: 30, color: 'var(--sk-accent)', label: 'Scripting' },
      { value: 20, color: 'var(--sk-success)', label: 'Rendering' },
      { value: 10, color: 'var(--sk-warning)', label: 'Painting' },
      { value: 40, color: 'var(--sk-text-muted)', label: 'Idle' }
    ]}
/>

#Props

PropTypeDefaultDescription
segments *SegmentedBarSegment[]Array of segments to display.
heightnumber8Height of the bar in pixels.
borderRadiusstring'var(--sk-radius-sm)'Border radius CSS value applied to the outer container and first/last segments.
animatedbooleanfalseAnimate segment widths when data changes.
classstringAdditional CSS classes.
styleimport('solid-js').JSX.CSSPropertiesInline styles.

* 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-duration-normal