The Donut component is a circular chart that shows the relative share of commit status states for a pull request, or other data you wish to represent in a pie chart fashion.
Pro tip: The Donut component has been repurposed and wrapped with the
@bristlecone/systemsauce to extend Primer's original intent for this component, however, their respective component should be considered anytime you are looking to represent GitHub related data with a pie chart.
data prop is the simplest way to define the share of states. It takes an object literal with states as keys and the number of statuses with that state as values. Slices are always rendered clockwise in descending order by size.
When using the
data prop, the fill of each slice comes from the corresponding value in the theme's
colors.state object. In other words, if
theme.colors.state.error = "red", then the
error slice will get
fill="red". You can customize the slice colors by either passing a custom
theme prop or using the
Donut.Slice component described below.
With configurable size and radii values, along with a set of
disabled data key values.
Donut components get
space system props. Read the System Props doc page for a full list of available props.
|data||Object||Use the keys |
|size||Number||Used to set the width and height of the component|
If you need to customize the color of your slices, you can use the
Donut.Slice component as a child of
Donut.Slice component props
|state||String||The commit status state which this slice represents|
|value||Number||The number of statuses with this slice's state|
|fill||String||The fill color of the slice, which overrides the color determined by the |