Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

Anatomy for Vue

Draw a component's parts as labeled boxes on a 1200 by 630 canvas, in your theme's colors. Anatomy diagrams for Vue on Ark UI docs pages.

On this page9 sections
UI library: Ark UI

Anatomy draws a component as flat boxes on a 1200 by 630 canvas, with a callout naming each part. Reach for it on a docs page when the reader needs the structure more than a picture of the finished thing: which part holds which, and what each one is called in code. It paints from your theme, so a dark page gets a dark figure without a second image.

For the props each part takes, put a Type Table under the figure.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Anatomy anatomy: text, elbow, part, brace, line, box

Usage

<script setup lang="ts">
import {
  Anatomy, AnatomyCheck, AnatomyPart, AnatomyText,
} from "@/components/ui/anatomy";
</script>

Every number is in canvas units. A nested part's x and y count from its parent's top-left corner, so moving the root moves everything inside it.

<template>
  <Anatomy title="Checkbox anatomy">
    <AnatomyPart
      box
      :height=120
      name="root"
      :rx=16
      :width=600
      :x=300
      :y=255
    >
      <AnatomyPart
        :height=56
        name="control"
        :rx=10
        side="start"
        tone="emphasis"
        :width=56
        :x=32
        :y=32
      >
        <AnatomyCheck :size=24 />
      </AnatomyPart>
      <AnatomyPart
        :height=120
        name="label"
        side="bottom"
        :width=460
        :x=104
        :y=0
      >
        <AnatomyText :fontSize=40>Checkbox Label</AnatomyText>
      </AnatomyPart>
    </AnatomyPart>
  </Anatomy>
</template>

Accessibility

The drawing is one image named by title, which falls back to Component anatomy when you leave it out, so give each diagram a name that says what it shows, such as Checkbox anatomy. The part names and the text inside parts are hidden from assistive tech, because read in the order your parts nest they don't tell anyone what holds what. Say that in description, which becomes the image's description, as the first preview does, or in the page's prose. It takes no focus and has no keys.

Demos

Accordion

This is the figure on this site's Accordion page. A dashed box marks the root, a brace on the start side spans the open item's trigger and content, and the closed item below calls out its chevron with an elbow. Draw one item open and one closed like this when some parts only exist in one state.

Preview width

Action bar

The Action Bar figure: a count chip, then Edit, Export, Archive and an emphasized Delete under one brace labeled body, a separator on an elbow and a close mark. The buttons and two of the three separators carry no label, so the bar still looks whole while only five parts are named. Use a brace for a region and an elbow for a part too thin to point at.

Preview width

TOC

The table of contents figure names the root, the On this page title, the start-side indicator, the current item and a link. The current row and the indicator use the emphasis tone, and two plain rows with label set to false fill out the list. Pick this layout for a vertical component where the parts stack and each callout needs its own side.

Preview width

FAQ

When should I use an Anatomy diagram instead of a screenshot?

Use one when the page explains structure: which parts a component exports, which one wraps which, and what each is called in code. A screenshot shows one styled state and names nothing, while each AnatomyPart carries the name the reader will type. The Accordion, Action bar and TOC demos are the figures this site shows on those components' pages.

Keep a screenshot or a live preview for how the finished component looks. The diagram is drawn in flat boxes and doesn't pick up the component's own styles.

How do I position parts in an Anatomy diagram?

Give each AnatomyPart an x and y in canvas units, measured from its parent's top-left corner, so a part nested in another moves with it. The stage is 1200 by 630 units, the ANATOMY_WIDTH and ANATOMY_HEIGHT constants, and the figure scales to the width of its container at that ratio.

Leave out width or height and the part fills the rest of its parent from its x or y. rx rounds the corners, with one number or one per corner as tl, tr, br and bl.

What callout styles does the Anatomy diagram support?

Three, set with callout on AnatomyPart. A line leaves from the part's edge, or from the dashed box around it when there is one, with a dot where it starts. A brace brackets the whole edge of a group, such as an item holding a trigger and its content, and an elbow runs from the part to the box's edge and turns, for a part too thin or crowded for a straight line.

side puts the label on the top, which is the default, or the bottom, start or end, and align slides it toward one end of that side. Set label to false to draw a part with no callout.

Why is an Anatomy label cut off or covering another part?

The component doesn't measure or move labels. Each chip is placed from its part's side and align, and its width comes from the label's character count in the mono font, about 14 canvas units a character plus padding. Anything past the 1200 by 630 canvas is cut off.

Leave room on the side a label points to, or move it with side, align or a brace or elbow callout. A shorter label helps too, since the chip can say less than the part's name.

Does the Anatomy diagram follow my theme and dark mode?

Yes. With no colors, it paints from your theme's tokens: the stage is a tint of --muted, parts use --card and --border, emphasis and the callouts use --primary, and labels sit on --background. Switch to dark mode and the figure changes with the rest of the page.

To fix the colors instead, pass a colors object with bg, surface, emphasis, fg, line and outline, plus the optional border, emphasisFg, label and labelBg. The figure sets its own color variables inline, so a class can't override them, but they read --primary and the other tokens from the elements around it, so setting those on a wrapper recolors one diagram.

Does the Anatomy component support right-to-left layouts?

Yes. In rtl, every part's x counts from its parent's right edge, start and end swap sides, and corners, text and chevrons mirror with them, so one figure serves both directions.

With no dir, the figure takes the direction from Ark UI's locale context, so inside a LocaleProvider set to Arabic or Hebrew it mirrors without being told. Pass dir to set one diagram's direction yourself.

Can I use an Anatomy diagram as an Open Graph image in Vue?

Yes. Add share and it renders a standalone SVG instead of a figure, 1200 by 630 like a social card, with fixed colors and system fonts so it draws the same with no page CSS around it. Render that to markup on the server and rasterize it with an SVG renderer such as sharp, which is how this site builds its docs page images.

The fixed colors are anatomyShareColors, a dark olive and lime set, unless you pass colors. brand draws a small round mark in the bottom-right corner, followed by your site's name when you pass that as a string.

Is the Anatomy diagram accessible to screen readers?

Yes, as one image with nothing in it to operate. title names it, Component anatomy when you leave it out, so name each diagram for what it shows. The part names drawn inside are hidden from screen readers, since in the order your parts nest they don't say what holds what.

Put the structure in description instead, a sentence about which part wraps which, and it becomes the image's description. An image you make with share and save as a file needs its own alt text wherever you place it.

API Reference

Anatomy

PropType
brand?boolean | string

Draws a round mark in the bottom-right corner (true), followed by this text when it's a string, such as your site's name.

Type
boolean | string
Default
false
colors?object

The figure's colors: the stage's bg, the parts' surface, emphasis and border, their text (fg, emphasisFg), the callouts' line and label, and the boxes' outline. The theme's when unset.

Type
{ bg: string; border?: string; emphasis: string; emphasisFg?: string; fg: string; label?: string; labelBg?: string; line: string; outline: string; surface: string }
description?string

The figure's accessible description: what it shows, such as which part holds which, for readers who can't see the drawing.

dir?AnatomyDir

The reading direction: rtl mirrors every part's x and callout. The locale's when unset.

share?boolean

Renders the share card's figure: a bare SVG with fixed colors and fonts, for images.

Default
false
title?string

The figure's accessible title.

Default
"Component anatomy"
class?string

Merged with the part's classes.

ANATOMY_HEIGHT

ANATOMY_WIDTH

AnatomyPart

PropType
align?AnatomyAlign

Where along its side the callout's label sits.

Default
"center"
box?boolean

Draws a dashed box around the part; its children's callouts start at its edge.

Default
false
callout?AnatomyCallout

How the label points at the part: a line, a brace along its edge, or an elbow.

Default
"line"
height?number

The part's height. The rest of its parent's below y when unset.

label?string | false

The callout's text: name when unset, none when false.

Type
string | false
name?string

The part's name, its label when label is unset.

rx?number | AnatomyCorners

The corner radius, or one per corner (tl, tr, br, bl).

Type
number | AnatomyCorners
side?AnatomySide

The side the callout's label sits on: top, bottom, start or end.

Default
"top"
tone?AnatomyTone

Fills the part: surface, outlined like a card, or emphasis to pick it out. Unfilled when unset.

width?number

The part's width. The rest of its parent's after x when unset.

x?number

The part's left edge, from its parent's (mirrored in rtl).

Default
0
y?number

The part's top edge, from its parent's.

Default
0

AnatomyText

PropType
align?"start" | "center" | "end"

Where the text sits in its part: from the start edge (after padX), the center, or before the end edge.

Type
"start" | "center" | "end"
Default
"start"
fontSize?number

The text's size, in the figure's units.

Default
26
fontWeight?number

The text's weight.

Default
500
muted?boolean

Draws it softer, for secondary copy: descriptions, placeholders.

Default
false
padX?number

The space between the text and its part's edge.

Default
24

AnatomyChevron

<path>

PropType
direction"down" | "up"

Which way it points: down or up.

Type
"down" | "up"
align?"center" | "end"

Where it sits in its part: the center, or the end.

Type
"center" | "end"
Default
"end"
size?number

The size.

Default
18

AnatomyCheck

<path>

PropType
size?number

The size.

Default
18

AnatomyX

<path>

PropType
size?number

The size.

Default
16

AnatomyContext