Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
104 lines (75 sloc) 3.24 KB

import Layout from '../../components/layout'; import JSON from '../../components/json'; import {LightTheme} from 'baseui';

export default Layout;

Intro to theming

Base Web 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: {
      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.

The ThemeProvider

With the ThemeProvider, you can apply a theme to your application locally. By default, Base Web ships with a light and a dark theme. For global theming, please refer to the BaseProvider.

If you'd like to use a different theme in one part of your application,
you can locally wrap that part with the ThemeProvider to override the theme locally:

import {DarkTheme, ThemeProvider} from 'baseui';

export default function SomeDarkThemedPages() {
  return (
    <ThemeProvider theme={DarkTheme}>
        This is a dark themed page - all the Base Web components used here will
        use the dark theme, as well as the theme object accessed through the
        styled function will use the values from the dark theme

Creating a custom theme

Define your primitives

Primitives are used to define the colors and fonts for the components. An example of 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(
    // 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',

If you are using flow type with a custom theme, visit the styled function page for more information.

The shape of the theme file

Next steps

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

You can’t perform that action at this time.