TidalUI

Donut chart preview

Show composition with exact controlled inspection, legend visibility and a native table fallback.

pro · Data · composite

When to use

Alternatives

Configure components.json and the @tidal-pro namespace before installing Pro components.

Installation

npx shadcn@latest add @tidal-pro/donut-chart

Import components/ui/tidal.css, components/ui/donut-chart.css. Wrap installed components in tidal-scope.

Preview

Donut chart component preview

Open interactive preview

Minimal example

import"./components/ui/tidal.css";
import"./components/ui/donut-chart.css";
import{TidalDonutChart}from"./components/ui/donut-chart";
export default()=><div className="tidal-scope"><TidalDonutChart segments={[{id:"example",label:"Demo",value:1,displayValue:"value"}]} title={"Demo"} totalText={"Demo"}/></div>;

API and props

TidalDonutChart.segments (required)
ReadonlyArray<TidalDonutSegment>

Required segments value accepted by this exported component.

TidalDonutChart.title (required)
ReactNode

Required title value accepted by this exported component.

TidalDonutChart.totalText (required)
ReactNode

Required total text value accepted by this exported component.

TidalDonutChart.activeId
string | undefined

Optional active id value accepted by this exported component.

TidalDonutChart.center
ReactNode

Optional center value accepted by this exported component.

TidalDonutChart.chartLabel
string | undefined

Optional chart label value accepted by this exported component.

TidalDonutChart.description
ReactNode

Optional description value accepted by this exported component.

TidalDonutChart.emptyMessage
ReactNode

Optional empty message value accepted by this exported component.

TidalDonutChart.getLegendButtonProps
((segment: TidalDonutSegment) => LegendButtonProps | undefined) | undefined

Optional get legend button props value accepted by this exported component.

TidalDonutChart.headingLevel
"h2" | "h3" | "h4" | undefined

Optional heading level value accepted by this exported component.

TidalDonutChart.hiddenIds
ReadonlyArray<string> | undefined

Optional hidden ids value accepted by this exported component.

TidalDonutChart.legendButtonRefs
Readonly<Record<string, Ref<HTMLButtonElement> | undefined>> | undefined

Optional legend button refs value accepted by this exported component.

TidalDonutChart.legendLabel
string | undefined

Optional legend label value accepted by this exported component.

TidalDonutChart.onActiveChange
((segment: TidalDonutSegment, source: "keyboard" | "pointer") => void) | undefined

Callback invoked when the active change interaction is proposed.

TidalDonutChart.onHiddenChange
((hiddenIds: readonly string[], segment: TidalDonutSegment) => void) | undefined

Callback invoked when the hidden change interaction is proposed.

TidalDonutChart.segmentRefs
Readonly<Record<string, Ref<SVGGElement> | undefined>> | undefined

Optional segment refs value accepted by this exported component.

TidalDonutChart.tableLabel
ReactNode

Optional table label value accepted by this exported component.

Complete usage

Full example, stylesheet imports, API and accessibility documentation

Gotchas