Usage
Slider lets users adjust a numeric value within a known range by dragging along a scale. Use it for settings such as limits, thresholds, percentages, or price ranges, where seeing the relative position of a value is more helpful than typing alone.
import { MtSlider } from "@shopware-ag/meteor-component-library";
Examples
Range
API reference
Props
| Prop | Type | Default |
|---|---|---|
label *Defines the label of the slider | string | |
requiredDetermines if the field is required. | false | true | false |
disabledDetermines if the field is disabled. | false | true | false |
name | string | null |
help-textA text that helps the user to understand what this field does. | string | "" |
is-inheritedToggles the inheritance visualization. | false | true | false |
is-inheritance-fieldDetermines if the field is inheritable. | false | true | false |
hintOptional caption below the field. The `#hint` slot takes precedence when provided. | string | null | null |
model-valueThe value of the slider.
If isRange is true, this should be an array with two values.
If isRange is false, this should be a single number. | number | number[] | 0 |
sizeThe size of the slider. | "default" | "small" | "default" |
copyable-tooltipIf set to true the tooltip will change on successful copy. | false | true | false |
copyableToggles the copy function of the slider. | false | true | false |
disable-inheritance-toggleDetermines the active state of the inheritance toggle. | false | true | false |
has-focus | false | true | false |
maxDefines the maximum value of the number. | number | 100 |
minDefines the minimum value of the number. | number | 0 |
stepDefines the amount of which the number is increased or decreased per step. | number | 1 |
is-rangeDefines if it is a range slider. | false | true | false |
min-distanceDefines the minimum distance between the two sliders.
Should be a multiple of the step. | number | 0 |
mark-countDefines the amount of marks on the slider. | number | 5 |
on-update:model-value | ((...args: any[]) => any) | undefined | |
on-inheritance-remove | ((...args: any[]) => any) | undefined | |
on-inheritance-restore | ((...args: any[]) => any) | undefined |
Exposed
| Name | Type |
|---|---|
future | any |
id | string |
rangeRightValue | number |
rangeLeftValue | number |
activeSlider | "left" | "right" | null |
showFieldHint | boolean |
identification | string |
inheritanceState | "none" | "linked" | "unlinked" |
labelStyle | CSSProperties |
stringRepresentation | string |
styleStartPosition | string |
styleEndPosition | string |
markStep | number |
toolTipText | string |
toolTipStyle | { display: string; left?: undefined; transform?: undefined; right?: undefined; } | { left: string; transform: string; display?: undefined; right?: undefined; } | { right: string; transform: string; display?: undefined; left?: undefined; } |
Best practices
Do
- Use a clear label that explains what the scale controls.
- Set sensible
min,max, andstepvalues for the use case. - Use a range slider when users need to set both a lower and upper bound together.
Don't
- Do not use Slider when precise text or number entry is the primary need.
- Do not use a very large range with tiny steps if dragging would become frustrating.
- Do not rely only on the visual bar to explain the meaning of the selected value.
Behavior
- Slider can represent either a single numeric value or a two-value range through
isRange. - The component includes linked number inputs, so users can adjust values by dragging or by typing.
markCount,step, andminDistancehelp shape how the scale behaves and how dense the value guidance feels.
Accessibility
- Use a visible label that makes the meaning of the scale clear.
- Make sure the chosen range and step size still allow keyboard users to reach useful values efficiently.
- Avoid using Slider for critical settings if users need extremely precise control without an alternate input path.
Related components
- Number Field: when precise numeric entry matters more than direct manipulation.