Skip to content

DiagramFigure

Stable

Wraps a diagram with a caption, a full description and a way to view its source.

Also known as diagram, figure, graphic

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

A simple diagram

PlanRunReview

Stages

Plan, run, review.

When to use it

Wraps any diagram, chart or complex picture so it has a short name, a visible caption and a full description. A complex picture needs more than one line of text, so the full description sits on the page for everyone.

Made of: Figure · Diagram · Caption · Full description · Written version · View source button

Use it for

  • A chart or drawing that needs more explanation than a short name.
  • A diagram made from text, where people may want to view or copy the source.
  • A picture that needs a written alternative, such as a numbered list of its steps.

Not for

  • A flow of steps and arrows: use ProcessDiagram.
  • A decorative picture with nothing to explain.

Do and avoid

From warehouse to your door

The parcel leaves the warehouse, rides in a van, then arrives at your door.
Do. A name, a caption and a full description anyone can read.

A wave

Avoid. Wrapping a decoration adds noise with nothing to explain.

Do

  • Name the diagram in the label and point to the description.
  • Show the full description to everyone.
  • Offer the source when the diagram is made from text.
  • Wrap charts and images that need more than a short name.

Avoid

  • Do not hide the full description in a pop-up.
  • Do not repeat the caption in the label.
  • Do not wrap decorative images.
  • Do not rely on a hidden description alone.

On a phone

  • The diagram scrolls sideways inside its own box if it is wider than the screen, and the box is focusable by keyboard.
  • The padding is 16px on a phone and 20px from 600px wide, and the caption and long description wrap under the diagram.
  • The View source button has a 44px tap area on a touch screen, and the source code scrolls sideways inside its block.

Seen in products

  • W3C guidance on complex images: give a short name that says where the full description is. Put the full description on the page for everyone. Use a figure and a caption. A hidden description loses the structure.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started