Badge
Solid Tone Badge
A solid badge for the one accent on screen: background and text derive from a single hue, so contrast holds in every tone.
- badge
- tone
- status
- color
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/badge-002?lang=en
Paid
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 "badge-002" (Solid Tone Badge) 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/badge-002.json
Registry item: https://vibeui.ru/r/badge-002.json
Installs to: components/vibeui/badge-002.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 solid badge for the one accent on screen: background and text derive from a single hue, so contrast holds in every tone.
A solid tone badge: five ready tones, with background and text derived from one hue in oklch. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Badge002 } from "@/components/vibeui/badge-002"
<Badge002 tone="success">Paid</Badge002>
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-badge-002-* palette — do not swap it for your theme tokens
- deriving background and text from one hue: hand-picked pairs fall apart on a new tone
- restraint in use: a solid badge on every table row turns it into a traffic light
- the tone as a data-tone attribute rather than a component per colour
- the 1.5rem height and small type — a badge must not compete with the text beside it
- white-space: nowrap: a wrapped badge reads as two badges
## 6. You may change
- the badge text
- tone — neutral, success, warning, danger or info
- size — sm or md
- the hues for your status palette
## 7. Rules
- For tables use badge-001: there only the dot carries colour and twenty rows stay readable.
- A new tone is two variables in a data-tone rule, not a new component.
- The badge is not clickable: filter chips are badge-011.
- 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/badge-002.jsonhttps://vibeui.ru/r/badge-002.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-badge-002-*. Серверный: хуков нет. Тон — это две переменные, оттенок и насыщенность; светлота фона и текста выводится из них в oklch, поэтому новый тон добавляется одной строкой и контраст не приходится подбирать вручную. Тон переключается атрибутом data-tone.
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 Badge002Tone = "neutral" | "success" | "warning" | "danger" | "info"
export type Badge002Props = ComponentPropsWithoutRef<"span"> & {
tone?: Badge002Tone
size?: "sm" | "md"
}
// Идея компонента: залитая плашка для одного акцента на экране. В отличие от
// соседа с цветной точкой она кричит намеренно — ею помечают одно, а не
// каждую строку таблицы. Текст на заливке взят из того же тона с другой
// светлотой, поэтому контраст держится в любом оттенке.
const STYLES = `
:where([data-vibeui-block="badge-002"]){
--vibeui-badge-002-hue:265;
--vibeui-badge-002-chroma:0.03;
--vibeui-badge-002-bg:oklch(0.93 var(--vibeui-badge-002-chroma) var(--vibeui-badge-002-hue));
--vibeui-badge-002-fg:oklch(0.36 calc(var(--vibeui-badge-002-chroma) * 2.2) var(--vibeui-badge-002-hue));
--vibeui-badge-002-radius:0.4375rem;
--vibeui-badge-002-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="badge-002"]{
display:inline-flex;align-items:center;
height:1.5rem;padding:0 0.5625rem;
border-radius:var(--vibeui-badge-002-radius);
background:var(--vibeui-badge-002-bg);color:var(--vibeui-badge-002-fg);
font-family:var(--vibeui-badge-002-font);font-size:0.75rem;font-weight:600;
line-height:1;white-space:nowrap;vertical-align:middle;
}
[data-vibeui-block="badge-002"][data-size="sm"]{height:1.25rem;padding:0 0.4375rem;font-size:0.6875rem}
/* Тон — это два числа: оттенок и насыщенность. Светлота фона и текста
считается из них, поэтому контраст не приходится подбирать вручную. */
[data-vibeui-block="badge-002"][data-tone="success"]{--vibeui-badge-002-hue:152;--vibeui-badge-002-chroma:0.06}
[data-vibeui-block="badge-002"][data-tone="warning"]{--vibeui-badge-002-hue:75;--vibeui-badge-002-chroma:0.07}
[data-vibeui-block="badge-002"][data-tone="danger"]{--vibeui-badge-002-hue:25;--vibeui-badge-002-chroma:0.07}
[data-vibeui-block="badge-002"][data-tone="info"]{--vibeui-badge-002-hue:250;--vibeui-badge-002-chroma:0.06}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="badge-002"] *{animation:none!important;transition:none!important}}
`
/**
* Залитая плашка тона: фон и текст считаются из одного оттенка.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Badge002({
tone = "success",
size = "md",
className,
style,
children = "Оплачено",
...props
}: Badge002Props) {
return (
<>
<style href="vibeui-badge-002" precedence="medium">
{STYLES}
</style>
<span
{...props}
data-vibeui-block="badge-002"
data-tone={tone}
data-size={size}
className={className}
style={style as CSSProperties}
>
{children}
</span>
</>
)
}