Badge

Outline Badge

An outline badge: border, text and surface are all derived from one hue, and a dashed line separates a draft from a published item.

  • badge
  • outline
  • hue
  • draft

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-014?lang=en

Published
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-014" (Outline 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-014.json

Registry item: https://vibeui.ru/r/badge-014.json
Installs to: components/vibeui/badge-014.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
An outline badge: border, text and surface are all derived from one hue, and a dashed line separates a draft from a published item.

An outline badge whose whole palette is derived from a single hue, with a dashed border marking a provisional state. Zero dependencies, one file, no client JS.

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

<Badge014 hue={150} dashed={false}>
  Published
</Badge014>

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-014-* palette — do not swap it for your theme tokens
- the light surface instead of a transparent one: otherwise dark text disappears on a dark background
- deriving every colour from one hue: hand-picked colours drift apart at the first edit
- the dashed border as the draft marker: it reads where colour does not
- the 1.5px border width — at 1px the outline is lost next to filled neighbours
- the leading dot: in the dashed variant it is hollow and repeats what the border says

## 6. You may change
- the hue through hue
- the dashed border through dashed
- the caption through children
- the badge height and radius in the block rules

## 7. Rules
- hue is a number of degrees, not a colour: it is taken modulo 360, and "#4f46e5" will not work here.
- Chroma is fixed: very pale brand hues have to be edited in the rules themselves.
- The dash and the colour carry the same meaning — do not assign them different states.
- 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-014.json
https://vibeui.ru/r/badge-014.json

Один файл, ноль зависимостей, палитра в локальных переменных --vibeui-badge-014-*. Серверный: хуков нет. Всё оформление выводится из одного числа: проп hue кладётся в --vibeui-badge-014-hue инлайновым стилем, а рамка, текст и подложка собираются функцией oklch с этим оттенком — палитру не нужно вести таблицей. Подложка намеренно не прозрачная: на тёмной карточке каталога прозрачный фон оставил бы тёмный текст на тёмном. Флаг dashed переводит рамку в пунктир и приглушает тон, поэтому черновик отличается от финального формой линии, а не только цветом.

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 Badge014Props = ComponentPropsWithoutRef<"span"> & {
  hue?: number
  dashed?: boolean
}

// Идея компонента: плашка на обводке, а не на заливке. Весь набор цветов
// считается из одного числа — оттенка: рамка насыщенная, текст тёмный,
// подложка того же тона в восьми процентах. Пунктирная рамка отдана
// предварительным состояниям: «черновик» отличается от «опубликовано»
// формой линии, а не только цветом.
const STYLES = `
:where([data-vibeui-block="badge-014"]){
--vibeui-badge-014-hue:265;
--vibeui-badge-014-line:oklch(0.62 0.13 var(--vibeui-badge-014-hue));
--vibeui-badge-014-fg:oklch(0.42 0.12 var(--vibeui-badge-014-hue));
/* Плашка несёт собственную светлую подложку: на тёмной карточке каталога
   прозрачный фон оставил бы тёмный текст на тёмном. */
--vibeui-badge-014-bg:oklch(0.98 0.012 var(--vibeui-badge-014-hue));
--vibeui-badge-014-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="badge-014"]{
display:inline-flex;align-items:center;gap:0.375rem;
box-sizing:border-box;height:1.75rem;padding:0 0.6875rem;
border:1.5px solid var(--vibeui-badge-014-line);border-radius:9999px;
background:var(--vibeui-badge-014-bg);color:var(--vibeui-badge-014-fg);
font-family:var(--vibeui-badge-014-font);font-size:0.75rem;font-weight:600;line-height:1;
letter-spacing:0.005em;vertical-align:middle;
}
[data-vibeui-block="badge-014"][data-dashed="true"]{
border-style:dashed;
/* У черновика тон приглушён: рамка кричит меньше, чем у финального. */
--vibeui-badge-014-line:oklch(0.72 0.06 var(--vibeui-badge-014-hue));
--vibeui-badge-014-fg:oklch(0.5 0.05 var(--vibeui-badge-014-hue));
}
[data-vibeui-block="badge-014"] [data-part="dot"]{
width:0.375rem;height:0.375rem;flex:none;border-radius:9999px;
background:var(--vibeui-badge-014-line);
}
[data-vibeui-block="badge-014"][data-dashed="true"] [data-part="dot"]{
background:transparent;box-shadow:inset 0 0 0 1.5px var(--vibeui-badge-014-line);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="badge-014"] *{animation:none!important;transition:none!important}}
`

/**
 * Плашка на обводке: вся палитра выводится из одного оттенка.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Badge014({
  hue = 265,
  dashed = false,
  className,
  style,
  children = "Опубликовано",
  ...props
}: Badge014Props) {
  const palette = {
    "--vibeui-badge-014-hue": String(Math.round(hue) % 360),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-badge-014" precedence="medium">
        {STYLES}
      </style>
      <span
        {...props}
        data-vibeui-block="badge-014"
        data-dashed={dashed}
        className={className}
        style={palette}
      >
        <span data-part="dot" aria-hidden="true" />
        {children}
      </span>
    </>
  )
}