suiss/ui ยท Chart
Area Chart
Ten area charts for showing how values change over time, from a single smooth area to stacked, gradient, step, range and sparkline areas.
Area Chart is an open-source chart from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Area charts show how a value moves over time and how big it is at each point. Use the default for one series, stack areas to show a total and its parts, expand them to 100% to compare shares, and switch to linear or step lines when the readings should not look smoothed. The range variant shades a low-to-high band, and the sparkline fits a tiny trend beside a value.
Each chart is built on the Chart and Card components.
Every variant below is its own registry item, so you can add only the ones you need. Each one renders the same design on React, React Native, SwiftUI and Jetpack Compose.
Default
A single filled area with a smooth curve showing one series across six months.
The baseline area chart: one series as a smooth, lightly filled curve with a month axis and a tooltip, and no value axis. Start here when you only need the shape of a trend and want to build up from the simplest version.
Replace chartData, point each dataKey at your fields and set the label and color in chartConfig, where colors follow light and dark mode. Change the curve with the type prop on the area, for example to straight lines or steps. Focus the chart and use the arrow keys to move the tooltip between months.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Usage
Web preview
The baseline area chart inside a Card: one series drawn as a natural curve with a light fill, a dashed horizontal grid, a month axis and a tooltip with a line indicator. There is no value axis. Press and drag across the plot to move the tooltip between months.
Replace chartData with your records and change each dataKey to match your fields. Rename the series in chartConfig to set its label and color. The component takes no props.
Installation
-
Target iOS 17 or later.
-
Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Axes
A gradient area with visible dots and a value axis on the right edge of the plot.
A single series drawn as a smooth area with a soft gradient fill, a dot at every value and a value axis on the right. Use it when readers need to read exact values off the chart, not just see the trend.
Replace chartData, point each dataKey at your fields and set the label and color in chartConfig. Set orientation on the value axis to move it to the left and tickCount to change how many values it shows. Each copy gets its own gradient, so several can share a page. Focus the chart and use the arrow keys to move the tooltip between months.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
One series drawn as a monotone curve with a fill that fades from top to bottom, a dot on every month, a month axis below and a four-tick value axis on the right. The tooltip follows your finger across the plot.
Replace chartData with your records and change each dataKey to match your fields. Set the label and color in chartConfig, and adjust tickCount on the YAxis to change how many values it shows. The component takes no props.
Installation
Follow the manual steps under Default and copy this variant's source instead.
Usage
Gradient
Two overlapping areas whose fills fade out toward the bottom using SVG linear gradients.
Two overlapping series whose fills fade to transparent toward the baseline, so the lower series stays visible through the upper one. Reach for it over the flat-filled default when you compare two series that cross each other.
Replace chartData and rename the two series keys in the data, the areas and chartConfig. Each series needs its own gradient in the defs block, and the top stop's stopOpacity sets the strength of the fill. Areas are drawn in source order, so the last Area sits on top. Focus the chart and use the arrow keys to move the tooltip between months.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
Two series, desktop and mobile, drawn as natural curves on the same axis. Both use a shared gradient fill that fades out toward the baseline, so the overlap stays readable. A month axis, a dashed grid and a tooltip listing both values complete the chart.
Replace chartData with your records and change each dataKey to match your fields. Add or rename series in chartConfig, and change the fade stops to make the gradient stronger or lighter. The component takes no props.
Installation
Follow the manual steps under Default and copy this variant's source instead.
Usage
Interactive
A stock price chart with time-range toggles, a scrubbing cursor that updates the header, and animated transitions between ranges.
A stock-style price chart with range toggles from one day to five years. Scrubbing the plot updates the price, change and date in the header, and switching ranges morphs the line into its new shape. Use it as a starting point for financial or any time-series dashboard where readers drill into time ranges.
Replace the seeded generate function with your own data per range, one price and one label per point, and edit RANGES to change the toggles. The stats row under the chart, including volume, is static. There is no floating tooltip: the header shows every readout and returns to the latest price when a touch ends. The line turns green or red as the price at the cursor is above or below the opening price, and the morph is skipped when reduced motion is preferred.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
One price series drawn as a linear area with a fading gradient, a value axis on the right and a dashed ReferenceLine at the opening price. A ToggleGroup switches between 1D, 1W, 1M, 3M, 1Y and 5Y. Touching the plot reports the point through onActiveIndexChange, and the header updates the price, change and date for that point. The area turns green or red depending on whether the price is up or down, and open, high, low and volume sit below the chart. The area sets isAnimationActive={false}, so it draws without the enter animation and switches ranges instantly.
Replace generate() with your price history for each range, and set the symbol, company name and LAST_PRICE. Volume values are hard-coded in stats. The component takes no props.
Installation
The CLI also adds what it builds on: Card, Chart, Text, Toggle Group.
Follow the manual steps under Default and copy this variant's source instead.
Usage
Linear
A single filled area whose points are joined by straight segments instead of a smoothed curve.
One series filled under straight line segments instead of a smoothed curve. Prefer it to the default when smoothing would suggest values between points that were never measured.
Replace chartData, point each dataKey at your fields and set the label and color in chartConfig. Focus the chart and use the arrow keys to move the tooltip between months.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
The same one-series area as the default chart, with type="linear" so each month connects to the next with a straight segment. It has a month axis, a dashed grid and a tooltip with a line indicator.
Replace chartData with your records and change each dataKey to match your fields. Set the label and color of the series in chartConfig. The component takes no props.
Installation
Follow the manual steps under Default and copy this variant's source instead.
Usage
Range
A heart-rate band showing each hour's low-to-high range as a shaded area with an average line through it.
A health-style heart-rate card that shades each hour's low-to-high range and draws the average as a line through the band. Use it for any metric where the spread matters as much as the typical value, such as temperatures or response times.
Give each record a two-number range array and an average; the header's overall low and high come from the data. The value axis has a fixed domain, so widen it and its ticks if readings fall outside it, and change the unit text in the tooltip and header. Set both colors in chartConfig. Focus the chart and use the arrow keys to move the tooltip between hours.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
A ComposedChart that pairs a range Area, filled between each hour's low and high reading, with a Line for the hourly average. The header shows the day's lowest and highest values in BPM, and the tooltip formats both the range and the average with a custom row built from Text.
Replace the readings array with [low, high, average] tuples for each hour; the header range and the chart data are derived from it. Adjust the YAxis domain and ticks to fit your values. The component takes no props.
Installation
Follow the manual steps under Default and copy this variant's source instead.
Usage
Sparkline
A watchlist with a tiny gradient area chart beside each price, colored by whether the stock is rising or falling.
A watchlist where each row pairs a stock's name and price with a tiny gradient area chart, tinted green when rising and red when falling. Use sparklines like these inside lists and tables where a full chart would be too much.
Replace the stocks array and the demo series generator with your own symbols and price history. The tint follows the sign of each row's change, with both colors in chartConfig, and the class names on ChartContainer set the size. Sparklines are hidden from assistive technology and have no tooltip or keyboard support, so keep the price and percentage text next to them. Animation is off so long lists render without motion.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
Each row shows a symbol and company name, a tiny area chart without axes, the price and a colored badge with the percentage change. The sparkline turns green when the change is positive and red when it is negative, using the up and down colors in chartConfig. The charts are hidden from screen readers because the row text already carries the values. Each sparkline sets isAnimationActive={false} and draws without the enter animation.
Replace the stocks array with your own symbols, prices and changes, and swap the generated series data for real price history. The component takes no props.
Installation
Follow the manual steps under Default and copy this variant's source instead.
Usage
Stacked Expand
Two stacked areas normalized so every month fills 100%, showing each series' share rather than its value.
Two stacked areas stretched so every month fills the full height, turning absolute numbers into shares. Pick it over the regular stacked chart when the split between series matters more than the total.
Replace chartData and rename the series keys in the data, the areas and chartConfig. Every series needs the same stackId to be normalized together. The tooltip shows the original values, not percentages; add a tooltip formatter if readers need the share. Focus the chart and use the arrow keys to move the tooltip between months.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
Desktop and mobile areas share one stack with stackOffset="expand", so the chart shows the proportion of each series rather than raw totals. A value axis on the right reads 0%, 50% and 100%, and the tooltip lists both series.
Replace chartData with your records and change each dataKey to match your fields. Rename the series or change their colors in chartConfig. The component takes no props.
Installation
Follow the manual steps under Default and copy this variant's source instead.
Usage
Stacked
Two areas stacked on top of each other so the top edge shows the combined total, with a legend.
Two series stacked so the top edge shows the combined total, with a legend underneath. Use it when both the total and each part's contribution matter, as in desktop plus mobile traffic.
Replace chartData and rename the series keys in the data, both areas and chartConfig; the legend reads labels and colors from the config. Give every series the same stackId; the first one declared sits at the bottom. Focus the chart and use the arrow keys to move the tooltip between months.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
Desktop and mobile areas are stacked on top of each other with the same stackId, so the top edge shows the combined total. A legend below the plot names both series, and the tooltip lists each value with a dot indicator.
Replace chartData with your records and change each dataKey to match your fields. Add, rename or recolor series in chartConfig; the legend picks the changes up. The component takes no props.
Installation
Follow the manual steps under Default and copy this variant's source instead.
Usage
Step
A single filled area drawn as steps, holding each value flat until the next reading.
A single filled area drawn as steps that hold each value flat until the next reading. It suits values that change in discrete jumps, like prices, plan tiers or inventory counts.
Replace chartData, point each dataKey at your fields and set the label and color in chartConfig. Set the curve type to stepAfter or stepBefore to move the jump to the other side of each point. Focus the chart and use the arrow keys to move the tooltip between months.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Follow the manual steps under Default and copy this variant's source instead.
Usage
Web preview
One series with type="step", which draws flat runs between readings instead of a slope. Use it for values that change at discrete moments, such as prices or plan limits. It has a month axis, a dashed grid and a tooltip.
Replace chartData with your records and change each dataKey to match your fields. Set the label and color in chartConfig. The component takes no props.
Installation
Follow the manual steps under Default and copy this variant's source instead.