Componentform1.06 KB gzipZero dependencies
SliderTicks
Slider with tick marks, labels, and snap-to-ticks functionality
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add slider-ticksOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { SliderTicks } from "@/components/ui/slider-ticks"; <SliderTicks min={0} max={100} step={1} ticks={[0, 25, 50, 75, 100]} defaultValue={50} onValueChange={(v) => {}} />Source code
slider-ticks.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxslider-ticks.tsx162 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface SliderTicksProps extends Omit<React.HTMLAttributes<HTMLElement>, "value" | "defaultValue"> { min?: number; max?: number; step?: number; ticks?: number[]; value?: number; defaultValue?: number; onValueChange?: (value: number) => void; className?: string;} export function SliderTicks({ min = 0,Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { SliderTicks } from "@/components/ui/slider-ticks"; <SliderTicks />| Prop | Type | Description |
|---|---|---|
| min | number | Minimum allowed numeric or date bound. (Default: 0) |
| max | number | Maximum allowed numeric or date bound. (Default: 100) |
| step | number | Step increment for numeric or range adjustments. (Default: 1) |
| ticks | number[] | Configures ticks. |
| value | number | Controlled value. |
| defaultValue | number | Initial value when uncontrolled. |
| onValueChange | (value: number) => void | Callback invoked on value change. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |