Skip to content
shadcn.io is not affiliated with official shadcn/ui

Shadcn Anatomy for React and Tailwind

Labeled part diagrams for component docs.

Checkbox anatomycontrolCheckbox Labellabelrootshadcn.io

Installation

bunx --bun shadcn@latest add https://kit.dev/r/anatomy.json

Anatomy

Anatomy
├── AnatomyPart
├── AnatomyText
├── AnatomyChevron
└── AnatomyCheck

shadcn.io Anatomy is an SVG scene: parts are rectangles in a 1200×630 viewBox, callouts are strokes, and labels are real <text>. Pass dir and a labels map so the same diagram can flip for RTL and later locales. Inner line / elbow callouts snap to the nearest box frame. Pass brand for a shadcn.io lockup in the bottom-right.

The stage is a mid-tone mix of --primary (--anatomy-bg) so Neutral light does not collapse to black, and mock fills / leaders stay on theme.

Usage

import { Anatomy, AnatomyPart } from "@/components/ui/anatomy";
<Anatomy brand title="Checkbox anatomy">
  <AnatomyPart box name="root" x={360} y={267} width={480} height={96}>
    <AnatomyPart name="control" side="start" tone="emphasis">
      …
    </AnatomyPart>
    <AnatomyPart name="label" side="bottom">
      Checkbox Label
    </AnatomyPart>
  </AnatomyPart>
</Anatomy>

name is the default label. Pass label to override, or label={false} to mark a region with no callout.

Coordinates are LTR user space relative to the parent part. dir="rtl" mirrors x inside each parent and maps start / end. Text glyphs are not flipped. brand stays in the physical bottom-right (it is a signature, not a callout).

Examples

Accordion

callout="brace" spans a side (the item group). callout="elbow" is an L along the dashed frame — use it for a corner part like item indicator. align shifts a leader along that side so two top labels do not collide. Pass a labels object to translate callouts and mock copy.

Action Bar

A horizontal toolbar: content is the dashed frame, body is a brace over the actions, and separator uses callout="elbow" like Accordion’s item indicator.

Table of Contents

A document plus sticky nav: content is the article, nav holds title and link rows, and indicator uses callout="elbow" on the active row.

Guides

Anatomy vs Hint

AnatomyHint
ShapeSVG stage + calloutsHover/focus tooltip
Use whenComponent part maps in docsA short hint on a control

Use Hint for interactive help. Use Anatomy when the labels are the diagram.

On a component page (for example Accordion or Action Bar, above the live preview), wrap the figure in ImageZoom. Leave the examples on this page unwrapped so the scene stays inspectable. The zoomed layer is a live SVG clone — RTL and --primary follow the page.

Callouts

  • callout="line" (default) — a short leader from the dashed frame (or the part edge) to the label, with a T-tick at the attachment.
  • callout="elbow" — an L: from the part to the frame, then along the frame toward start.
  • callout="brace" — a bracket along side, for a group of rows or a column.
  • box — dashed rounded rect around the part (usually the root). Inner callouts snap to this frame.
  • side / aligntop bottom start end, and start center end along that side.

Direction and labels

dir defaults to the Ark locale (ltr unless a LocaleProvider is set). start is the inline-start edge: left in LTR, right in RTL. Elbows on side="bottom" drop from the part, then run toward start along the dashed frame.

Put every visible string in a labels map so a locale file can replace them later.

Mock fills

tone="surface" and tone="emphasis" paint with --anatomy-surface and --anatomy-emphasis. They only look right on the Anatomy stage. AnatomyText, AnatomyChevron, AnatomyCheck, and AnatomyX draw mock copy and icons in the current part.

API Reference

shadcn.io Anatomy draws in SVG. Labels are real text. Defaults below are shadcn.io values.

Anatomy

Root. Renders a figure wrapping an SVG, or a standalone SVG when share is set.

PropType
AttributeDescription
data-slotanatomy
dirltr or rtl

The stage is the SVG (1200×630, h-auto w-full) with a rounded fill. Labels are data-slot="anatomy-label". Tokens: --anatomy-bg, --anatomy-surface, --anatomy-emphasis, --anatomy-line, --anatomy-outline, --anatomy-fg.

AnatomyPart

One annotated rectangle in the scene. Coordinates are relative to the parent part.

PropType
AttributeDescription
data-slotanatomy-part
data-namename
data-sideside
data-alignalign
data-calloutcallout
data-tonetone when set

Accessibility

The stage is a figure with aria-label from title. Callout labels are visible SVG text (indexable). Do not put interactive controls in the diagram unless the same information is available as text next to it.

Keyboard support

The diagram is not interactive. Focus stays in the page.