Badge
Tag Row
A row of tags on one line: the tail folds into a counter while the full list goes to screen readers and a tooltip.
- badge
- tags
- overflow
- table
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-009?lang=en
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-009" (Tag Row) 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-009.json
Registry item: https://vibeui.ru/r/badge-009.json
Installs to: components/vibeui/badge-009.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 row of tags on one line: the tail folds into a counter while the full list goes to screen readers and a tooltip.
A tag row for a table cell: visible chips, a counter for the hidden ones and the complete list for screen readers. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Badge009 } from "@/components/vibeui/badge-009"
<Badge009 items={["design", "catalog", "urgent"]} visible={3} />
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-009-* palette — do not swap it for your theme tokens
- the no-wrap rule: a row inside a table row must stay one line
- the counter instead of every tag — a record can carry ten
- the full list in the group's aria-label with aria-hidden on the chips
- truncating a long tag with an ellipsis rather than shrinking the type
- the hidden tags listed in the counter's title
## 6. You may change
- the items array and the visible count
- label — the group's name
- the chip colours for your palette
- the height and radius
## 7. Rules
- title only appears on mouse hover: on a phone the hidden tags need another way out.
- Pick the visible count for the column width, not at random: two tags beat four truncated ones.
- For removable tags use badge-005; this row only displays.
- 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-009.jsonhttps://vibeui.ru/r/badge-009.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-badge-009-*. Серверный: хуков нет. Ряд не переносится: плашки режутся многоточием, а скрытые сворачиваются в «+N» с полным списком в title. Группа объявлена role="group" с aria-label из всех меток, сами плашки помечены aria-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 Badge009Props = Omit<
ComponentPropsWithoutRef<"span">,
"children"
> & {
items?: string[]
visible?: number
label?: string
}
// Идея компонента: ряд плашек, который не переносится на вторую строку. Хвост
// сворачивается в «+3», а полный список уходит в title и в подпись для
// скринридера: в строке таблицы место одно, а тегов у записи бывает десять.
const STYLES = `
:where([data-vibeui-block="badge-009"]){
--vibeui-badge-009-bg:oklch(0.96 0.004 265);
--vibeui-badge-009-fg:oklch(0.32 0.014 265);
--vibeui-badge-009-border:oklch(0.89 0.006 265);
--vibeui-badge-009-muted:oklch(0.52 0.014 265);
--vibeui-badge-009-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="badge-009"]{
display:inline-flex;align-items:center;gap:0.3125rem;
max-width:100%;vertical-align:middle;
font-family:var(--vibeui-badge-009-font);
}
[data-vibeui-block="badge-009"] [data-part="item"]{
display:inline-flex;align-items:center;flex:0 1 auto;min-width:0;
height:1.5rem;padding:0 0.5625rem;
border:1px solid var(--vibeui-badge-009-border);border-radius:9999px;
background:var(--vibeui-badge-009-bg);color:var(--vibeui-badge-009-fg);
font-size:0.75rem;line-height:1;
/* Плашка режется многоточием, а не переносится: ряд обязан остаться рядом. */
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="badge-009"] [data-part="more"]{
display:inline-flex;align-items:center;flex:none;
height:1.5rem;padding:0 0.5rem;border-radius:9999px;
background:transparent;color:var(--vibeui-badge-009-muted);
font-size:0.75rem;font-weight:600;font-variant-numeric:tabular-nums;line-height:1;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="badge-009"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_ITEMS = [
"дизайн",
"фронтенд",
"каталог",
"срочно",
"релиз",
"документация",
]
/**
* Ряд плашек в одну строку: хвост сворачивается в счётчик.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Badge009({
items = DEFAULT_ITEMS,
visible = 3,
label = "Метки",
className,
style,
...props
}: Badge009Props) {
const shown = items.slice(0, Math.max(1, visible))
const rest = items.length - shown.length
return (
<>
<style href="vibeui-badge-009" precedence="medium">
{STYLES}
</style>
<span
{...props}
data-vibeui-block="badge-009"
className={className}
style={style as CSSProperties}
role="group"
aria-label={`${label}: ${items.join(", ")}`}
>
{shown.map((item) => (
<span key={item} data-part="item" aria-hidden="true">
{item}
</span>
))}
{rest > 0 ? (
<span
data-part="more"
aria-hidden="true"
title={items.slice(shown.length).join(", ")}
>
+{rest}
</span>
) : null}
</span>
</>
)
}