Inputs
Labelled Ticks Slider
A slider over named steps: the ticks come from a repeating gradient and captions like "once a week" sit underneath them.
- slider
- ticks
- steps
- native
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/slider-003?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "slider-003" (Labelled Ticks Slider) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/slider-003.json
Registry item: https://vibeui.ru/r/slider-003.json
Installs to: components/vibeui/slider-003.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
A slider over named steps: the ticks come from a repeating gradient and captions like "once a week" sit underneath them.
A slider over labelled steps with gradient ticks. One file, zero dependencies, a server component with no client JS.
## 3. How to use it
import { Slider003 } from "@/components/vibeui/slider-003"
<Slider003
label="Digest frequency"
defaultValue={2}
/>
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-slider-003-* palette — do not swap it for your theme tokens
- the ticks as a repeating gradient: one node per tick adds nothing and complicates the layout
- the two separate variables for ticks and captions — their counts differ by one and are easy to confuse
- aria-valuetext: without it a screen reader says "2" instead of "once a week"
- the transparent tracks on the input itself — the ticks are painted by a separate layer
- the component's own light surface — without it the dark text disappears on a dark page
## 6. You may change
- the caption through label
- the set of steps through ticks
- the starting step through defaultValue
- the accent colour through accent
## 7. Rules
- The track is not filled as the thumb moves: filling would need client state, deliberately absent here.
- More than five captions will not fit a narrow card — long wording has to be shortened.
- aria-valuetext is static here: in an interactive scenario the value owner keeps it updated.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/slider-003.jsonhttps://vibeui.ru/r/slider-003.jsonСерверный компонент: состояние не нужно, значение читает форма. Деления — repeating-linear-gradient по ширине дорожки, поэтому лишних узлов нет, а количество штрихов задаётся переменной steps. Подписи разложены в grid с равными колонками по числу ступеней: крайние прижаты к краям, средние центрированы. Значение объявлено через aria-valuetext, потому что цифра шкалы ничего не значит. Палитра в --vibeui-slider-003-*.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Slider003Props = Omit<
ComponentPropsWithoutRef<"input">,
"type" | "list" | "children"
> & {
label?: string
/** Подписанные ступени: их порядок и есть шкала. */
ticks?: string[]
accent?: string
}
// Идея компонента: ползунок по именованным ступеням, а не по числам.
// Значения вроде «раз в неделю» не выражаются цифрой в подписи, поэтому
// шкала подписана целиком: деления нарисованы повторяющимся градиентом,
// подписи стоят под ними, а сам input остаётся серверным — состояние не
// нужно, значение читает форма.
const STYLES = `
:where([data-vibeui-block="slider-003"]){
--vibeui-slider-003-bg:oklch(1 0 0);
--vibeui-slider-003-fg:oklch(0.22 0.014 265);
--vibeui-slider-003-muted:oklch(0.55 0.014 265);
--vibeui-slider-003-border:oklch(0.9 0.006 265);
--vibeui-slider-003-track:oklch(0.91 0.006 265);
--vibeui-slider-003-accent:oklch(0.52 0.14 195);
--vibeui-slider-003-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
--vibeui-slider-003-steps:3;
--vibeui-slider-003-marks:4;
}
[data-vibeui-block="slider-003"]{
display:flex;flex-direction:column;gap:0.5rem;
width:100%;max-width:21rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-slider-003-bg);
border:1px solid var(--vibeui-slider-003-border);border-radius:0.875rem;
font-family:var(--vibeui-slider-003-font);color:var(--vibeui-slider-003-fg);
}
[data-vibeui-block="slider-003"] [data-part="label"]{font-size:0.8125rem;font-weight:600}
[data-vibeui-block="slider-003"] [data-part="rail"]{position:relative;padding:0 0.5rem}
/* Деления — повторяющийся градиент по ширине дорожки: столько же
вертикальных штрихов, сколько ступеней, без единого лишнего узла. */
[data-vibeui-block="slider-003"] [data-part="ticks"]{
position:absolute;left:0.5rem;right:0.5rem;top:0.4375rem;height:0.375rem;
pointer-events:none;border-radius:9999px;
background:
repeating-linear-gradient(to right,var(--vibeui-slider-003-border) 0 1.5px,transparent 1.5px calc((100% - 1.5px) / var(--vibeui-slider-003-steps))),
var(--vibeui-slider-003-track);
}
[data-vibeui-block="slider-003"] input{
appearance:none;position:relative;display:block;
width:100%;height:1.25rem;margin:0;background:none;cursor:pointer;
}
[data-vibeui-block="slider-003"] input::-webkit-slider-runnable-track{height:0.375rem;border-radius:9999px;background:transparent}
[data-vibeui-block="slider-003"] input::-moz-range-track{height:0.375rem;border-radius:9999px;background:transparent}
[data-vibeui-block="slider-003"] input::-webkit-slider-thumb{
appearance:none;margin-top:-0.34375rem;
width:1.0625rem;height:1.0625rem;border-radius:9999px;
background:var(--vibeui-slider-003-accent);border:3px solid var(--vibeui-slider-003-bg);
box-shadow:0 1px 4px oklch(0.2 0.02 265 / 32%);
}
[data-vibeui-block="slider-003"] input::-moz-range-thumb{
width:1.0625rem;height:1.0625rem;border-radius:9999px;box-sizing:border-box;
background:var(--vibeui-slider-003-accent);border:3px solid var(--vibeui-slider-003-bg);
}
[data-vibeui-block="slider-003"] input:focus-visible{outline:2px solid var(--vibeui-slider-003-accent);outline-offset:4px;border-radius:0.5rem}
/* Подписи: крайние прижаты к краям, средние центрированы под своими
делениями — поэтому это grid с равными колонками, а не space-between. */
[data-vibeui-block="slider-003"] [data-part="marks"]{
display:grid;grid-template-columns:repeat(var(--vibeui-slider-003-marks),1fr);
margin:0;padding:0;list-style:none;
font-size:0.6875rem;line-height:1.3;color:var(--vibeui-slider-003-muted);
}
[data-vibeui-block="slider-003"] [data-part="marks"] li{text-align:center}
[data-vibeui-block="slider-003"] [data-part="marks"] li:first-child{text-align:left}
[data-vibeui-block="slider-003"] [data-part="marks"] li:last-child{text-align:right}
`
const DEFAULT_TICKS = ["Никогда", "Раз в месяц", "Раз в неделю", "Каждый день"]
/**
* Ползунок по именованным ступеням: деления градиентом, подписи под ними.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Slider003({
label = "Как часто присылать сводку",
ticks = DEFAULT_TICKS,
accent,
id,
className,
style,
defaultValue = 2,
...props
}: Slider003Props) {
const last = Math.max(1, ticks.length - 1)
const palette = {
"--vibeui-slider-003-steps": String(last),
"--vibeui-slider-003-marks": String(ticks.length),
...(accent ? { "--vibeui-slider-003-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-slider-003" precedence="medium">
{STYLES}
</style>
<div data-vibeui-block="slider-003" className={className} style={palette}>
<label data-part="label" htmlFor={id}>
{label}
</label>
<div data-part="rail">
<span data-part="ticks" aria-hidden="true" />
<input
{...props}
id={id}
type="range"
min={0}
max={last}
step={1}
defaultValue={defaultValue}
aria-valuetext={ticks[Number(defaultValue)]}
/>
</div>
<ul data-part="marks" aria-hidden="true">
{ticks.map((tick) => (
<li key={tick}>{tick}</li>
))}
</ul>
</div>
</>
)
}