Display
Threshold Alert Bar
A bar with the threshold drawn on the track itself: below it the bar stays calm, above it the fill changes colour, gains hatching and drops a warning into a role="status" region.
- progress
- threshold
- quota
- display
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/progress-006?lang=en
Порог превышен на 18 тыс. запросов. Дальнейшие вызовы тарифицируются сверх плана.
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 "progress-006" (Threshold Alert Bar) 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/progress-006.json
Registry item: https://vibeui.ru/r/progress-006.json
Installs to: components/vibeui/progress-006.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 bar with the threshold drawn on the track itself: below it the bar stays calm, above it the fill changes colour, gains hatching and drops a warning into a role="status" region.
A bar with a threshold: the plan notch sits on the track, the fill gains hatching when exceeded and a live status region carries the warning. Zero dependencies, one file, server rendered.
## 3. How to use it
import { Progress006 } from "@/components/vibeui/progress-006"
<Progress006 value={118} threshold={100} limit={140} label="API quota usage" />
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-progress-006-* palette — do not swap it for your theme tokens
- the threshold notch inside the track: a caption beside it does not show where the plan actually ends
- the hatching on overflow — colour alone fails for colour blindness and in monochrome
- the role="status" on the warning and hiding it with hidden rather than removing the node, or the announcement never fires
- the aria-valuetext that names both the usage and the threshold in one phrase
- the card's own light surface: without it the dark text disappears on a dark background
## 6. You may change
- the current usage through value and the limit line through threshold
- the top of the scale through limit
- the heading through label
- the calm and alarm colours through the palette variables
## 7. Rules
- The threshold is expressed in scale units, not percent: changing limit repositions it automatically.
- A value above limit pins to the end of the track — the scale itself stops reporting the overshoot, the text does.
- The warning copy is written about API requests: rewrite it together with the unit for another metric.
- 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/progress-006.jsonhttps://vibeui.ru/r/progress-006.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-progress-006-*. Серверный: хуков нет, состояние превышения выводится сравнением value и threshold. Засечка порога — абсолютный элемент внутри дорожки на left от переменной, поэтому она стоит там же, где заканчивается план, а не в подписи сбоку. Превышение помечено атрибутом data-over на корне: он переключает и цвет заливки, и штриховку repeating-linear-gradient, и показ блока предупреждения. Штриховка нужна, потому что «стало красным» не читается без цвета. Предупреждение объявлено role="status" и скрыто атрибутом hidden, а не удалено из разметки: живая область должна существовать до того, как в ней появится текст.
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 Progress006Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
/** Текущий расход в единицах плана, а не в процентах. */
value?: number
/** Порог, после которого включается предупреждение. */
threshold?: number
limit?: number
label?: string
}
// Идея компонента: у полосы есть порог, и он нарисован прямо на дорожке
// засечкой. Пока расход ниже — полоса спокойная; выше — она меняет цвет,
// получает штриховку и роняет строку предупреждения в role="status".
// Штриховка нужна, потому что «стало красным» не читается без цвета.
const STYLES = `
:where([data-vibeui-block="progress-006"]){
--vibeui-progress-006-bg:oklch(1 0 0);
--vibeui-progress-006-fg:oklch(0.25 0.016 265);
--vibeui-progress-006-muted:oklch(0.56 0.014 265);
--vibeui-progress-006-border:oklch(0.9 0.006 265);
--vibeui-progress-006-track:oklch(0.93 0.005 265);
--vibeui-progress-006-accent:oklch(0.58 0.16 155);
--vibeui-progress-006-alarm:oklch(0.58 0.19 28);
--vibeui-progress-006-value:0;
--vibeui-progress-006-mark:0;
--vibeui-progress-006-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="progress-006"]{
display:flex;flex-direction:column;gap:0.625rem;
width:100%;max-width:26rem;box-sizing:border-box;padding:1rem 1.125rem;
background:var(--vibeui-progress-006-bg);
border:1px solid var(--vibeui-progress-006-border);border-radius:0.875rem;
font-family:var(--vibeui-progress-006-font);color:var(--vibeui-progress-006-fg);
}
[data-vibeui-block="progress-006"] [data-part="head"]{
display:flex;align-items:baseline;justify-content:space-between;gap:0.75rem;
font-size:0.8125rem;font-weight:650;
}
[data-vibeui-block="progress-006"] [data-part="amount"]{
font-weight:500;color:var(--vibeui-progress-006-muted);font-variant-numeric:tabular-nums;
}
[data-vibeui-block="progress-006"] [data-part="track"]{
position:relative;height:0.625rem;border-radius:9999px;overflow:hidden;
background:var(--vibeui-progress-006-track);
}
[data-vibeui-block="progress-006"] [data-part="bar"]{
height:100%;border-radius:inherit;
width:calc(var(--vibeui-progress-006-value) * 1%);
background:var(--vibeui-progress-006-accent);
transition:width .3s cubic-bezier(.32,.72,0,1),background-color .2s ease;
}
/* Превышение читается и без цвета: заливка получает штриховку. */
[data-vibeui-block="progress-006"][data-over="true"] [data-part="bar"]{
background-color:var(--vibeui-progress-006-alarm);
background-image:repeating-linear-gradient(135deg,oklch(1 0 0 / 28%) 0 4px,transparent 4px 8px);
}
/* Порог — засечка на самой дорожке: подпись сбоку не показывает, где он. */
[data-vibeui-block="progress-006"] [data-part="mark"]{
position:absolute;top:0;bottom:0;
left:calc(var(--vibeui-progress-006-mark) * 1%);
width:2px;margin-left:-1px;background:var(--vibeui-progress-006-fg);
}
[data-vibeui-block="progress-006"] [data-part="scale"]{
display:flex;justify-content:space-between;gap:0.75rem;
font-size:0.6875rem;color:var(--vibeui-progress-006-muted);
font-variant-numeric:tabular-nums;
}
[data-vibeui-block="progress-006"] [data-part="alert"]{
display:flex;align-items:flex-start;gap:0.5rem;
padding:0.5rem 0.625rem;border-radius:0.5rem;
background:oklch(0.96 0.03 28);color:oklch(0.44 0.16 28);
font-size:0.75rem;line-height:1.35;
}
[data-vibeui-block="progress-006"] [data-part="alert"] strong{font-weight:700}
[data-vibeui-block="progress-006"] [data-part="sign"]{
flex:none;display:grid;place-items:center;
width:1rem;height:1rem;border-radius:9999px;
background:var(--vibeui-progress-006-alarm);color:oklch(1 0 0);
font-size:0.6875rem;font-weight:800;line-height:1;
}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="progress-006"] *{animation:none!important;transition:none!important}
}
`
/**
* Полоса с порогом на дорожке и предупреждением на превышении.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Progress006({
value = 118,
threshold = 100,
limit = 140,
label = "Расход API-квоты",
className,
style,
...props
}: Progress006Props) {
const scale = Math.max(1, limit)
const used = Math.max(0, value)
const percent = Math.min(100, (used / scale) * 100)
const mark = Math.min(100, Math.max(0, (threshold / scale) * 100))
const over = used > threshold
const palette = {
"--vibeui-progress-006-value": percent,
"--vibeui-progress-006-mark": mark,
...style,
} as CSSProperties
return (
<>
<style href="vibeui-progress-006" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="progress-006"
data-over={over || undefined}
className={className}
style={palette}
>
<div data-part="head">
<span>{label}</span>
<span data-part="amount">
{used} / {threshold} тыс. запросов
</span>
</div>
<div
data-part="track"
role="progressbar"
aria-label={label}
aria-valuemin={0}
aria-valuemax={scale}
aria-valuenow={used}
aria-valuetext={`${used} тысяч запросов при пороге ${threshold} тысяч`}
>
<div data-part="bar" />
<span data-part="mark" aria-hidden="true" />
</div>
<div data-part="scale">
<span>0</span>
<span>порог {threshold}</span>
<span>{scale}</span>
</div>
<p data-part="alert" role="status" hidden={!over}>
<span data-part="sign" aria-hidden="true">
!
</span>
<span>
Порог превышен на{" "}
<strong>{Math.max(0, used - threshold)} тыс.</strong> запросов.
Дальнейшие вызовы тарифицируются сверх плана.
</span>
</p>
</div>
</>
)
}