Bar Chart
A categorical bar graph for comparing values across labels.
Examples
import { BarChart } from 'kalki-design'
const data = [
{
"label": "Mon",
"value": 24
},
{
"label": "Tue",
"value": 18
},
{
"label": "Wed",
"value": 32
},
{
"label": "Thu",
"value": 28
},
{
"label": "Fri",
"value": 40
},
{
"label": "Sat",
"value": 22
},
{
"label": "Sun",
"value": 16
}
]
export default function Example() {
return (
<BarChart
data={data}
color="var(--chart-2)"
accessibilityMode="default"
showGrid={true}
showYAxisLabels={true}
showValueLabels={false}
/>
)
}Installation
npx kalki-design add bar-chartUsage
import { BarChart } from 'kalki-design'
const data = [
{ label: 'Mon', value: 24 },
{ label: 'Tue', value: 18 },
{ label: 'Wed', value: 32 },
{ label: 'Thu', value: 28 },
{ label: 'Fri', value: 40 },
]
export default function Example() {
return <BarChart data={data} color="var(--chart-2)" showValueLabels />
}API Reference
| Name | Type | Default | Description |
|---|---|---|---|
Namedata | TypeChartDatum[] | Default— | DescriptionData points containing label and numeric value. |
Nameheight | Typenumber | Default220 | DescriptionChart height in pixels. |
Namecolor | Typestring | Default'var(--chart-2)' | DescriptionBar fill color. |
NameaccessibilityMode | Type'default' | 'colorblind-safe' | Default'default' | DescriptionApplies pattern overlays and outlines for color-blind-safe readability. |
NameshowGrid | Typeboolean | Defaulttrue | DescriptionShows horizontal grid lines. |
NameshowYAxisLabels | Typeboolean | Defaulttrue | DescriptionShows Y-axis value labels. |
NameshowValueLabels | Typeboolean | Defaultfalse | DescriptionShows values above bars. |