form fields
<tc-slider>
Themed range input. Built on the native `<input type="range">` for free keyboard and touch behavior. Optional ticks, value label, suffix.
import
"@ra9/tan-compose-kit/slider"
Props
| Name | Type | Default | Description |
|---|---|---|---|
value | number | 0 | Current value. Reflects to the `value` attribute. |
min | number | 0 | Minimum value. |
max | number | 100 | Maximum value. |
step | number | 1 | Step increment. |
disabled | boolean | false | Greyed out and non-interactive. |
showValue | boolean | false | Show the current value as a label. |
showTicks | boolean | false | Draw a tick mark per step (skipped when step density exceeds 50 ticks). |
label | string | "" | Visible label above the slider. |
suffix | string | "" | Appended to the value label (e.g. `%`, `px`, ` items`). |
Events
| Event | Detail | When |
|---|---|---|
tc-input | { value: number } | Fires while the user is dragging or holding an arrow key. |
tc-change | { value: number, previous: number } | Fires once the user releases / commits the value. |
CSS variables
| Variable | Default | Description |
|---|---|---|
--tc-slider-track | var(--tc-color-rule, #ece5d3) | Empty track color. |
--tc-slider-fill | var(--tc-color-accent, #a16939) | Filled track color. |
--tc-slider-thumb | var(--tc-color-surface, #ffffff) | Thumb fill. |
--tc-slider-thumb-ring | var(--tc-color-accent, #a16939) | Thumb border. |
--tc-slider-track-size | 6px | Track height. |
--tc-slider-thumb-size | 20px | Thumb diameter. |
Examples
Basic
With label and value
Ticks
Custom range and step
Disabled
Listening for change
Accessibility
- The underlying
<input type="range">provides full keyboard support out of the box:←/→step,Page Up/Page Downlarger jumps,Home/Endfor ends. aria-valuetextcarries the value with its suffix so screen readers announce "60 percent" rather than just "60".- The focus ring is built into the thumb with a
color-mixhalo — works on light and dark themes.