Intro to theming

Base UI ships by default with the Light theme. We understand that in some cases you want to change the look and feel of the components. To do so, follow the steps outlined here

Using themeable values in component overrides

All themeable values are available within components that provide the overrides prop.

<Input overrides={{ Input: { style: ({$theme}) => ({color: $theme.colors.primary}), }, }} placeholder="Custom input that uses themeable values" />

To learn more on how overrides work, check out Better Reusable React Components with the Overrides Pattern article.

Creating a custom theme

Define your primitives

Primitives are used to define the colors and fonts for the components. An example for primitives can be found in the light theme primitives.

Define any additional theme overrides

Theme overrides are used to change values in the theme like paddings or borders. To learn more about what you can override, check out the creator.

Putting it all together

In practice, you can define your custom theme using this approach:

import {createTheme, lightThemePrimitives} from 'baseui'; const yourTheme = createTheme( { ...lightThemePrimitives, // add all the properties here you'd like to override from the light theme primitives primaryFontFamily: '"Comic Sans MS", cursive, sans-serif', }, { // add all the theme overrides here - under the hood it uses deep merge animation: { timing100: '0.50s', }, }, );

Next steps

Now that you have a solid understanding of Themes in Base UI, it's time to dive into the default theme values.