Display

Avatar Stack

An avatar stack: the overlap comes from a reversed flex row instead of z-index, and the remainder collapses into "+N".

  • avatar
  • stack
  • team
  • overlap

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/iconstack-001?lang=en

6 работают над проектом
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 "iconstack-001" (Avatar Stack) 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/iconstack-001.json

Registry item: https://vibeui.ru/r/iconstack-001.json
Installs to: components/vibeui/iconstack-001.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 stack: the overlap comes from a reversed flex row instead of z-index, and the remainder collapses into "+N".

An overlapping avatar stack with a "+N" counter and a group caption. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Iconstack001 } from "@/components/vibeui/iconstack-001"

<Iconstack001 names={["Anna Rebrova", "Ilya Mokhov"]} max={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-iconstack-001-* palette — do not swap it for your theme tokens
- its own light surface: the stack gets shown over any background
- the reversed flex row instead of a z-index on every circle
- collapsing the remainder into "+N": ten circles in a row do not read
- the FNV-1a hash for the hue — summing code points paints a whole alphabet alike
- the ring around each circle: without it the stack becomes one blob
- the caption with the member count: the circles are hidden from screen readers

## 6. You may change
- the names array and the max cap
- label — the group caption
- size — sm, md or lg
- the overlap amount

## 7. Rules
- The circles are decorative: the names must be reachable in the caption or nearby.
- Initials come from the first two words: a single-word name yields one letter.
- Do not show more than five circles — past that "+N" is more honest.
- 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/iconstack-001.json
https://vibeui.ru/r/iconstack-001.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-iconstack-001-*. Серверный: хуков нет. Порядок наложения задан flex-direction: row-reverse, поэтому левый кружок лежит поверх правого без z-index на каждом элементе. Оттенок кружка считается хешем FNV-1a от имени.

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 Iconstack001Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children"
> & {
  names?: string[]
  max?: number
  label?: string
  size?: "sm" | "md" | "lg"
}

// Идея компонента: стопка участников с перекрытием. Порядок наложения задан
// не z-index на каждом элементе, а обратным направлением флекса: тогда левый
// кружок лежит поверх правого без единого дополнительного правила. Остаток
// сворачивается в «+N» — иначе десять человек превращаются в полосу, где не
// читается ни один. Кружки декоративны, весь смысл несёт подпись группы.
const STYLES = `
:where([data-vibeui-block="iconstack-001"]){
--vibeui-iconstack-001-size:2rem;
--vibeui-iconstack-001-overlap:0.625rem;
--vibeui-iconstack-001-ring:oklch(1 0 0);
--vibeui-iconstack-001-more-bg:oklch(0.93 0.006 265);
--vibeui-iconstack-001-more-fg:oklch(0.4 0.014 265);
--vibeui-iconstack-001-surface:oklch(1 0 0);
--vibeui-iconstack-001-shell:oklch(0.91 0.006 265);
--vibeui-iconstack-001-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: стопку показывают поверх любого фона. */
[data-vibeui-block="iconstack-001"]{
display:inline-flex;align-items:center;gap:0.625rem;
box-sizing:border-box;padding:0.5rem 0.875rem 0.5rem 0.625rem;
background:var(--vibeui-iconstack-001-surface);
border:1px solid var(--vibeui-iconstack-001-shell);border-radius:9999px;
font-family:var(--vibeui-iconstack-001-font);
}
/* Обратный флекс вместо z-index: левый кружок сам ложится поверх правого. */
[data-vibeui-block="iconstack-001"] [data-part="stack"]{
display:inline-flex;flex-direction:row-reverse;justify-content:flex-end;
}
[data-vibeui-block="iconstack-001"] [data-part="stack"] > *{
margin-right:calc(var(--vibeui-iconstack-001-overlap) * -1);
}
[data-vibeui-block="iconstack-001"] [data-part="stack"] > *:first-child{margin-right:0}
[data-vibeui-block="iconstack-001"] [data-part="face"],
[data-vibeui-block="iconstack-001"] [data-part="more"]{
display:inline-flex;align-items:center;justify-content:center;flex:none;
width:var(--vibeui-iconstack-001-size);height:var(--vibeui-iconstack-001-size);
box-sizing:border-box;border-radius:9999px;
border:2px solid var(--vibeui-iconstack-001-ring);
font-size:calc(var(--vibeui-iconstack-001-size) * 0.36);
font-weight:650;line-height:1;
}
/* Оттенок из имени: хеш, а не сумма кодов — иначе алфавит красится одинаково. */
[data-vibeui-block="iconstack-001"] [data-part="face"]{
background:oklch(0.9 0.06 var(--vibeui-iconstack-001-hue,265));
color:oklch(0.38 0.12 var(--vibeui-iconstack-001-hue,265));
}
[data-vibeui-block="iconstack-001"] [data-part="more"]{
background:var(--vibeui-iconstack-001-more-bg);color:var(--vibeui-iconstack-001-more-fg);
font-variant-numeric:tabular-nums;
}
[data-vibeui-block="iconstack-001"] [data-part="label"]{
font-size:0.8125rem;color:var(--vibeui-iconstack-001-more-fg);
}
[data-vibeui-block="iconstack-001"][data-size="sm"]{--vibeui-iconstack-001-size:1.5rem;--vibeui-iconstack-001-overlap:0.5rem}
[data-vibeui-block="iconstack-001"][data-size="lg"]{--vibeui-iconstack-001-size:2.75rem;--vibeui-iconstack-001-overlap:0.875rem}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="iconstack-001"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_NAMES = [
  "Анна Реброва",
  "Илья Мохов",
  "Ким Сон",
  "Пётр Гай",
  "Мария Лоза",
  "Олег Дин",
]

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("")
}

/**
 * Стопка участников: перекрытие обратным флексом и остаток в «+N».
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Iconstack001({
  names = DEFAULT_NAMES,
  max = 4,
  label = "работают над проектом",
  size = "md",
  className,
  style,
  ...props
}: Iconstack001Props) {
  const shown = names.slice(0, max)
  const rest = names.length - shown.length

  return (
    <>
      <style href="vibeui-iconstack-001" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="iconstack-001"
        data-size={size}
        className={className}
        style={style as CSSProperties}
      >
        <span data-part="stack" aria-hidden="true">
          {rest > 0 ? <span data-part="more">+{rest}</span> : null}
          {[...shown].reverse().map((name) => (
            <span
              key={name}
              data-part="face"
              style={
                { "--vibeui-iconstack-001-hue": hue(name) } as CSSProperties
              }
            >
              {initials(name)}
            </span>
          ))}
        </span>
        <span data-part="label">
          {names.length} {label}
        </span>
      </div>
    </>
  )
}