Inputs
Readonly Overflow
A read-only tag list with a hidden counter: a silently truncated list reads as complete, and "+3" fixes that.
- tags
- readonly
- overflow
- list
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/tags-007?lang=en
Listing labels
- макбук
- 16 дюймов
- 2024
- гарантия
- +3
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 "tags-007" (Readonly Overflow) 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/tags-007.json
Registry item: https://vibeui.ru/r/tags-007.json
Installs to: components/vibeui/tags-007.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 read-only tag list with a hidden counter: a silently truncated list reads as complete, and "+3" fixes that.
A read-only tag display: the first N are shown, the rest collapse into a counter that lists them in its tooltip. Server component, zero dependencies, one file.
## 3. How to use it
import { Tags007 } from "@/components/vibeui/tags-007"
<Tags007 label="Listing labels" tags={["macbook", "2024", "warranty", "negotiable"]} visible={4} />
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-tags-007-* palette — do not swap it for your theme tokens
- its own light surface: the list gets shown over any background
- the hidden counter: a silently truncated list reads as complete and misrepresents the data
- listing the hidden tags in title and aria-label: what is collapsed must stay reachable by mouse and by screen reader
- the ul and li markup: this is an enumeration and the item count has to be announced
- the absence of interactive elements: a display must not pretend to be an input
- the server nature of the component — no state is needed here
## 6. You may change
- label — the heading above the list
- tags — the label list itself
- visible — how many tags to show before collapsing
- the styling of the chips and the counter
- the accent through the accent prop
## 7. Rules
- The title attribute only appears on mouse hover: on a phone the hidden tags stay unreachable.
- With many hidden tags, link to a separate page instead of growing the tooltip.
- Tune visible to the card width: once the row wraps, collapsing loses its point.
- 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/tags-007.jsonhttps://vibeui.ru/r/tags-007.jsonКомпонент самодостаточен: один файл, ноль зависимостей, палитра в локальных переменных --vibeui-tags-007-*. Серверный: раскрывать список некуда, это витрина, а не форма. Видимые теги показаны обычным ul, а лишние свёрнуты в счётчик «+N»; их названия перечислены в title и aria-label, поэтому скрытое можно узнать наведением и услышать скринридером. Разметка списком, а не набором span: это перечисление, и скринридер должен назвать число элементов.
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 Tags007Props = Omit<
ComponentPropsWithoutRef<"div">,
"children" | "defaultValue"
> & {
label?: string
tags?: string[]
visible?: number
accent?: string
}
// Идея компонента: список тегов только для чтения, где лишние честно сосчитаны.
// В карточке товара или задачи места на все метки нет, а обрезать список молча
// нельзя: пользователь решит, что тегов ровно столько. Поэтому видимые чипы
// показаны, а остальные свёрнуты в «+3», и скрытые перечислены в title и
// aria-label — их можно узнать наведением и услышать скринридером. Компонент
// серверный: раскрывать список некуда, это витрина, а не форма.
const STYLES = `
:where([data-vibeui-block="tags-007"]){
--vibeui-tags-007-surface:oklch(1 0 0);
--vibeui-tags-007-shell:oklch(0.9 0.006 265);
--vibeui-tags-007-fg:oklch(0.23 0.014 265);
--vibeui-tags-007-muted:oklch(0.55 0.014 265);
--vibeui-tags-007-border:oklch(0.88 0.008 265);
--vibeui-tags-007-chip:oklch(0.96 0.004 265);
--vibeui-tags-007-accent:oklch(0.5 0.15 265);
--vibeui-tags-007-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: список показывают поверх любого фона. */
[data-vibeui-block="tags-007"]{
display:flex;flex-direction:column;gap:0.375rem;
width:100%;max-width:20rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-tags-007-surface);
border:1px solid var(--vibeui-tags-007-shell);border-radius:0.875rem;
font-family:var(--vibeui-tags-007-font);color:var(--vibeui-tags-007-fg);
}
[data-vibeui-block="tags-007"] [data-part="label"]{
margin:0;font-size:0.6875rem;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;
color:var(--vibeui-tags-007-muted);
}
/* Список семантический: это перечисление, а не набор кнопок. */
[data-vibeui-block="tags-007"] ul{
display:flex;flex-wrap:wrap;gap:0.375rem;margin:0;padding:0;list-style:none;
}
[data-vibeui-block="tags-007"] li{
display:inline-flex;align-items:center;
height:1.75rem;padding:0 0.625rem;border-radius:0.4375rem;
background:var(--vibeui-tags-007-chip);
font-size:0.8125rem;
}
/* Счётчик скрытых: молча обрезанный список читается как полный. */
[data-vibeui-block="tags-007"] li[data-part="more"]{
background:none;border:1px dashed var(--vibeui-tags-007-border);
color:var(--vibeui-tags-007-accent);font-weight:700;cursor:help;
font-variant-numeric:tabular-nums;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="tags-007"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_TAGS = [
"макбук",
"16 дюймов",
"2024",
"гарантия",
"с коробкой",
"торг",
"самовывоз",
]
/**
* Список тегов только для чтения со счётчиком скрытых и их перечислением.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Tags007({
label = "Метки объявления",
tags = DEFAULT_TAGS,
visible = 4,
accent,
className,
style,
...props
}: Tags007Props) {
const shown = tags.slice(0, visible)
const hidden = tags.slice(visible)
const palette = {
...(accent ? { "--vibeui-tags-007-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-tags-007" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="tags-007"
className={className}
style={palette}
>
<p data-part="label">{label}</p>
<ul>
{shown.map((tag) => (
<li key={tag}>{tag}</li>
))}
{hidden.length > 0 ? (
<li
data-part="more"
title={hidden.join(", ")}
aria-label={`Ещё ${hidden.length}: ${hidden.join(", ")}`}
>
+{hidden.length}
</li>
) : null}
</ul>
</div>
</>
)
}