Skip to contentEnma

Components

Donut

Live demo

How to use it

A ring for one share of a whole: a weekly goal, a course, a storage quota.

  • Provide value (0 to 100), and optionally label (shown under the value and used as the accessible name), valueText ("4 of 5"), size (default 96) and thickness (default 10).
  • The arc uses the theme's spark color on the bar track, and grows once on first view. The value sits in the center in the theme's number face.
  • Inside a hero card it takes the hero's colors.

Do: one ring per group, with the number in it. Don't: pie charts with many slices, rings for values that aren't parts of a whole.

In every theme

Follows the mode picked in the header.
Graphite
Glass
Paper
Mineral
Enamel
Ember

Code

React
import { Donut } from 'enma/react';

<Donut value={80} label="Weekly goal" valueText="4 of 5" />

This component needs JavaScript for its behaviour. Outside React, port it with the same classes and props, as described in Other platforms.

Props

DonutProps

Props of DonutProps
PropTypeDefaultDescription
value requirednumber0 to 100.
labelstringWhat the ring measures, shown in the center under the value and used as the accessible name.
valueTextstringthe rounded percentageText for the value, for example "4 of 5". Default: the rounded percentage.
sizenumber96Diameter in px. Default 96.
thicknessnumber10Ring thickness in px. Default 10.
classNamestring
styleReact.CSSProperties

↑ ↓ to move, Enter to open, Esc to close

Keyboard shortcuts

Open the command palette
Ctrl then K
Search
/
Show keyboard shortcuts
?
Close the top overlay
Esc
Go to Home
G then H
Go to Themes
G then T
Go to Playground
G then P
Go to Components
G then C
Go to Guides
G then G
Go to Samples
G then S