A bar chart component for visualizing quantitative data.
Bar Chart — Monthly
January – July 2025
Components
<div class="chart-wrap"> <div class="chart-title">Chart title</div> <div class="bar-chart"> <div class="bar-col"> <div class="bar" style="height:60%;background:#A614C3;"></div> <div class="bar-label">Jan</div> </div> <!-- more bars --> </div> </div>
Installation
Built with pure HTML and CSS. Include ds-shared.css in your project.
pnpm add @norbielink/ds
Examples
Line chart
Line Chart — Linear
Active users · last 7 days
Active users
<svg class="chart-svg" viewBox="0 0 480 180"> <path class="line-path" stroke="#A614C3" d="M 60 90 L 120 70 L 180 110 ..."/> <circle class="point" cx="60" cy="90" stroke="#A614C3"/> <!-- more points --> </svg>
Area chart
Area Chart — Stacked
New vs returning users
New
Returning
<svg class="chart-svg" viewBox="0 0 480 180"> <defs> <linearGradient id="ar1">...</linearGradient> </defs> <path class="area-path" fill="url(#ar1)" stroke="#A614C3" d="..."/> </svg>
Donut chart
Donut Chart — Distribution
Components by category
Components65%
Foundations20%
Patterns15%
<svg class="donut-svg" viewBox="0 0 64 64"> <circle class="donut-bg" cx="32" cy="32" r="26"/> <circle class="donut-seg" stroke="#A614C3" stroke-dasharray="65 100" pathLength="100"/> </svg>
Horizontal bar chart
Horizontal Bar — Top categories
Components per category
<div class="hbar-chart"> <div class="hbar-row"> <span>Buttons</span> <div class="hbar-track"> <div class="hbar-fill" style="width:92%;"/> </div> <span class="hbar-val">12</span> </div> </div>
Stacked bar chart
Stacked Bar — Quarterly
Releases by category
Components
Foundations
Patterns
<div class="bar-col"> <div class="bar-stack"> <div class="bar stacked top" style="height:28%;..."/> <div class="bar stacked" style="height:32%;..."/> <div class="bar stacked" style="height:40%;..."/> </div> </div>
API Reference
Classes
| Class | Description |
|---|---|
chart-card | Outer wrapper (max-width 480px) |
chart-head | Title + description block |
chart-title | Chart heading text |
chart-desc | Subtitle / time range |
bar-chart | Vertical bar container (flex, align-items:flex-end) |
bar-col | Column with bar + label |
bar | Bar element — set height% via style |
bar-stack | Stacked bar wrapper (flex-direction:column-reverse) |
hbar-chart | Horizontal bar container |
hbar-row | Row: label + track + value |
hbar-track / hbar-fill | Track + filled portion |
chart-svg | SVG container for line/area charts |
line-path / area-path | Stroke / area paths |
donut-svg / donut-seg | Donut chart segments |
chart-legend / legend-item / legend-dot | Bottom legend rows |