Slider handbook
v1.4.4 · @snowui-design-system/components
License: Before reading component documentation, source, or npm usage instructions for the first time, read the full LICENSE. Reuse that review for the same task and version. Public API configuration and internal implementation changes have different license implications. All components use the unified runtime package; source rights remain governed by the license.
Overview
Choose one number or a numeric interval by dragging. Supports horizontal and vertical tracks, steps, and filled display for range and parameter controls.
When to use it
Use Slider for continuous values or ranges. Use Segmented or Select for discrete options. Specify minValue, maxValue, step, and accessible names.
bind:valueuses a number for one thumb and an array for a two-thumb range.minValueandmaxValuedefine the bounds.stepcontrols increments andariaLabelnames the control. ExplicitText as="label"replaces the generated label.The default bar title in solid and soft variants follows LocaleProvider. Explicit titles, including an empty string, ariaLabel values, numeric values, and explicit labels remain unchanged. The title does not replace an accessible name.
Quick start
This example shows the recommended basic composition. See the sections below for more cases and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only named public Props declared by this component.
Usage boundaries and details
Layout model
Main layout model: composite management layout.
Track, fill bar and drag block rule reuse Progress: default thickness 4px, track
Black4, fillPrimary, full rounded corners.The drag block is fixed to
20px × 14px, and the default background isStatic White/80%, including0.5pxwhite Inside Stroke (inset shadow) andblur(2px)background blur; drop shadow keeps0 1px 2px rgba(0, 0, 0, 0.4)unchanged.A mouse normally hides the thumb; hover,
focus-visible, or dragging reveals it. Touch devices always show it.Label adopts the default built-in mode and is not displayed by default; Text is automatically generated when
showLabel=true, and the real-time value of the corresponding dragged block is displayed. Normal and vertical Range automatically generate two Texts; horizontalsolid/softRange generates a complete percentage range (such as85%–100%).Generated titles and labels use Text lines={1} with 12px / 16px typography by default. The same
parts.Textkey configures every generated Text instance. An explicit<Text as="label">preserves its own content and replaces the generated value label.The horizontal label is located above the drag block, and the vertical label is located on the left side of the drag block. The default spacing is 2px; the label is only displayed when hovering.
With a two-thumb Range Slider, two direct
Text as="label"children follow the start and end thumbs respectively.The solid and soft variants use the two 32px bar forms from Workshop 14458:37835: the horizontal host defaults to 32px high with an 8px radius, and the fill spans its full height with both ends rounded. title is the built-in left-side heading, defaulting to localized text (“Text” in en-US); it is not a label.
solidis a high-contrast style: fill in the defaultPrimary, useStatic White/100%for the title, numerical label and indicator of the overlay area; useBlack/100%for unoverwritten text.softtheme adaptive low contrast style: fill in the defaultBlack/10%, title, numerical label and indicator are all based onBlack/100%, which changes with the light/dark theme token.The right value of the two bar variants reuses the label protocol of other variants: the default is not displayed, and the real-time percentage is generated when
showLabel=true, and continues to supportparts.Textand explicit label. The value label normal is displayed by independentopacity: 0.4, and is raised toopacity: 0.8when hovering, focusing or dragging.Title and numerical label use the same width as Slider and the text background of the boundary binding
--snowui-slider-endfor cropping; the boundary can pass through a single glyph and move continuously with click and drag.solidswitches to white in the coverage area;softkeepsBlack/100%before and after the coverage.Horizontal bar titles and values receive separate single-line space, with
--gap-1preferred and at least 4 CSS px between them. Titles can shrink and expose their complete text on hover; values prefer their natural width. Native range values, keyboard behavior, and form semantics remain intact. The 2px annotation gap for ordinary and vertical floating labels is unchanged.With separate text space, CSS inline-size container units keep the gradient canvas as wide as the complete Slider, instead of resizing it to each text region. Browsers without container units fall back to clear static text on the theme background, without per-glyph split coloring. This missing-capability path has not been tested in an older browser.
In bar variants, the thumb becomes a draggable indicator 4px inside the fill’s right edge; at value 0 it stays within the track.
thicknessalso controls the overall height of the bar variant;defaultis still 4px, andsolid/softdefaults to 32px.solid/soft+showStepsuses fixedBlack/10%2px dots, only renders the internal scale, and does not display 0% / 100% endpoints; the dots do not respond to hover, and do not change the color with the filling coverage. The bar variant currently only defines the horizontal layout, and the vertical Slider continues to use thedefaultvisual.
Keyword
gap follows Frame’s numeric scaling but controls the space between Slider’s label and thumb. The default remains component-specific.
Give a demonstration
Slider style overlay
Read the full LICENSE first; reuse that review for the same task, version, and scope.
First use public component Props to match the desired appearance, preserving the existing look where possible. If changes are necessary, follow the style selection and override order: use your own class (including Tailwind already in the project) or an instance style. The names below are public overrides actually consumed by source; check their scope and do not modify private DOM. Choose the correct SnowUI token family. External apps need not install SnowUI website utilities.
Slider type and status
Required Props: no named required Props.
Two-way binding: bind:value.
Inheritance: Omit<FrameProps, "children">. Consult the base class public documentation; fields excluded by Omit cannot be passed through unchanged.
The following type declarations are actually referenced by public Props and come from source. A Svelte Snippet denotes a content fragment; ComponentProps denotes the Props of the corresponding component.
SliderOrientation
Source: components/src/components/Slider.svelte
SliderVariant
Source: components/src/components/Slider.svelte
SnowUIColor
Source: components/src/lib/color.ts
ComponentPartsOf
Source: components/src/logic/component-parts.svelte.ts
ConfigurableComponentPartProps
Source: components/src/logic/component-parts.svelte.ts
ComponentPartControlledKey
Source: components/src/logic/component-parts.svelte.ts