Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Single thumb

Use one thumb to pick a single number, and showValue to show it beside the track.

Labelled slider
The value is numeric; use the show-value attribute to display it next to the slider.
Show code
<app-slider label="Volume" name="volume" value="50" min="0" max="100" step="1" />

Range mode

Use two thumbs for a span such as a price band, each thumb stopping at the other.

Price range
Both thumbs move independently and clamp at each other's position.
Show code
<app-slider range="true" label="Price range" start="20" end="80" start-name="min_price" end-name="max_price" min="0" max="100" step="5" />

Showing the value

Show the number with a unit, so people read the value without guessing its scale.

With unit label
show-value displays the current value(s); unit adds a suffix.
Show code
<app-slider label="Discount" name="discount" value="75" show-value="true" unit="%" min="0" max="100" />

Sizes

Match the slider size to the form around it, using sm in dense panels.

sm, default, lg
Show code
<app-slider label="Small (sm)" name="v1" value="50" size="ControlSize.Sm" />
<app-slider label="Medium (default)" name="v2" value="50" />
<app-slider label="Large (lg)" name="v3" value="50" size="ControlSize.Lg" />

Step

Set step to the smallest change that matters, so each key press and drag moves a sensible amount.

Custom step (10)
Show code
<app-slider label="Increment (step=10)" name="increment" value="50" min="0" max="100" step="10" show-value="true" />

Error and helper text

Explain the limit under the slider, and show the error when the value breaks it.

With error state
Must be at least 50
Value too low
Show code
<app-slider label="Minimum requirement" name="minimum" value="30" min="0" max="100" helper-text="Must be at least 50" error="Value too low" show-value="true" />

Disabled

Disable a slider whose setting is locked, and say why beside it.

Disabled slider
Show code
<app-slider label="Locked setting" name="locked" value="50" disabled="true" show-value="true" />

Form submission

The slider creates a hidden form mirror input. Single-thumb submits under name; range mode submits start under start-name and end under end-name.

Every option

Every value of every prop, one cell each.

mode: single vs range

(default) single-thumb
range, dual-thumb

value, start and end

value="0"
value="100"
range start="0" end="100"

bounds & step

(default) min="0" max="100" step="1"
step="10"
min="50" max="150"
range min="50" max="150" step="5"

label

label="Volume"

state

(default)
required
disabled
error + helper text (helper text hidden)
Must be at least 50
Value too low
helper text only
Must be at least 50
disabled + range

readOnly

(default), no read-only
read-only

loading

(default), no loading
loading

optional and optionalLabel

(default), no optional
optional
optional optional-label="Facultatif"

help and helpLabel

(default), no help
help="Drag a thumb, or use the arrow keys."
help with help-label="About this slider"

name

name="volume" (form field name, no visible change)

startName and endName

start-name="min" end-name="max" (range, no visible change)

defaultValue, defaultStart and defaultEnd

value="30" (React: defaultValue={30})
start="20" end="80" (React: defaultStart and defaultEnd)

size: every size

size="sm"
size="md" (default)
size="lg"

showValue & unit

(default), no show-value
show-value="true"
show-value="true" unit="%"
range show-value="true" unit="$"

grouping: lakh and crore groups

grouping="Indian" show-value="true"
grouping="None" (default)

id

id="opt-id" (no visible change)

ariaLabel

aria-label="Volume level" (no visible label, sets the accessible name)

className

input-class="mb-0" (no visible change)

fieldClassName

class="mb-0" (wrapper, no visible change)

onChange

onChange: React only (Razor posts the value with the form)

ref

id="opt-ref" (React: ref, reached by id)

asp-for

asp-for="Volume" (binds name, id, value, label and required)

Guidance

What to do, and what to avoid.

Use it when

  • Pick a single numeric value visually (volume, brightness, rating)
  • Select a range (price range, budget, date window)
  • Compare multiple values on a continuous scale
  • When keyboard input is secondary to visual feedback

Reach for something else when

  • Precise multi-digit values. → AppNumberInput
  • Categorical choices. → AppSelect, AppRadio, or AppSegmented
  • Boolean on/off. → AppSwitch
  • When the scale is unclear (add labels or a reference)

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

sm md lg
none indian
React, generated from the controls
<AppSlider label="Volume" name="pg-slider" value={50} onChange={(next) => …} />
Razor, the same props
<app-slider label="Volume" name="pg-slider" value="50" />

27 props. The 5 most used come first.

Used on most screens 5 props

PropTypeDefaultDescription
valuedefault 50 string 50 Current value (single mode).
mindefault 0 decimal 0 Lowest value the slider can take.
maxdefault 100 decimal 100 Highest value the slider can take.
stepdefault 1 decimal 1 Distance between two allowed values.
rangedefault false bool false Enables dual-thumb range mode.

Less common 22 props

PropTypeDefaultDescription
labeldefault - string - Visible label above the control.
namedefault - string - Form field name (single mode).
startdefault 25 string 25 Range start (range mode).
enddefault 75 string 75 Range end (range mode).
start-namedefault - string - Form field name for range start.
end-namedefault - string - Form field name for range end.
requireddefault false bool false Marks the field as required.
optionaldefault false bool false Ends the label with (optional) when the field is not required. Required wins when both are set.
optional-labeldefault (optional) string (optional) Replaces the built-in English text, for other languages.
helper-textdefault - string - Helper text under the control.
errordefault - string - Error text under the control; sets aria-invalid.
sizedefault - sm | md | lg - Control size tier.
disableddefault false bool false Disables the control.
show-valuedefault false bool false Shows a label with the current value or values.
unitdefault - string - Suffix for the value label, for example %.
groupingdefault none none | indian none Digit grouping of the value label: indian writes 1,50,000; none writes 150000.
asp-fordefault - ModelExpression - Razor-only. Binds name, id, value, label and required from a model property; explicit attributes still win.
read-onlydefault false bool false Shows the value but blocks editing. The value still posts.
loadingdefault false bool false Shows a busy state and blocks input while data loads.
helpdefault - string - Info-tip content shown beside the label.
help-labeldefault More information string More information The accessible name of the info-tip button.
input-classdefault - string - Extra classes on the control itself (the slider element). A plain class attribute merges onto the wrapper instead.

Screen reader

3 notes
  • The visible label is tied to the control by id, and the control takes its accessible name from a text label or from ariaLabel.
  • aria-describedby points at the error text, or at the helper text when there is no error, and an error also sets aria-invalid.
  • A required slider shows a required mark beside its label and carries the required attribute.