Badge

Plan Badge

A plan badge where the tier is read from the number of diamonds rather than colour saturation — including on a black-and-white invoice.

  • badge
  • plan
  • pricing
  • tier

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/badge-019?lang=en

Pro
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-019" (Plan 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-019.json

Registry item: https://vibeui.ru/r/badge-019.json
Installs to: components/vibeui/badge-019.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 plan badge where the tier is read from the number of diamonds rather than colour saturation — including on a black-and-white invoice.

A plan badge that conveys the tier through a count of diamonds, not just a fill colour. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Badge019 } from "@/components/vibeui/badge-019"

<Badge019 plan="business" label="Business" />

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-019-* palette — do not swap it for your theme tokens
- the diamond count as the tier marker: colour does not convey "higher or lower"
- the LEVELS map: it is the only place where the plan order lives
- the diamonds under aria-hidden — the tier is already named by the caption
- the caption contrast on the gradient: light text on gold is unreadable
- the rectangular radius instead of a pill: a plan is not a status, and the shape says so

## 6. You may change
- the plan through plan
- the caption through label
- the plan colours in the data-plan rules
- the number of tiers in the LEVELS map

## 7. Rules
- The caption is not derived from the plan: label is passed separately, otherwise localisation hits the code.
- There are three plans: a fourth needs both a LEVELS entry and a data-plan rule, or the badge stays neutral.
- The dark business fill assumes a light page — check the border contrast on a dark surface.
- 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-019.json
https://vibeui.ru/r/badge-019.json

Один файл, ноль зависимостей, палитра в локальных переменных --vibeui-badge-019-*. Серверный: хуков нет. Карта LEVELS переводит план в число знаков, и ромбы рисуются массивом: free — ноль, pro — один, business — два. Ромб сделан clip-path из квадрата, поэтому не требует ни SVG, ни шрифта. Атрибут data-plan меняет палитру и заливку: у pro — светлый золотой градиент, у business — тёмный. Форма знака отличает уровни там, где цвет теряется: на распечатке счёта или на скриншоте в поддержке.

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 Badge019Plan = "free" | "pro" | "business"

export type Badge019Props = ComponentPropsWithoutRef<"span"> & {
  plan?: Badge019Plan
  label?: string
}

// Идея компонента: метка тарифа, в которой старшинство читается количеством
// ромбов, а не насыщенностью цвета. Тарифы выстроены в ряд, и пользователю
// важно не «какой он», а «выше или ниже соседнего»: цвет такой порядок не
// передаёт, а два ромба против одного — передают, в том числе в чёрно-белой
// печати счёта.
const STYLES = `
:where([data-vibeui-block="badge-019"]){
--vibeui-badge-019-bg:oklch(0.97 0.004 265);
--vibeui-badge-019-fg:oklch(0.38 0.014 265);
--vibeui-badge-019-border:oklch(0.88 0.006 265);
--vibeui-badge-019-mark:oklch(0.6 0.02 265);
--vibeui-badge-019-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="badge-019"]{
display:inline-flex;align-items:center;gap:0.375rem;
box-sizing:border-box;height:1.75rem;padding:0 0.6875rem;
border:1px solid var(--vibeui-badge-019-border);border-radius:0.5rem;
background:var(--vibeui-badge-019-bg);color:var(--vibeui-badge-019-fg);
font-family:var(--vibeui-badge-019-font);font-size:0.6875rem;font-weight:700;line-height:1;
letter-spacing:0.07em;text-transform:uppercase;vertical-align:middle;
}
[data-vibeui-block="badge-019"][data-plan="pro"]{
--vibeui-badge-019-fg:oklch(0.36 0.07 75);
--vibeui-badge-019-border:oklch(0.82 0.09 80);
--vibeui-badge-019-mark:oklch(0.66 0.14 78);
background:linear-gradient(135deg,oklch(0.96 0.05 85),oklch(0.91 0.09 78));
}
[data-vibeui-block="badge-019"][data-plan="business"]{
--vibeui-badge-019-fg:oklch(0.97 0.01 265);
--vibeui-badge-019-border:oklch(0.42 0.05 265);
--vibeui-badge-019-mark:oklch(0.86 0.09 85);
background:linear-gradient(135deg,oklch(0.32 0.03 265),oklch(0.24 0.03 275));
}
[data-vibeui-block="badge-019"] [data-part="marks"]{
display:inline-flex;align-items:center;gap:0.1875rem;flex:none;
}
[data-vibeui-block="badge-019"] [data-part="mark"]{
width:0.375rem;height:0.375rem;
background:var(--vibeui-badge-019-mark);
/* Ромб, а не точка: старшинство должно отличаться и формой знака. */
clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="badge-019"] *{animation:none!important;transition:none!important}}
`

const LEVELS: Record<Badge019Plan, number> = { free: 0, pro: 1, business: 2 }

/**
 * Метка тарифа: старшинство плана считывается числом ромбов.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Badge019({
  plan = "pro",
  label = "Pro",
  className,
  style,
  ...props
}: Badge019Props) {
  const level = LEVELS[plan]

  return (
    <>
      <style href="vibeui-badge-019" precedence="medium">
        {STYLES}
      </style>
      <span
        {...props}
        data-vibeui-block="badge-019"
        data-plan={plan}
        className={className}
        style={style as CSSProperties}
      >
        {label}
        {level > 0 ? (
          <span data-part="marks" aria-hidden="true">
            {Array.from({ length: level }, (_, index) => (
              <span key={index} data-part="mark" />
            ))}
          </span>
        ) : null}
      </span>
    </>
  )
}