Components
Avatar
Image with an initials or icon fallback in five sizes, two shapes and twelve tones, plus group and bridge layouts.
import { Avatar } from "@openperf/deft";
<Avatar.Root alt="Ada Lovelace" src="/avatars/ada.png">
AL
</Avatar.Root>;Anatomy
<Avatar.Root /> {/* image; children are the fallback */}
<Avatar.Group> {/* overlaps the avatars inside it */}
<Avatar.Root />
<Avatar.Root />
</Avatar.Group>
<Avatar.Bridge from={<Avatar.Root />} to={<Avatar.Root />} />The children are shown while the image loads, when it fails to load and when there is no src. Keep them to one or two letters or a single Tabler icon, which is sized automatically.
Sizes
| Size | Dimensions | Icon size | Square radius |
|---|---|---|---|
xs | 16px | 11px | 4px |
sm | 18px | 12px | 5px |
md | 20px | 12px | 5px |
lg | 22px | 14px | 6px |
xl | 40px | 20px | 10px |
lg is the default.
Shapes
circle is the default for people and organizations; use square with an icon for projects and other objects.
Tones
tone sets the background and text color of the fallback: neutral, accent, inverse, raised, or one of the eight hues. The hues array exported from @openperf/deft lists the hue names, which helps when a color is stored with the object. The preview uses the minimal palette, where all hues share one neutral pair; see Colors.
Group
Avatar.Group overlaps its avatars by 5px and separates them with a 2px ring in the default background color.
Bridge
Avatar.Bridge joins from and to with a dashed line and a check mark. Both slots take any node, not only an avatar. It is always hidden from assistive technology, so name the two parties in the text around it.
Composition
Inside a List row, put the avatar in List.Icon with variant="tile": the avatar then fills the tile.
API
Avatar.Root
Prop
Type
Avatar.Bridge
Prop
Type