Avatar
Two-Line Title
A person card where the job title takes exactly two lines: the room is reserved, the tail is clipped, and a row of cards keeps one height.
- avatar
- profile
- grid
- truncation
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/avatar-030?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 "avatar-030" (Two-Line Title) 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/avatar-030.json
Registry item: https://vibeui.ru/r/avatar-030.json
Installs to: components/vibeui/avatar-030.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 person card where the job title takes exactly two lines: the room is reserved, the tail is clipped, and a row of cards keeps one height.
A person card for grids: the job title occupies exactly two lines, so cards in a row share one height whatever the text length. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Avatar030 } from "@/components/vibeui/avatar-030"
<Avatar030
name="Maria Gurova"
role="Head of customer experience"
size="md"
/>
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-avatar-030-* palette — do not swap it for your theme tokens
- the min-height of exactly two lines: without it a short title lifts the card above its neighbours
- line-clamp instead of free wrapping — a third line breaks the row
- the line height in a variable: min-height and line-height must be derived from one number
- the full title in the title attribute — truncation must not lose the meaning for good
- the card's own light surface: without it the dark text disappears on a dark background
## 6. You may change
- the name and the job title through role
- the portrait size through size — sm, md or lg
- the title line count in line-clamp together with min-height
- the card width through max-width
## 7. Rules
- Two lines is a grid decision: a standalone card needs no cap.
- The title tooltip never appears on a phone: shorten a long job title in the data, not in the layout.
- When changing the line count, edit line-clamp and min-height together or the reserve drifts from the clip.
- 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/avatar-030.jsonhttps://vibeui.ru/r/avatar-030.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-avatar-030-*. Серверный: хуков нет. Должности в реальных списках разной длины — «Дизайнер» и «Руководитель направления клиентского опыта»; свободный перенос разваливает высоту карточек в ряду, а обрезка в одну строку съедает половину смысла. Место под две строки зарезервировано min-height от переменной строки, а хвост режется -webkit-line-clamp. Полный текст остаётся в title, поэтому обрезка ничего не теряет насовсем.
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 Avatar030Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
name?: string
role?: string
size?: "sm" | "md" | "lg"
}
// Идея компонента: карточка человека для сетки, где должность занимает ровно
// две строки. Должности в реальных списках разной длины — «Дизайнер» и
// «Руководитель направления клиентского опыта»; если дать тексту течь как
// придётся, карточки в ряду встанут разной высоты, а обрезка в одну строку
// съест половину смысла. Место под две строки зарезервировано min-height, а
// хвост режется line-clamp: высота фиксирована, содержимое остаётся читаемым.
const STYLES = `
:where([data-vibeui-block="avatar-030"]){
--vibeui-avatar-030-size:3.5rem;
--vibeui-avatar-030-line:1.0625rem;
--vibeui-avatar-030-bg:oklch(1 0 0);
--vibeui-avatar-030-fg:oklch(0.24 0.014 265);
--vibeui-avatar-030-muted:oklch(0.5 0.014 265);
--vibeui-avatar-030-border:oklch(0.91 0.006 265);
--vibeui-avatar-030-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: тёмный текст обязан читаться на любом фоне. */
[data-vibeui-block="avatar-030"]{
display:flex;flex-direction:column;align-items:center;gap:0.5rem;
box-sizing:border-box;width:100%;max-width:11rem;
padding:1rem 0.875rem 1.125rem;text-align:center;
background:var(--vibeui-avatar-030-bg);
border:1px solid var(--vibeui-avatar-030-border);border-radius:1rem;
font-family:var(--vibeui-avatar-030-font);color:var(--vibeui-avatar-030-fg);
}
[data-vibeui-block="avatar-030"] *{box-sizing:border-box}
[data-vibeui-block="avatar-030"] [data-part="face"]{
display:grid;place-items:center;flex:none;
width:var(--vibeui-avatar-030-size);height:var(--vibeui-avatar-030-size);
border-radius:9999px;
background:oklch(0.9 0.06 var(--vibeui-avatar-030-hue,265));
color:oklch(0.36 0.12 var(--vibeui-avatar-030-hue,265));
font-size:calc(var(--vibeui-avatar-030-size) * 0.32);font-weight:700;line-height:1;
}
[data-vibeui-block="avatar-030"] [data-part="name"]{
width:100%;font-size:0.9375rem;font-weight:650;line-height:1.2;
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
/* Ровно две строки: место зарезервировано, хвост срезан. */
[data-vibeui-block="avatar-030"] [data-part="role"]{
display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;
width:100%;overflow:hidden;
min-height:calc(var(--vibeui-avatar-030-line) * 2);
font-size:0.75rem;line-height:var(--vibeui-avatar-030-line);
color:var(--vibeui-avatar-030-muted);
}
[data-vibeui-block="avatar-030"][data-size="sm"]{--vibeui-avatar-030-size:2.75rem;max-width:9.5rem}
[data-vibeui-block="avatar-030"][data-size="lg"]{--vibeui-avatar-030-size:4.5rem;max-width:12.5rem}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="avatar-030"] *{animation:none!important;transition:none!important}}
`
function hue(name: string) {
let hash = 2166136261
for (const symbol of name) {
hash ^= symbol.codePointAt(0)!
hash = Math.imul(hash, 16777619)
}
return ((hash >>> 0) % 12) * 30
}
function initials(name: string) {
return name
.split(" ")
.slice(0, 2)
.map((part) => part.charAt(0).toUpperCase())
.join("")
}
/**
* Карточка человека с должностью ровно в две строки: сетка не пляшет по высоте.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Avatar030({
name = "Мария Гурова",
role = "Руководитель направления клиентского опыта",
size = "md",
className,
style,
...props
}: Avatar030Props) {
const palette = {
"--vibeui-avatar-030-hue": hue(name),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-avatar-030" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="avatar-030"
data-size={size}
className={className}
style={palette}
>
<span data-part="face" aria-hidden="true">
{initials(name)}
</span>
<span data-part="name">{name}</span>
{/* Полная должность остаётся в title: обрезка не должна её терять. */}
<span data-part="role" title={role}>
{role}
</span>
</div>
</>
)
}