Blossom UI

Charts

Chart components without dependencies: bar chart, horizontal bars, line chart, donut, pie and sparkline, drawn with SVG, with tooltips and an accessible summary.

How to use it

Run npx @blossomui/react add charts, or copy src/components/UI/Charts/Charts.tsx into your React project and import it.

import { Sparkline, BarChart, LineChart, DonutChart, AreaChart, RadarChart, Gauge, Heatmap } from './components/ui/Charts'

Props

ChartDatum

PropTypeDescription
label (required)string
value (required)number
colorstringAny CSS color. Defaults to the palette.

SparklineProps

PropTypeDescription
data (required)number[]
colorstring
filledbooleanFill the area under the line.
heightnumberHeight in pixels. The width fills the container.
labelstring

BarChartProps

PropTypeDescription
data (required)ChartDatum[]
heightnumberHeight of the chart in pixels when it is vertical.
horizontalboolean
showValuesbooleanShow the value of each bar.
labelstringName of what is measured, used for screen readers.

LineChartProps

PropTypeDescription
data (required)ChartDatum[]
heightnumber
colorstring
filledbooleanFill the area under the line.
labelstring

DonutChartProps

PropTypeDescription
data (required)ChartDatum[]
sizenumberDiameter in pixels.
piebooleanUse a full circle without the hole.
centerReactNodeText in the center of the donut, for example the total.
legendbooleanShow the list of values next to the chart. Hovering a slice always shows its value, so you can turn the list off.
labelstring

Series

PropTypeDescription
name (required)string
data (required)number[]One value for each label of the chart.
colorstringAny CSS color. Defaults to the palette.

AreaChartProps

PropTypeDescription
labels (required)string[]Names of the points on the horizontal axis.
series (required)Series[]
stackedbooleanPile the series on top of each other, so the top line is the total.
heightnumber
legendbooleanShow the name of each series under the chart.
labelstring

RadarSeries

PropTypeDescription
name (required)string
values (required)number[]One value for each axis.
colorstring

RadarChartProps

PropTypeDescription
axes (required)string[]Names of the axes, from the top and clockwise.
series (required)RadarSeries[]
maxnumberValue at the border of the chart. By default the biggest value.
sizenumberDiameter in pixels, labels included.
ringsnumberNumber of rings.
legendboolean
labelstring

GaugeThreshold

PropTypeDescription
from (required)numberThe color applies from this value on.
color (required)string

GaugeProps

PropTypeDescription
value (required)number
minnumber
maxnumber
sizenumberWidth in pixels. The height is half of it.
captionReactNodeText under the number, for example "CPU".
unitstringText added after the number, for example "%".
thresholdsGaugeThreshold[]Change the color as the value grows, for example green, yellow and red. Without it the gauge uses the first color of the palette.
labelstring

HeatmapProps

PropTypeDescription
data (required)number[][]One list of numbers for each row. Every row has one number for each column.
rows (required)string[]
columns (required)string[]
colorstringColor of the biggest value. The smaller ones are lighter. Defaults to the brand color.
showValuesbooleanShow the number inside each cell.
cellnumberSize of a cell in pixels.
labelstring

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree