BrickclayDesign System

Slider

Single-value horizontal range slider. [(ngModel)] is the primary value-binding mechanism (standard ControlValueAccessor, same pattern as bk-checkbox/bk-input). The value tooltip reuses the existing bkTooltip directive. Turn on marks to show a tick at every step interval; hovering one previews a small point at that exact position.

bk-sliderForms and inputsAngular

Preview

A working preview of Slider in the Brickclay style. Try it.

Interact with the preview to see events here.

Interactive playground

color

Examples

Custom color, color="#3B82F6"

Sets --bk-slider-color, the active track and thumb pick it up, the inactive track is unaffected.

Off-step end, [start]="0" [end]="10" [step]="3" [marks]="true"

Marks at 0, 3, 6, 9 only, end (10) isn't itself a multiple of 3 from start, so it gets no mark of its own, even though it's still a value the thumb can reach.

Custom size, [trackHeight]="10"

The thumb scales with the track (4× its thickness, the same ratio as the 4px/16px defaults), so resizing the slider is one number, not two that could fall out of sync, and the marks stay clear of the (now much bigger) thumb rather than disappearing behind it.

Usage

start / end / step shape the range; the current value is always clamped and snapped into it, including when they change at runtime.

API reference

Inputs <bk-slider>

NameTypeDefaultDescription
startnumber0Minimum value. Re-clamps the current value if changed at runtime.
endnumber100Maximum value. Re-clamps the current value if changed at runtime.
stepnumber1Increment for drag/click/keyboard interaction. Decimals are supported (e.g. 0.5).
colorstringundefinedSets the --bk-slider-color CSS variable, the active track and thumb. The inactive track is unaffected.
tooltipbooleantrueShows the value in a bkTooltip on hover (native bkTooltip behavior, it keeps tracking the thumb through a drag as long as the pointer stays over it).
tooltipFormat(value: number) => stringundefinedCustomizes the tooltip text, e.g. (v) => '$' + v. Defaults to the plain value.
marksbooleanfalseRenders a small tick at every reachable step value, start, start + step, start + 2×step, … up to end, and never at any other position; end only gets a tick when it's itself a genuine multiple of step from start. Hovering a mark's tick or label shows a small point pinned to that exact value, the thumb remains the only large, prominent circular control. Each mark has its own generously-sized (invisible) hit target, so clicking it jumps straight to that value; clicking anywhere else on the track still computes and snaps to the nearest valid step as usual. Ticks/labels are positioned clear of the thumb's own footprint, so they stay visible even with a larger trackHeight.
trackHeightnumber4Track thickness in px. The thumb scales with it (diameter = 4× the track height, the 4px/16px default ratio) so resizing the slider is one number, not two that could fall out of sync.
disabledbooleanfalseBlocks pointer/keyboard interaction. Also settable via [disabled] on a bound FormControl.
idstringundefinedForwarded to the thumb element.
ariaLabelstringundefinedAccessible name for the role="slider" thumb.

Outputs <bk-slider>

NamePayloadFires when
valueChangenumberThe value is committed by a drag, a track click, or a keyboard interaction (arrows / Home / End / Page Up / Page Down), same moments (ngModelChange) fires.

Keyboard

KeyAction
ArrowLeft / ArrowDownDecrease by step
ArrowRight / ArrowUpIncrease by step
PageDown / PageUpDecrease / increase by step × 10
HomeJump to start
EndJump to end