Tick Slider

Bound labels, tick gauge, optional purpose title, and floating value bubble.

Installation

Install with the CLI, or copy the component source into your project.

Add tick-slider (npm)

npx --yes -p github:itsvigneshv/default-file-ui#main df-ui add tick-slider

Default

Duration labels with a formatted value bubble. Scrub to hear the stepped tick sound.

5m

0 to 100

Numeric range from 0 to 100. Scrub the track to update the value in the bubble.

42

Long duration

Value near the middle of the track with an hours and minutes bubble.

8h 14m

Disabled

Disabled track and bubble.

40

Ticks

Custom tick count, colors, width, height, radius, and minimum gap. Bars still span the full track.

4h 40m

Bounds

Show only the start label, only the end label, or neither. Hidden sides fade the tick gauge.

2h
4h
3h

Purpose label

Purpose title via label. header and footer sit outside the shell; shell overlays the track. With header or footer, bubbleSide auto places the bubble on the opposite side.

Duration
2h 30m
3h 30m
Window
Focus block3h

Label alignment

labelAlign positions the purpose title start, center, or end. Shell start and end flush to the second tick from each end. Wash stays fixed, and ticks under the text stay dimmed.

Duration
2h 30m
Duration
3h
Duration
3h 30m
Focus block2h 30m
Focus block3h
Focus block3h 30m

Bubble side

bubbleSide auto moves the bubble opposite a header purpose label. Explicit bottom places it under the thumb without a purpose label.

Duration
2h 30m
3h

Appearance

Override accent, bubble text, bound label color, and corner radii with appearance props.

3h

Compact

The sm size scales the shell, bounds, ticks, thumb, and bubble. Appearance props still apply. Shells under 22rem use the same density automatically.

36%

Properties

Single-thumb scrubber with bound labels, an optional purpose title, a tick gauge, and a floating value bubble.

Value

PropTypeDefaultNotes
minnumber0Minimum value.
maxnumber-Maximum value (required).
stepnumber1Increment between values.
valuenumber-Controlled value. Values outside min to max are snapped to step and clamped for the thumb, ticks, bubble, and aria value.
defaultValuenumberminUncontrolled initial value.
onValueChange(value: number) => void-Called when the value changes.
formatValue(value: number) => string-Formats the bubble text and aria valuetext. Defaults to String(value).
disabledboolean-Disables pointer and keyboard interaction.

Bounds

Edge labels for live range values. Separate from the purpose title.

PropTypeDefaultNotes
startLabelReact.ReactNode-Content for the start bound. Omit to hide the bound.
endLabelReact.ReactNode-Content for the end bound. Omit to hide the bound.
bounds"both" | "start" | "end" | "none""both"Which bound labels to show. Hidden sides fade the tick gauge at that end. none hides both labels and fades both ends.

Purpose label

Optional title for the control. Does not replace startLabel or endLabel.

PropTypeDefaultNotes
labelReact.ReactNode-Purpose title. Placement follows labelPosition. Alignment follows labelAlign.
labelPosition"header" | "footer" | "shell""header"Where the purpose label renders when label is set. header is above the shell. footer is below. shell overlays the track with a soft wash behind the text, and ticks under the label use reduced opacity.
labelAlign"start" | "center" | "end"-Horizontal alignment of the purpose label. start pins left, center centers, end pins right. Defaults to start for header and footer, and center for shell. On shell, start and end flush the copy to the second tick from each end. Shell labels keep a fixed wash, and ticks under the label stay dimmed while the thumb moves.

Value bubble

PropTypeDefaultNotes
showValueBubblebooleantrueShow the floating value bubble. Side follows bubbleSide. Clearance padding is removed when false.
bubbleSide"auto" | "top" | "bottom""auto"Side of the thumb for the value bubble. auto places the bubble opposite a header or footer purpose label, and above the thumb for a shell label or when label is omitted. top and bottom override auto.
bubbleLeadingReact.ReactNode-Optional leading content inside the value bubble.

Ticks

PropTypeDefaultNotes
tickCountnumber22Number of vertical tick bars across the track (minimum 2).
showTicksbooleantrueShow the vertical tick bars.
tickActivestring-Fill color for ticks at or left of the current value. Prefer a kit color token.
tickMutedstring-Fill color for ticks right of the current value. Prefer a kit color token.
tickWidthstring-Tick bar width. Prefer a kit length token such as var(--border-width-thick).
tickHeightstring-Tick bar height. Prefer a kit length token such as calc(6 * var(--spacing-unit)).
tickRadius"none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "full""full"Corner radius of each tick bar.
tickGapstring-Minimum gap between tick bars. Ticks still span the full track from start to end.
renderTick(tick: { index: number; count: number; active: boolean; ratio: number; value: number }) => React.ReactNode-Replace each default tick bar with custom content.
tickSoundbooleantruePlay a short tick on each stepped value change while scrubbing or using the keyboard. Skipped when the document is hidden or reduced motion is preferred.

Appearance

PropTypeDefaultNotes
size"sm" | "md""md"Overall density. sm is compact for shell, bounds, ticks, thumb, bubble, and bubble clearance. Containers under 22rem apply the same density automatically. Appearance props and CSS variables still override.
accentstring-Accent fill for the thumb and value bubble. Prefer a kit color token.
accentForegroundstring-Text color on the value bubble. Prefer a kit color token.
boundForegroundstring-Text color on the bound labels. Prefer a kit color token.
thumbWidthstring-Accent thumb width. Prefer a kit length token such as var(--border-width-thick).
thumbHeightstring-Accent thumb height. Prefer a kit length token. Overrides the sm density thumb height when set.
radius"none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "full""full"Corner radius of the outer shell.
boundRadius"none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "full""full"Corner radius of the bound labels.
thumbRadius"none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "full""full"Corner radius of the accent thumb.
bubbleRadius"none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "full""full"Corner radius of the floating value bubble.

Accessibility and layout

PropTypeDefaultNotes
aria-labelstring-Accessible name on the slider thumb. Prefer label when a purpose title is visible.
aria-labelledbystring-ID of a labeling element for the slider thumb. When label is set and this is omitted, the purpose label id is used.
classNamestring-Class names on the host wrapper. Use for width and outer layout.
styleReact.CSSProperties-Inline styles on the control root. Can override TickSlider CSS variables.

Tokens

Appearance props map onto these CSS variables. The sm size and shells under 22rem remap base variables to the sm companion tokens. Prop and style overrides still win.

TokenTypeDefaultNotes
--df-tick-slider-accentCSS colorvar(--df-coral-430)Active thumb tick and value bubble.
--df-tick-slider-accent-foregroundCSS colorvar(--df-neutral-0)Bubble text and leading content.
--df-tick-slider-shell-bgCSS colorcolor-mix(in oklch, var(--muted) 88%, var(--background))Shell background.
--df-tick-slider-shell-borderCSS colorvar(--border)Shell border.
--df-tick-slider-shell-radiusCSS lengthvar(--radius-full)Outer shell corner radius.
--df-tick-slider-shell-heightCSS lengthcalc(14 * var(--spacing-unit))Minimum shell height.
--df-tick-slider-shell-padCSS lengthcalc(1.5 * var(--spacing-unit))Shell padding around bounds and track.
--df-tick-slider-gapCSS lengthcalc(2 * var(--spacing-unit))Gap between bound labels and the track.
--df-tick-slider-bound-bgCSS colorcolor-mix(in oklch, var(--background) 72%, transparent)Bound label fill.
--df-tick-slider-bound-borderCSS colorvar(--border)Bound label border.
--df-tick-slider-bound-foregroundCSS colorvar(--foreground)Bound label text.
--df-tick-slider-bound-radiusCSS lengthvar(--radius-full)Bound label corner radius.
--df-tick-slider-bound-min-widthCSS lengthcalc(18 * var(--spacing-unit))Minimum width of each bound label.
--df-tick-slider-bound-pad-inlineCSS lengthcalc(3 * var(--spacing-unit))Horizontal padding inside each bound label.
--df-tick-slider-bound-pad-blockCSS lengthcalc(1.5 * var(--spacing-unit))Vertical padding inside each bound label.
--df-tick-slider-tick-activeCSS colorvar(--foreground)Ticks at or left of the current value.
--df-tick-slider-tick-mutedCSS colorcolor-mix(in oklch, var(--foreground) 22%, transparent)Ticks right of the current value.
--df-tick-slider-tick-widthCSS lengthvar(--border-width-hairline)Tick bar width.
--df-tick-slider-tick-heightCSS lengthcalc(5 * var(--spacing-unit))Tick bar height.
--df-tick-slider-tick-radiusCSS lengthvar(--radius-full)Tick bar corner radius.
--df-tick-slider-tick-gapCSS lengthcalc(1 * var(--spacing-unit))Minimum gap between tick bars when tickGap is set.
--df-tick-slider-thumb-widthCSS lengthvar(--border-width-thick)Accent thumb width.
--df-tick-slider-thumb-heightCSS lengthcalc(6 * var(--spacing-unit))Accent thumb height.
--df-tick-slider-thumb-radiusCSS lengthvar(--radius-full)Accent thumb corner radius.
--df-tick-slider-bubble-pad-inlineCSS lengthcalc(2.5 * var(--spacing-unit))Horizontal padding inside the value bubble.
--df-tick-slider-bubble-pad-blockCSS lengthcalc(1 * var(--spacing-unit))Vertical padding inside the value bubble.
--df-tick-slider-bubble-offsetCSS lengthcalc(2 * var(--spacing-unit))Gap between the thumb and the value bubble.
--df-tick-slider-bubble-radiusCSS lengthvar(--radius-full)Value bubble corner radius.
--df-tick-slider-bubble-gapCSS lengthcalc(1 * var(--spacing-unit))Gap between bubble leading content and the value text.
--df-tick-slider-root-pad-topCSS lengthcalc(9 * var(--spacing-unit))Top clearance when the value bubble sits above the thumb.
--df-tick-slider-root-pad-bottomCSS lengthcalc(9 * var(--spacing-unit))Bottom clearance when the value bubble sits below the thumb.
--df-tick-slider-label-gapCSS lengthcalc(2 * var(--spacing-unit))Gap between an outside purpose label and the shell.
--df-tick-slider-shell-label-fgCSS colorvar(--foreground)Purpose label text when labelPosition is shell.
--df-tick-slider-shell-label-sizeCSS lengthvar(--df-text-sm)Font size for the shell purpose label.
--df-tick-slider-shell-label-size-smCSS lengthvar(--df-text-13)Compact font size for the shell purpose label.
--df-tick-slider-shell-label-washCSS background-imageradial-gradient(closest-side, color-mix(in srgb, var(--df-tick-slider-shell-bg) 100%, transparent) 0%, color-mix(in srgb, var(--df-tick-slider-shell-bg) 92%, transparent) 42%, color-mix(in srgb, var(--df-tick-slider-shell-bg) 58%, transparent) 72%, transparent 100%)Fixed radial wash behind the shell purpose label text. Opacity does not change with the thumb.
--df-tick-slider-shell-label-tick-opacitynumber 0 to 10.28Opacity for ticks that sit under the shell purpose label.
--df-tick-slider-tick-segmentsnumbertickCount - 1Tick gaps across the track (tickCount minus 1). Used so shell start and end labels inset by one tick to the second mark from each end.
--df-tick-slider-shell-label-pad-inlineCSS lengthcalc(6 * var(--spacing-unit))Horizontal wash padding on the shell purpose label capsule. On shell start and end, the outer edge also insets by one tick segment so copy meets the second tick from that end.
--df-tick-slider-shell-label-pad-blockCSS lengthcalc(2.5 * var(--spacing-unit))Vertical padding of the shell purpose label wash capsule.
--df-tick-slider-fade-sizeCSS lengthcalc(6 * var(--spacing-unit))Edge fade length when a bound label is hidden.
--df-tick-slider-shell-height-smCSS lengthcalc(11 * var(--spacing-unit))Compact shell height for size sm.
--df-tick-slider-shell-pad-smCSS lengthcalc(1 * var(--spacing-unit))Compact shell padding for size sm.
--df-tick-slider-gap-smCSS lengthcalc(1 * var(--spacing-unit))Compact bound to track gap for size sm.
--df-tick-slider-bound-min-width-smCSS lengthcalc(14 * var(--spacing-unit))Compact bound minimum width for size sm.
--df-tick-slider-bound-pad-inline-smCSS lengthcalc(3 * var(--spacing-unit))Compact bound horizontal padding for size sm.
--df-tick-slider-bound-pad-block-smCSS lengthcalc(1 * var(--spacing-unit))Compact bound vertical padding for size sm.
--df-tick-slider-tick-height-smCSS lengthcalc(3.5 * var(--spacing-unit))Compact tick bar height for size sm.
--df-tick-slider-thumb-height-smCSS lengthcalc(4.5 * var(--spacing-unit))Compact accent thumb height for size sm.
--df-tick-slider-bubble-pad-inline-smCSS lengthcalc(2 * var(--spacing-unit))Compact bubble horizontal padding for size sm.
--df-tick-slider-bubble-pad-block-smCSS lengthcalc(0.5 * var(--spacing-unit))Compact bubble vertical padding for size sm.
--df-tick-slider-bubble-offset-smCSS lengthcalc(1.5 * var(--spacing-unit))Compact bubble offset for size sm.
--df-tick-slider-root-pad-top-smCSS lengthcalc(7 * var(--spacing-unit))Compact top clearance for size sm.
--df-tick-slider-root-pad-bottom-smCSS lengthcalc(7 * var(--spacing-unit))Compact bottom clearance for size sm.
--df-tick-slider-fade-size-smCSS lengthcalc(4 * var(--spacing-unit))Compact edge fade length for size sm.
--spacing-unitCSS length0.25remBase unit for shell, tick, and bubble sizes.