React Native · Components
Chart
Chart: bar, line, area, pie, donut and scatter.
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Preview
| ay | Revenue | Expenses |
|---|---|---|
| Jan | $42,000 | $36,000 |
| Feb | $50,094 | $36,865 |
| Mar | $56,509 | $36,442 |
| Apr | $60,131 | $35,224 |
| May | $60,785 | $33,903 |
| Jun | $59,292 | $33,193 |
| Jul | $57,196 | $33,660 |
| Aug | $56,245 | $35,581 |
| Sep | $57,800 | $38,878 |
| Oct | $62,380 | $43,135 |
| Nov | $69,488 | $47,702 |
| Dec | $77,777 | $51,852 |
Code
Events
- Events appear here when you interact with the preview.
Zoom: 100,000 points, range navigator and the selected range
Zooming on categories: 36 months, the last 12 at first
| ay | Revenue | Expenses |
|---|---|---|
| Jan 24 | 42K | 36K |
| Feb 24 | 48.4K | 36.2K |
| Mar 24 | 53.1K | 35K |
| Apr 24 | 55K | 33.1K |
| May 24 | 54K | 31.1K |
| Jun 24 | 50.8K | 29.7K |
| Jul 24 | 47K | 29.5K |
| Aug 24 | 44.3K | 30.7K |
| Sep 24 | 44.2K | 33.3K |
| Oct 24 | 47.1K | 36.8K |
| Nov 24 | 52.5K | 40.7K |
| Dec 24 | 59.1K | 44.2K |
| Jan 25 | 65.1K | 46.6K |
| Feb 25 | 69K | 47.6K |
| Mar 25 | 70K | 47.1K |
| Apr 25 | 68.1K | 45.6K |
| May 25 | 64.5K | 43.5K |
| Jun 25 | 60.9K | 41.7K |
| Jul 25 | 58.9K | 40.7K |
| Aug 25 | 59.7K | 41.1K |
| Sep 25 | 63.5K | 43K |
| Oct 25 | 69.5K | 46K |
| Nov 25 | 76.1K | 49.8K |
| Dec 25 | 81.6K | 53.6K |
| Jan 26 | 84.6K | 56.7K |
| Feb 26 | 84.6K | 58.5K |
| Mar 26 | 82K | 58.8K |
| Apr 26 | 78.2K | 57.9K |
| May 26 | 75K | 56K |
| Jun 26 | 73.8K | 54K |
| Jul 26 | 75.6K | 52.4K |
| Aug 26 | 80.2K | 52K |
| Sep 26 | 86.6K | 53.1K |
| Oct 26 | 93K | 55.5K |
| Nov 26 | 97.8K | 58.9K |
| Dec 26 | 99.9K | 62.8K |
Inside a card: title, summary and bars + a line (target) together
Revenue and target
| ay | Revenue | Target |
|---|---|---|
| Jan | $42,000 | $50,000 |
| Feb | $50,094 | $52,500 |
| Mar | $56,509 | $55,000 |
| Apr | $60,131 | $57,500 |
| May | $60,785 | $60,000 |
| Jun | $59,292 | $62,500 |
| Jul | $57,196 | $65,000 |
| Aug | $56,245 | $67,500 |
| Sep | $57,800 | $70,000 |
| Oct | $62,380 | $72,500 |
| Nov | $69,488 | $75,000 |
| Dec | $77,777 | $77,500 |
Sparkline: stat boxes (server component)
Horizontal bars, long names and value labels
| city | Sales |
|---|---|
| İstanbul | 1,840 |
| Ankara | 920 |
| İzmir | 760 |
| Bursa | 410 |
| Antalya | 380 |
Negative values: profit / loss
| ay | Net |
|---|---|
| Jan | 0 |
| Feb | 10.1K |
| Mar | 10.9K |
| Apr | 1.7K |
| May | -9.1K |
| Jun | -11.5K |
| Jul | -3.4K |
| Aug | 7.9K |
Import
Chart
componentChart: bar, line, area, pie, donut and scatter. Calculations are the same as web's Chart (@yasinsensoy/core/chart): axis range, nice ticks, abbreviated numbers, date axis, downsampling. Drawing uses our own native view; no external library, identical on iOS and Android.
- Touch: dragging a finger sideways makes the tooltip follow the values; vertical dragging scrolls the page. Tapping an empty area closes the tooltip.
- Legend: appears with multiple series; tapping hides a series. Colors are bound to series, so hiding one does not change the others.
- Colors come from the theme's
chartpalette and change automatically in dark theme.
Examples
Sparkline
componentSmall chart showing a trend next to text or a number (no axes). Its width fits the container; drawing uses the same paths as web's Sparkline.
Examples
ChartCurve
typeShape of the line between points.
ChartType
typeChart type. See ChartProps.type.
ChartSeries
interfaceDetailed definition of a Chart series (same as web).
| Name | Type | Default | Description |
|---|---|---|---|
key | Key<T> | (string & {}) | Field the value is read from. It is the series' ID; must be unique. | |
label? | string | key | Name in the legend and tooltip. |
color? | ChartColor | its position in the palette | Color. |
type? | ChartSeriesType | the chart's `type | Drawing type of this series (bars + line together). |
value? | (row: T) => number | null | undefined | Reads the value from a function. | |
format? | ChartFormat | the chart's `format | Value format of this series. |
curve? | ChartCurve | the chart's `curve | Line curve. |
dashed? | boolean | Dashed line. | |
dots? | boolean | true` with few points | Show points on the line. |
hidden? | boolean | The series starts hidden; can be shown from the legend. |
ChartFormat
typeFormat of chart values (y axis, tooltip, labels).
"number": Locale-grouped number (12,480). On the axis, values above 10,000 are abbreviated (12.5K)."compact": Abbreviated everywhere (1.2M)."percent": A ratio as a percentage (0.25→25%)."currency": Money ($1,250.00); the unit comes from theUIProvidercurrencysetting or the chart'scurrencyprop.Intl.NumberFormatOptions: Full control (e.g.{ style: "unit", unit: "kilogram" }).- Function: Your own format (e.g.
(v) =>${v} pcs``).
ChartSeriesType
typeHow a series is drawn. In bar and line charts it may differ per series.
ChartColor
typeColor: a tone ("success"), a palette index ("chart-3") or any CSS color ("#7c3aed", "var(--brand)"). When omitted, series take --ui-chart-1 … --ui-chart-8 in order.
ChartXFormat
typeFormat of chart x values (axis and tooltip title).
"date": Day (Oct 29, 2026),"datetime": day and time,"time": time,"month": month and year,"year": year.Intl.DateTimeFormatOptions: Full control.- Function: Your own format; receives the raw x value.
When omitted, dates are formatted automatically by time range and other values are written as is.
ChartReference
interfaceA horizontal or vertical reference line (target, average, limit).
| Name | Type | Default | Description |
|---|---|---|---|
value | number | Value of the line (on the y axis; on the value axis for horizontal bars). | |
label? | string | Short text next to the line (e.g. "Target"). | |
tone? | Tone | "neutral" | Color. |
ChartPoint
interfaceA data point; passed in the press event.
| Name | Type | Description |
|---|---|---|
row | T | The row itself. |
index | number | Index of the row in data. |
series | string | key of the series. |
value | number | null | Value (null = empty). |
ChartTooltipItem
interfaceA row in the tooltip.
| Name | Type | Description |
|---|---|---|
key | string | key of the series. |
label | string | Name of the series. |
color | string | Color of the series. |
value | number | null | Value (null = empty). |
formatted | string | Formatted value. |
share? | number | Share in a percent stack or pie (0–1). |
ChartTooltipInfo
interfaceInfo passed to ChartProps.renderTooltip.
| Name | Type | Description |
|---|---|---|
title | string | Title: the formatted x value; the slice name in a pie. |
row | T | undefined | The row (undefined for the "Other" slice). |
index | number | Index of the row (-1 for the "Other" slice). |
items | ChartTooltipItem[] | Values of the series. |
ChartProps
interfaceProps of Chart. Names match web's Chart.
| Name | Type | Default | Description |
|---|---|---|---|
data | readonly T[] | Rows. For large data keep the array stable with useMemo. | |
type? | ChartType | "bar" | Chart type: bar, line, area, pie, donut, scatter. |
x | Key<T> | ((row: T) => unknown) | Field of the x value (category, date or number). The slice name in a pie. | |
series | Key<T> | readonly (Key<T> | ChartSeries<T>)[] | Values to draw: a field, fields or detailed definitions. | |
label? | string | Screen reader name (e.g. "Monthly revenue"). | |
height? | number | 260`, `240` for pies | Height of the plot area. Width fits the container. |
stacked? | boolean | "percent" | Stacks bar and area series; "percent" is a 100% stack. | |
horizontal? | boolean | Horizontal bars. | |
curve? | ChartCurve | "smooth" | Line curve. |
dots? | boolean | true` with few points | Points on lines. |
legend? | boolean | "top" | "bottom" | "bottom"` with multiple series and for pies | Legend; tapping hides/shows a series. |
tooltip? | boolean | true | Tooltip showing values on tap and while dragging a finger. |
renderTooltip? | (info: ChartTooltipInfo<T>) => ReactNode | Render the tooltip content yourself. | |
grid? | boolean | true | Grid lines. |
xAxis? | boolean | true | x-axis labels. |
yAxis? | boolean | true | Value axis labels. |
format? | ChartFormat | "number" | Value format. |
xFormat? | ChartXFormat | Format of x values. | |
yMin? | number | Lower bound of the value axis. | |
yMax? | number | Upper bound of the value axis. | |
labels? | boolean | Value labels (only those that fit). | |
references? | readonly ChartReference[] | Reference lines (target, average). | |
colors? | readonly ChartColor[] | Colors to use in order. | |
barSize? | number | 32 | Maximum bar thickness. |
center? | ReactNode | false | Center of the donut; defaults to the total, or the tapped slice. false leaves it empty. | |
maxSlices? | number | 8 | Maximum slices in a pie; the rest are grouped into "Other". |
loading? | boolean | Data loading: faded if there is data, a skeleton otherwise. | |
empty? | ReactNode | the {@link UIProvider} `chartEmpty` text | Content shown when there is no data. |
animate? | boolean | true | Fade in on mount. Off while "reduce motion" is on. |
onPointClick? | (point: ChartPoint<T>) => void | When a value is tapped. | |
zoom? | boolean | ChartZoomOptions | Zoom (except pies): pinch with two fingers, pan with one finger while zoomed, double-tap to reset; +/−/reset buttons in the corner. | |
range? | ChartRange | null | Visible range (controlled). null is all data. Pass it together with onRangeChange. See ChartRange. | |
defaultRange? | ChartRange | Initial visible range (uncontrolled). | |
onRangeChange? | (range: ChartRange | null) => void | When the visible range changes; null when back to all. May be called on every move while zooming; defer expensive work. | |
locale? | string | {@link UIProvider} `locale | Locale. |
currency? | string | {@link UIProvider} `currency | Currency. |
style? | StyleProp<ViewStyle> | Container style. |
ChartRangeValue
typeValue of the ChartRange ends: an x value (category name, number or date).
ChartRange
typeVisible range: two end x values (same as web).
ChartZoomOptions
interfaceSettings of ChartProps.zoom.
| Name | Type | Default | Description |
|---|---|---|---|
toolbar? | boolean | true | Zoom out / zoom in / reset buttons at the top right. |
SparklineProps
interfaceProps of Sparkline.
| Name | Type | Default | Description |
|---|---|---|---|
data | readonly (number | null | undefined)[] | Values; null is a gap. | |
type? | "line" | "area" | "bar" | "line" | Drawing type. |
color? | ChartColor | "chart-1" | Color: a semantic color, "chart-3" or any color. |
height? | number | 32 | Height (px). Width fits the container. |
endDot? | boolean | true | Highlight the last value with a dot (line and area). |
label? | string | Screen reader text (e.g. "Last 12 months: rising"). Hidden if not given. | |
style? | StyleProp<ViewStyle> | Container style (for width). |