Share Donut
A gradient donut sweeps around to 38% with competitor shares labeled outside
Installation
$ pnpm dlx shadcn@latest add @remocn/share-donutUsage
tsx
// src/Root.tsx
import { Composition } from "remotion";
import { ShareDonut } from "@/components/remocn/share-donut";
const ShareDonutScene = () => (
<ShareDonut
highlight={0}
segments={[
{ label: "remocn", value: 38 },
{ label: "Kitebase", value: 24 },
{ label: "Lumen", value: 17 },
{ label: "Other", value: 21 },
]}
/>
);
export const RemotionRoot = () => (
<Composition
id="ShareDonut"
component={ShareDonutScene}
durationInFrames={140}
fps={30}
width={1280}
height={720}
/>
);A gradient donut sweeps around one segment after another, then the highlighted slice detaches, the rest dim, and its percentage counts up in the center. Pass segments (label and value) and highlight, the index of the hero slice. Ships dark and light via theme.
Props5
| Prop | Type | Default |
|---|---|---|
| segments | DonutSegment[]DEFAULT_SEGMENTS Slices of the donut, each with a label and value. | |
| highlight | number0 Index of the hero slice that gets the gradient. | |
| accent | string"#3B5BFD" Accent color for the hero element. | |
| theme | "dark" | "light""dark" Dark or light palette. | |
| speed | number1 Playback multiplier. | |
- segmentsDonutSegment[]
Slices of the donut, each with a label and value.
Default
DEFAULT_SEGMENTS - highlightnumber
Index of the hero slice that gets the gradient.
Default
0 - accentstring
Accent color for the hero element.
Default
"#3B5BFD" - theme"dark" | "light"
Dark or light palette.
Default
"dark" - speednumber
Playback multiplier.
Default
1