Components

DonutChart

SVG donut chart implemented in pure React without dependencies

Overview

DonutChart is a pure SVG-based donut chart. It renders using arc-path calculations without any external chart libraries.

  • No dependency — No need for D3, Chart.js, or other external libraries
  • Interactive — Supports segment click events
  • Customizable — Size, inner ratio, start angle, and colors are all customizable
  • Accessible — role="img" and aria-label applied by default

Basic Usage

Interaction

Click a slice

Customization

Props

PropTypeDefaultRequiredDescription
segmentsDonutChartSegment[]-YesSlices with value, fill and optional id, stroke, ariaLabel
sizenumber'180'NoWidth and height in px
innerRationumber'0.55'NoHole size as a share of the radius (0 to 1)
startAnglenumber'0'NoAngle where the first slice starts, in degrees
defaultStrokeWidthnumber'0.75'NoStroke width for slices without their own
emptyFillstring'var(--background-default-tertiary)'NoFill when there is no data
emptyStrokestring'var(--border-default-default)'NoStroke when there is no data
onSegmentClick(segment: DonutChartSegment, index: number) => void-NoCalled when a slice is clicked
segmentKey(segment: DonutChartSegment, index: number) => string-NoReact key for each slice

DonutChartSegment

export type DonutChartSegment = {
  id?: string
  value: number
  fill: string
  stroke?: string
  strokeWidth?: number
  ariaLabel?: string
}

Specification

base

상태요소속성값
enabledemptyfill$color.background.default.tertiary
enabledemptystroke$color.border.default.default
enabledsegmentstrokeWidth0.75토큰 아님 — defaultStrokeWidth prop default

Guidelines

  • When all segment values are 0, an empty gray ring is displayed
  • For data visualization, consider using TimeDistribution instead of DonutChart alone