The DataThemeProvider is a context provider that allows you to override the default app-level data-viz styles configuration.
Simple setup
Wrap your app with DataThemeProvider and pass the style configuration as props.
Advanced setup
You can create a single source of truth for all style configuration in a separate file, for example once-ui.config.js. We also recommend using a Providers component to wrap your app.
API reference
DataThemeProvider
Prop
Type
Default
children
React.ReactNode
—
variant
flat•gradient•outline
gradient
mode
categorical•divergent•sequential
categorical
height
number
24
axis
{ stroke: string }
—
tick
{ fill: string; fontSize: number; line: boolean }
—
useDataTheme
useDataTheme() returns the current chart options plus a setter, so a control
can change how every chart on the page draws without each chart being rewired.
It throws outside a DataThemeProvider.setChartOptions takes a partial: anything you leave out keeps its current
value.