Avatar
Level Ring
An avatar with a level: the ring is split into ten segments so progress can be counted by eye, and the level number sits in a hexagon under the portrait.
- avatar
- level
- progress
- gamification
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-025?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-025" (Level 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-025.json
Registry item: https://vibeui.ru/r/avatar-025.json
Installs to: components/vibeui/avatar-025.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 with a level: the ring is split into ten segments so progress can be counted by eye, and the level number sits in a hexagon under the portrait.
An avatar with a level and a rank: a ten-segment ring built from repeating-conic-gradient, the level number in a hexagon and the rank in words. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Avatar025 } from "@/components/vibeui/avatar-025"
<Avatar025 name="Pyotr Gai" level={7} progress={60} rank="silver" />
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-025-* palette — do not swap it for your theme tokens
- segments instead of a smooth arc: they let progress be counted without reading a percentage
- the conic mask over the repeating-conic-gradient — an SVG arc drags in markup and maths
- the level hexagon at the bottom centre: the corner is left to presence
- the rank and the percentage in words: a screen reader does not read ring segments
- the card's own light surface: without it the dark text disappears on a dark background
## 6. You may change
- the level number through level
- the fill towards the next level through progress
- the rank through rank — bronze, silver or gold
- the segment count in the repeating-conic-gradient
## 7. Rules
- progress is a percentage, not a fraction: 0.6 draws an almost empty ring.
- There are ten segments: change the count in both gradients at once or track and fill drift apart.
- A two-digit level fits the hexagon, a three-digit one does not: widen the badge for hundreds.
- 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-025.jsonhttps://vibeui.ru/r/avatar-025.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-avatar-025-*. Серверный: хуков нет. Кольцо собрано из двух слоёв repeating-conic-gradient — дорожки и заливки; заливка отрезана conic-маской по значению в градусах, а общая radial-маска на обёртке превращает оба слоя в кольцо. Так деления считаются глазом («шесть из десяти»), чего гладкая дуга не даёт, и не нужны ни SVG, ни расчёт длины дуги. Номер уровня вынесен в шестиугольник снизу по центру: угол оставлен присутствию.
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 Avatar025Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
name?: string
level?: number
progress?: number
rank?: "bronze" | "silver" | "gold"
}
// Идея компонента: аватар с уровнем и рангом. Кольцо здесь не сплошная дуга, а
// десять делений: по сегментам глаз считает «шесть из десяти» без чтения
// процентов, чего гладкая дуга не даёт. Деления нарисованы
// repeating-conic-gradient, заполнение отрезано conic-маской — ни SVG, ни
// расчёта длины дуги. Номер уровня лежит в шестиугольнике под портретом, чтобы
// не занимать угол, где обычно висит присутствие.
const STYLES = `
:where([data-vibeui-block="avatar-025"]){
--vibeui-avatar-025-size:3.5rem;
--vibeui-avatar-025-ring:0.25rem;
--vibeui-avatar-025-gap:0.25rem;
--vibeui-avatar-025-accent:oklch(0.7 0.13 75);
--vibeui-avatar-025-track:oklch(0.9 0.008 265);
--vibeui-avatar-025-bg:oklch(1 0 0);
--vibeui-avatar-025-fg:oklch(0.24 0.014 265);
--vibeui-avatar-025-muted:oklch(0.55 0.014 265);
--vibeui-avatar-025-border:oklch(0.91 0.006 265);
--vibeui-avatar-025-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: тёмный текст обязан читаться на любом фоне. */
[data-vibeui-block="avatar-025"]{
display:flex;align-items:center;gap:0.875rem;
box-sizing:border-box;width:100%;max-width:19rem;padding:0.75rem 0.875rem;
background:var(--vibeui-avatar-025-bg);
border:1px solid var(--vibeui-avatar-025-border);border-radius:0.875rem;
font-family:var(--vibeui-avatar-025-font);color:var(--vibeui-avatar-025-fg);
}
[data-vibeui-block="avatar-025"] *{box-sizing:border-box}
[data-vibeui-block="avatar-025"][data-rank="bronze"]{--vibeui-avatar-025-accent:oklch(0.62 0.11 55)}
[data-vibeui-block="avatar-025"][data-rank="silver"]{--vibeui-avatar-025-accent:oklch(0.72 0.02 265)}
[data-vibeui-block="avatar-025"][data-rank="gold"]{--vibeui-avatar-025-accent:oklch(0.78 0.14 85)}
[data-vibeui-block="avatar-025"] [data-part="slot"]{
position:relative;display:grid;place-items:center;flex:none;
width:calc(var(--vibeui-avatar-025-size) + (var(--vibeui-avatar-025-ring) + var(--vibeui-avatar-025-gap)) * 2);
height:calc(var(--vibeui-avatar-025-size) + (var(--vibeui-avatar-025-ring) + var(--vibeui-avatar-025-gap)) * 2);
}
/* Маска на обёртке кольца режет обе дорожки разом. */
[data-vibeui-block="avatar-025"] [data-part="ring"]{
position:absolute;inset:0;border-radius:9999px;
mask-image:radial-gradient(circle closest-side,transparent calc(100% - var(--vibeui-avatar-025-ring)),#000 calc(100% - var(--vibeui-avatar-025-ring)));
}
[data-vibeui-block="avatar-025"] [data-part="track"],
[data-vibeui-block="avatar-025"] [data-part="fill"]{
position:absolute;inset:0;border-radius:9999px;
background:repeating-conic-gradient(from -90deg,var(--vibeui-avatar-025-track) 0 32.4deg,transparent 32.4deg 36deg);
}
[data-vibeui-block="avatar-025"] [data-part="fill"]{
background:repeating-conic-gradient(from -90deg,var(--vibeui-avatar-025-accent) 0 32.4deg,transparent 32.4deg 36deg);
mask-image:conic-gradient(from -90deg,#000 var(--vibeui-avatar-025-fill,0deg),transparent 0);
}
[data-vibeui-block="avatar-025"] [data-part="face"]{
display:grid;place-items:center;
width:var(--vibeui-avatar-025-size);height:var(--vibeui-avatar-025-size);
border-radius:9999px;
background:oklch(0.9 0.06 var(--vibeui-avatar-025-hue,265));
color:oklch(0.36 0.12 var(--vibeui-avatar-025-hue,265));
font-size:calc(var(--vibeui-avatar-025-size) * 0.32);font-weight:700;line-height:1;
}
/* Шестиугольник снизу по центру: угол оставлен присутствию. */
[data-vibeui-block="avatar-025"] [data-part="level"]{
position:absolute;bottom:-0.1875rem;left:50%;transform:translateX(-50%);
display:grid;place-items:center;width:1.5rem;height:1.6875rem;
clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
background:var(--vibeui-avatar-025-accent);color:oklch(0.22 0.03 75);
font-size:0.6875rem;font-weight:750;line-height:1;font-variant-numeric:tabular-nums;
}
[data-vibeui-block="avatar-025"] [data-part="text"]{display:flex;flex-direction:column;gap:0.125rem;min-width:0}
[data-vibeui-block="avatar-025"] [data-part="name"]{
font-size:0.9375rem;font-weight:650;
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="avatar-025"] [data-part="rank"]{font-size:0.8125rem;font-weight:600}
[data-vibeui-block="avatar-025"] [data-part="hint"]{font-size:0.75rem;color:var(--vibeui-avatar-025-muted);font-variant-numeric:tabular-nums}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="avatar-025"] *{animation:none!important;transition:none!important}}
`
const RANK_LABEL = {
bronze: "Бронза",
silver: "Серебро",
gold: "Золото",
} as const
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 Avatar025({
name = "Пётр Гай",
level = 7,
progress = 60,
rank = "silver",
className,
style,
...props
}: Avatar025Props) {
const safeProgress = Math.min(100, Math.max(0, progress))
const palette = {
"--vibeui-avatar-025-hue": hue(name),
"--vibeui-avatar-025-fill": `${safeProgress * 3.6}deg`,
...style,
} as CSSProperties
return (
<>
<style href="vibeui-avatar-025" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="avatar-025"
data-rank={rank}
className={className}
style={palette}
>
<span data-part="slot">
<span data-part="ring" aria-hidden="true">
<span data-part="track" />
<span data-part="fill" />
</span>
<span data-part="face" aria-hidden="true">
{initials(name)}
</span>
<span data-part="level" aria-hidden="true">
{level}
</span>
</span>
<span data-part="text">
<span data-part="name">{name}</span>
<span data-part="rank">
{RANK_LABEL[rank]}, уровень {level}
</span>
{/* Проценты словами: сегменты кольца скринридер не читает. */}
<span data-part="hint">до следующего уровня {safeProgress} %</span>
</span>
</div>
</>
)
}