Knit UI
GitHub

Playground

Loading playground…

false
false
false
Playground
<Slider
  min={0}
  max={100}
  step={1}
  size="md"
  defaultValue={40}
  disabled={false}
  inverted={false}
  labelAlwaysOn={false}
/>

Examples

Sizes

The seven token sizes, from xxs to xxl, showing track and thumb scaling.

Loading example…

SizesSourceStorybook

Shadows

Elevation shadow ladder applied via the inherited shadow prop.

Loading example…

ShadowsSourceStorybook

Disabled

Disabled state — reduced opacity with pointer events off; keyboard ignored.

Loading example…

DisabledSourceStorybook

Label Always On

Always-visible value label bubble above the thumb.

Loading example…

Label Always OnSourceStorybook

Custom Label

Custom label formatter — displays a unit suffix next to the value.

Loading example…

Custom LabelSourceStorybook

With Marks

Marks along the track with labels; thumb snaps to the nearest marked step.

Loading example…

With MarksSourceStorybook

Inverted

Inverted fill — the bar covers the right side of the thumb rather than the left.

Loading example…

InvertedSourceStorybook

Vertical

Vertical orientation — the thumb travels bottom-to-top.

Loading example…

VerticalSourceStorybook

Controlled

Controlled value — the displayed number updates as you drag.

Loading example…

ControlledSourceStorybook

Range

RangeSlider — two thumbs capture a [start, end] interval.

Loading example…

RangeSourceStorybook

Range Controlled

Controlled RangeSlider — selected interval displayed alongside the track.

Loading example…

Range ControlledSourceStorybook

Themed

Themed slider — the filled bar and thumb border follow the active theme accent.

Loading example…

ThemedSourceStorybook

Styles

Per-slot styles targets individual parts — here the track, bar and thumb.

Loading example…

StylesSourceStorybook

Props

PropTypeDefaultDescription
defaultValuenumber | undefined`min`Uncontrolled initial value.
disabled systemboolean | undefinedfalseDisable interaction.
domain[number, number] | undefined`[min, max]`Selectable value range, overriding `[min, max]` for geometry, selection and aria bounds.
hiddenInputPropsDetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> | undefinedProps forwarded to the hidden form input (web).
invertedboolean | undefinedfalseInvert which side of the track is filled.
labelReactNode | ((value: number) => ReactNode)identityFormat/replace the value label. Pass `null` to hide it.
labelAlwaysOnboolean | undefinedfalseAlways show the value label, not just while dragging/hovering.
marksSliderMark[] | undefinedMarks rendered along the track.
maxnumber | undefined100Maximum value.
minnumber | undefined0Minimum value.
namestring | undefinedHidden input `name`, for uncontrolled form submission (web).
onChange((value: number) => void) | undefinedCalled on every value change while dragging / on key press.
onChangeEnd((value: number) => void) | undefinedCalled once the selection is finished (pointer up / key press).
orientationSliderOrientation | undefined
horizontal · vertical
'horizontal'Layout axis.
precisionnumber | undefinedderived from `step`Significant decimals to round emitted values to.
radius systemstring | number | undefined'xl'Border radius of the track/bar.
restrictToMarksboolean | undefinedfalseRestrict selectable values to the `marks` array.
scale((value: number) => number) | undefinedidentityTransform the displayed value (e.g. exponential scale) for label/aria.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
showLabelOnHoverboolean | undefinedtrueShow the value label on hover (web).
size systemnumber | "xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
xxs · xs · sm · md · lg · xl · xxl
'md'Track thickness and thumb diameter.
startPointValuenumber | undefinedValue at which the filled bar starts; the bar then extends from this point toward the thumb. Ignored when `inverted` is set.
stepnumber | undefined1Step between values.
styles systemSlotStyles<SliderStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part.
theme systemThemeName | null | undefinedApplies a theme to this element
thumbChildrenReactNodeContent rendered inside the thumb.
thumbLabelstring | undefinedAccessible label for the thumb.
thumbPropsGetFinalProps<RNTamaguiViewNonStyleProps, StackStyleBase, { shadow?: "xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined; }> | undefined
thumbSizestring | number | undefinedDiameter of the thumb. Derived from `size` by default. Accepts a `number` (px) or a numeric string (`"28"` / `"28px"`) for Mantine parity; non-numeric strings fall back to the `size`-derived default.
thumbValueTextstring | ((value: number) => string) | undefinedThumb `aria-valuetext`; a function receives the scaled value.
valuenumber | undefinedControlled value.

Style slots

Every part of Slider can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
barstyles={{ bar: { … } }}
labelstyles={{ label: { … } }}
labelAnchorstyles={{ labelAnchor: { … } }}
markstyles={{ mark: { … } }}
markLabelstyles={{ markLabel: { … } }}
rootstyles={{ root: { … } }}
thumbstyles={{ thumb: { … } }}
trackstyles={{ track: { … } }}
trackContainerstyles={{ trackContainer: { … } }}
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

Plus 496 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.