Inputs
Value Slider
A slider on the native range input: dragging, touch and keyboard come from the browser, with the number next to the label.
- slider
- range
- value
- form
Preview
1440pxHost theme
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-001?lang=en
10 тыс. ₽200 тыс. ₽
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-001" (Value 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-001.json
Registry item: https://vibeui.ru/r/slider-001.json
Installs to: components/vibeui/slider-001.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 on the native range input: dragging, touch and keyboard come from the browser, with the number next to the label.
A slider: the label and current value on one line, a filled track and the bounds underneath. Zero dependencies, one file.
## 3. How to use it
import { Slider001 } from "@/components/vibeui/slider-001"
<Slider001 label="Budget" min={10} max={200} step={5} defaultValue={80} />
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-001-* palette — do not swap it for your theme tokens
- the native input[type=range]: dragging, touch and arrow keys come free
- the number next to the label — a handle position reads worse than a figure
- the filled part of the track: it shows the share without arithmetic
- tabular figures so the changing number does not shift the label
- useId instead of a hard-coded id: otherwise two sliders share one label
## 6. You may change
- label, min, max, step and defaultValue
- unit — the unit of measure
- the accent through the accent prop
- the block width
## 7. Rules
- A slider is not for exact values: pair a wide range with a number input.
- Thumb styling is vendor-prefixed: ::-webkit- and ::-moz- rules cannot share a selector.
- The component is self-contained: add your own onChange to lift the value up.
- 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-001.jsonhttps://vibeui.ru/r/slider-001.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-slider-001-*. Клиентский: "use client" ради значения. Пройденная часть дорожки закрашена градиентом по проценту, процент передаётся переменной --vibeui-slider-001-fill. Идентификатор берётся из useId, поэтому два ползунка на странице не путают подписи.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
"use client"
import { useId, useState } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Slider001Props = Omit<
ComponentPropsWithoutRef<"div">,
"children" | "defaultValue" | "onChange"
> & {
label?: string
min?: number
max?: number
step?: number
defaultValue?: number
unit?: string
accent?: string
}
// Идея компонента: ползунок на нативном input[type=range]. Свой ползунок пришлось
// бы учить перетаскиванию, клавиатуре и касаниям — браузер умеет это сам.
// Пройденная часть дорожки закрашивается градиентом по проценту, поэтому
// значение видно и без подписи, а подпись всё равно есть: цифра точнее позиции.
const STYLES = `
:where([data-vibeui-block="slider-001"]){
--vibeui-slider-001-bg:oklch(1 0 0);
--vibeui-slider-001-fg:oklch(0.24 0.014 265);
--vibeui-slider-001-muted:oklch(0.56 0.014 265);
--vibeui-slider-001-border:oklch(0.9 0.006 265);
--vibeui-slider-001-track:oklch(0.92 0.006 265);
--vibeui-slider-001-accent:oklch(0.55 0.2 262);
--vibeui-slider-001-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
--vibeui-slider-001-fill:50%;
}
[data-vibeui-block="slider-001"]{
display:flex;flex-direction:column;gap:0.5rem;
width:100%;max-width:20rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-slider-001-bg);
border:1px solid var(--vibeui-slider-001-border);border-radius:0.875rem;
font-family:var(--vibeui-slider-001-font);color:var(--vibeui-slider-001-fg);
}
[data-vibeui-block="slider-001"] [data-part="head"]{
display:flex;align-items:baseline;justify-content:space-between;gap:1rem;
font-size:0.875rem;
}
/* Цифра рядом с ползунком: позиция ручки не читается точнее числа. */
[data-vibeui-block="slider-001"] [data-part="value"]{font-weight:650;font-variant-numeric:tabular-nums}
[data-vibeui-block="slider-001"] [data-part="scale"]{
display:flex;justify-content:space-between;
font-size:0.6875rem;color:var(--vibeui-slider-001-muted);
font-variant-numeric:tabular-nums;
}
[data-vibeui-block="slider-001"] input{
appearance:none;width:100%;height:1.25rem;margin:0;background:none;cursor:pointer;
}
[data-vibeui-block="slider-001"] input::-webkit-slider-runnable-track{
height:0.375rem;border-radius:9999px;
background:linear-gradient(to right,var(--vibeui-slider-001-accent) var(--vibeui-slider-001-fill),var(--vibeui-slider-001-track) var(--vibeui-slider-001-fill));
}
[data-vibeui-block="slider-001"] input::-moz-range-track{
height:0.375rem;border-radius:9999px;
background:linear-gradient(to right,var(--vibeui-slider-001-accent) var(--vibeui-slider-001-fill),var(--vibeui-slider-001-track) var(--vibeui-slider-001-fill));
}
[data-vibeui-block="slider-001"] input::-webkit-slider-thumb{
appearance:none;margin-top:-0.3125rem;
width:1rem;height:1rem;border-radius:9999px;
background:var(--vibeui-slider-001-bg);border:2px solid var(--vibeui-slider-001-accent);
box-shadow:0 1px 3px oklch(0.2 0.02 265 / 25%);
}
[data-vibeui-block="slider-001"] input::-moz-range-thumb{
width:1rem;height:1rem;border-radius:9999px;box-sizing:border-box;
background:var(--vibeui-slider-001-bg);border:2px solid var(--vibeui-slider-001-accent);
}
[data-vibeui-block="slider-001"] input:focus-visible{outline:2px solid var(--vibeui-slider-001-accent);outline-offset:4px;border-radius:0.5rem}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="slider-001"] *{animation:none!important;transition:none!important}}
`
/**
* Ползунок на нативном range: закрашенная дорожка и цифра рядом с подписью.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Slider001({
label = "Бюджет проекта",
min = 10,
max = 200,
step = 5,
defaultValue = 80,
unit = " тыс. ₽",
accent,
className,
style,
...props
}: Slider001Props) {
const id = useId()
const [value, setValue] = useState(defaultValue)
const fill = `${((value - min) / (max - min)) * 100}%`
const palette = {
"--vibeui-slider-001-fill": fill,
...(accent ? { "--vibeui-slider-001-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-slider-001" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="slider-001"
className={className}
style={palette}
>
<label data-part="head" htmlFor={id}>
{label}
<span data-part="value">
{value}
{unit}
</span>
</label>
<input
id={id}
type="range"
min={min}
max={max}
step={step}
value={value}
onChange={(event) => setValue(Number(event.target.value))}
/>
<p data-part="scale">
<span>
{min}
{unit}
</span>
<span>
{max}
{unit}
</span>
</p>
</div>
</>
)
}