Avatar
Team Ring
An avatar in a team-coloured ring: the colour is derived from the team name rather than the person's, so every colleague shares it and it changes when they move.
- avatar
- team
- ring
- colour
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-032?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-032" (Team Ring) 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-032.json
Registry item: https://vibeui.ru/r/avatar-032.json
Installs to: components/vibeui/avatar-032.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 avatar in a team-coloured ring: the colour is derived from the team name rather than the person's, so every colleague shares it and it changes when they move.
An avatar in a team-coloured ring: the hue comes from the team name, the ring is cut with a mask and the team is named on a chip. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Avatar032 } from "@/components/vibeui/avatar-032"
<Avatar032 name="Pyotr Gai" team="Platform" 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-032-* palette — do not swap it for your theme tokens
- deriving the hue from the team name, not the person's: colleagues must share one ring colour
- the deterministic hue function: a random colour would change on every render
- the chip with the team name: a ring colour without a legend decodes to nothing, and lists carry no legend
- the radial mask cut-out instead of a background-coloured ring — the gap must hold on any surface
- the name and the team in words in the hidden caption: a screen reader does not read ring colour
## 6. You may change
- the name and the team name through team
- the size through size — sm, md or lg
- the hue formula if you already have team colours
- the ring thickness and gap in the ring and gap variables
## 7. Rules
- The hue comes from the name: rename the team and the colour changes — that is the price of having no dictionary.
- Twelve hues: beyond that teams start sharing colours, and you need an explicit dictionary.
- Team colour and presence colour mean different things: do not merge them into one ring.
- 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-032.jsonhttps://vibeui.ru/r/avatar-032.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-avatar-032-*. Серверный: хуков нет. Оттенок рамки считается детерминированной функцией FNV-1a из названия команды, а не из имени человека: люди переходят между командами, и рамка обязана меняться вместе с ними, оставаясь одинаковой у всех коллег. Кольцо вырезано radial-маской, поэтому зазор держится и на светлой, и на тёмной подложке. Название команды подписано плашкой под портретом: цвет рамки без легенды не расшифровывается, а легенды в списках обычно нет.
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 Avatar032Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
name?: string
team?: string
size?: "sm" | "md" | "lg"
}
// Идея компонента: аватар в рамке цвета команды. Цвет считается из названия
// команды, а не из имени человека: люди переходят между командами, и рамка
// обязана меняться вместе с ними, оставаясь одинаковой у всех коллег. Кольцо
// вырезано radial-маской, поэтому зазор держится и на светлой, и на тёмной
// подложке. Название команды подписано плашкой под портретом: цвет рамки без
// легенды не расшифровывается, а легенды в списках обычно нет.
const STYLES = `
:where([data-vibeui-block="avatar-032"]){
--vibeui-avatar-032-size:3rem;
--vibeui-avatar-032-ring:0.1875rem;
--vibeui-avatar-032-gap:0.1875rem;
--vibeui-avatar-032-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="avatar-032"]{
display:inline-flex;flex-direction:column;align-items:center;gap:0.375rem;
box-sizing:border-box;font-family:var(--vibeui-avatar-032-font);
}
[data-vibeui-block="avatar-032"] *{box-sizing:border-box}
[data-vibeui-block="avatar-032"] [data-part="slot"]{
position:relative;display:grid;place-items:center;
width:calc(var(--vibeui-avatar-032-size) + (var(--vibeui-avatar-032-ring) + var(--vibeui-avatar-032-gap)) * 2);
height:calc(var(--vibeui-avatar-032-size) + (var(--vibeui-avatar-032-ring) + var(--vibeui-avatar-032-gap)) * 2);
}
/* Кольцо вырезано маской: зазор не зависит от цвета подложки. */
[data-vibeui-block="avatar-032"] [data-part="ring"]{
position:absolute;inset:0;border-radius:9999px;
background:oklch(0.58 0.17 var(--vibeui-avatar-032-team,265));
mask-image:radial-gradient(circle closest-side,transparent calc(100% - var(--vibeui-avatar-032-ring)),#000 calc(100% - var(--vibeui-avatar-032-ring)));
}
[data-vibeui-block="avatar-032"] [data-part="face"]{
display:grid;place-items:center;
width:var(--vibeui-avatar-032-size);height:var(--vibeui-avatar-032-size);
border-radius:9999px;
background:oklch(0.9 0.06 var(--vibeui-avatar-032-hue,265));
color:oklch(0.36 0.12 var(--vibeui-avatar-032-hue,265));
font-size:calc(var(--vibeui-avatar-032-size) * 0.34);font-weight:700;line-height:1;
}
/* Плашка словом: цвет рамки без легенды не расшифровывается. */
[data-vibeui-block="avatar-032"] [data-part="team"]{
max-width:8rem;padding:0.125rem 0.4375rem;border-radius:9999px;
background:oklch(0.94 0.045 var(--vibeui-avatar-032-team,265));
color:oklch(0.38 0.11 var(--vibeui-avatar-032-team,265));
font-size:0.6875rem;font-weight:650;line-height:1.4;
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="avatar-032"][data-size="sm"]{--vibeui-avatar-032-size:2.25rem}
[data-vibeui-block="avatar-032"][data-size="lg"]{--vibeui-avatar-032-size:4rem;--vibeui-avatar-032-ring:0.25rem;--vibeui-avatar-032-gap:0.25rem}
[data-vibeui-block="avatar-032"] [data-part="sr"]{
position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="avatar-032"] *{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 Avatar032({
name = "Пётр Гай",
team = "Платформа",
size = "md",
className,
style,
...props
}: Avatar032Props) {
const palette = {
"--vibeui-avatar-032-hue": hue(name),
"--vibeui-avatar-032-team": hue(team),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-avatar-032" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="avatar-032"
data-size={size}
className={className}
style={palette}
>
<span data-part="slot">
<span data-part="ring" aria-hidden="true" />
<span data-part="face" aria-hidden="true">
{initials(name)}
</span>
<span data-part="sr">
{name}, команда «{team}»
</span>
</span>
<span data-part="team" aria-hidden="true">
{team}
</span>
</div>
</>
)
}