A mark for anything with a name
Projects, workspaces and accounts have a name long before they have a logo. The pixel avatar draws a small character and picks one of 6 inks from that name alone, so the same name is always the same character and nothing has to be designed, uploaded or stored.
Type a name
The name is the only input. Change a letter and a different character answers; type the old name back and the first one returns.
In a list
6 inks cannot keep 12 names apart on their own, so a list spreads them: each character keeps its own ink where it can, and never follows its own colour or the hue beside it.
Sizes
The four sizes are steps of the icon scale, so a character sits in any seat an icon does and lines up with the glyphs around it.
Tile
The tile seats the character on a wash of its own ink, for a larger mark that stands alone: a page header, a card, a picker.
Beside its name
Next to the name it was drawn from, the character is decoration and stays out of the accessibility tree. On its own it needs a label, which makes it an image with that name. The app sidebar offers it as an option on any row, and the thread panel draws it as every project’s default mark. Both spread the inks across their rows, so neighbours in a list differ in colour as well as shape.
Props
Read from the same JSDoc that ships in the package's types. A required prop is marked with an asterisk.
| Prop | Type | Default | Description |
|---|---|---|---|
name* | string | The seed. The same name always draws the same character in the same
ink, so a project, workspace or thread has its mark the moment it has a
name, with nothing designed or stored for it. | |
size | "sm" | "md" | "lg" | "xl" | 'md' | Rendered size, on the icon scale (`--icon-size-500/600/800/1200` — 20, 24, 32 and 48px), so the character seats wherever an icon does. |
ink | PixelInk | Overrides the ink the name picks (1 to 6, the `--color-pixel-ink-*`
tokens). A name's own ink is one of six, so two neighbours can land on
the same one; a host drawing a list passes each row's entry from
`distinctPixelInks` here to keep them apart. The character's shape still
comes from the name. | |
variant | "plain" | "tile" | 'plain' | `plain` draws the character alone; `tile` seats it on a rounded wash of its own ink, for a larger standalone mark. |
label | string | Accessible name. Omit it when the mark sits beside the name it was
drawn from, which is the usual case: the character is then decorative
and hidden from assistive technology. Given, the root becomes an image
with this label. | |
className | string | '' | Additional CSS classes |
Keys
Nothing here takes focus, so there are no keys. A test holds that.
// From the npm package
import { PixelAvatar } from 'rift-ds/components/PixelAvatar/PixelAvatar';
// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/pixel-avatar.json1.0 kB gzipped, with everything it imports. Peer dependencies are not counted.
For agents: the props, their allowed values and defaults, and the tested keys, as markdown or as a JSON schema.