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 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 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( { ...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', }, }, );

The shape of the theme file

{
  "breakpoints": {
    "small": 320,
    "medium": 600,
    "large": 1280
  },
  "colors": {
    "primary50": "#EDF3FE",
    "primary100": "#D2E0FC",
    "primary200": "#9CBCF8",
    "primary300": "#548BF4",
    "primary400": "#276EF1",
    "primary": "#276EF1",
    "primary500": "#174EB6",
    "primary600": "#123D90",
    "primary700": "#0C2960",
    "negative50": "#FDF0EF",
    "negative100": "#FADBD7",
    "negative200": "#F4AFA7",
    "negative300": "#EB7567",
    "negative400": "#E54937",
    "negative": "#E54937",
    "negative500": "#AE372A",
    "negative600": "#892C21",
    "negative700": "#5C1D16",
    "warning50": "#FEF3EC",
    "warning100": "#FBE2CF",
    "warning200": "#F6BA8B",
    "warning300": "#F19248",
    "warning400": "#ED6F0E",
    "warning": "#ED6F0E",
    "warning500": "#B4540B",
    "warning600": "#8E4308",
    "warning700": "#5F2C06",
    "positive50": "#EBF8F2",
    "positive100": "#CDEDDE",
    "positive200": "#88D3B0",
    "positive300": "#43B982",
    "positive400": "#07A35A",
    "positive": "#07A35A",
    "positive500": "#057C44",
    "positive600": "#046236",
    "positive700": "#034124",
    "white": "#FFFFFF",
    "mono100": "#FFFFFF",
    "mono200": "#F7F7F7",
    "mono300": "#F0F0F0",
    "mono400": "#E5E5E5",
    "mono500": "#CCCCCC",
    "mono600": "#B3B3B3",
    "mono700": "#999999",
    "mono800": "#666666",
    "mono900": "#333333",
    "mono1000": "#000000",
    "black": "#000000",
    "rating200": "#FFE1A5",
    "rating400": "#FFC043",
    "colorPrimary": "#000000",
    "colorSecondary": "#666666",
    "background": "#FFFFFF",
    "backgroundAlt": "#FFFFFF",
    "backgroundInv": "#000000",
    "foreground": "#000000",
    "foregroundAlt": "#666666",
    "foregroundInv": "#FFFFFF",
    "border": "#CCCCCC",
    "borderAlt": "#B3B3B3",
    "borderFocus": "#276EF1",
    "borderError": "#E54937",
    "buttonPrimaryFill": "#276EF1",
    "buttonPrimaryText": "#FFFFFF",
    "buttonPrimaryHover": "#174EB6",
    "buttonPrimaryActive": "#123D90",
    "buttonSecondaryFill": "#EDF3FE",
    "buttonSecondaryText": "#276EF1",
    "buttonSecondaryHover": "#D2E0FC",
    "buttonSecondaryActive": "#9CBCF8",
    "buttonTertiaryFill": "#F7F7F7",
    "buttonTertiaryText": "#276EF1",
    "buttonTertiaryHover": "#E5E5E5",
    "buttonTertiaryActive": "#CCCCCC",
    "buttonTertiarySelectedFill": "#276EF1",
    "buttonTertiarySelectedText": "#FFFFFF",
    "buttonMinimalFill": "transparent",
    "buttonMinimalText": "#276EF1",
    "buttonMinimalHover": "#F7F7F7",
    "buttonMinimalActive": "#E5E5E5",
    "buttonDisabledFill": "#F0F0F0",
    "buttonDisabledText": "#B3B3B3",
    "breadcrumbsText": "#333333",
    "breadcrumbsSeparatorFill": "#999999",
    "fileUploaderBackgroundColor": "#F7F7F7",
    "fileUploaderBackgroundColorActive": "#EDF3FE",
    "fileUploaderBorderColorActive": "#276EF1",
    "fileUploaderBorderColorDefault": "#CCCCCC",
    "fileUploaderMessageColor": "#B3B3B3",
    "linkText": "#276EF1",
    "linkVisited": "#174EB6",
    "linkHover": "#123D90",
    "shadowFocus": "rgba(39, 110, 241, 0.32)",
    "shadowError": "rgba(229, 73, 55, 0.32)",
    "listHeaderFill": "#FFFFFF",
    "listBodyFill": "#F7F7F7",
    "listIconFill": "#CCCCCC",
    "listBorder": "#CCCCCC",
    "tickFill": "transparent",
    "tickFillHover": "#E5E5E5",
    "tickFillActive": "#CCCCCC",
    "tickFillSelected": "#276EF1",
    "tickFillSelectedHover": "#174EB6",
    "tickFillSelectedHoverActive": "#123D90",
    "tickFillDisabled": "#E5E5E5",
    "tickBorder": "#999999",
    "tickMarkFill": "#FFFFFF",
    "sliderTrackFill": "#B3B3B3",
    "sliderTrackFillHover": "#999999",
    "sliderTrackFillActive": "#666666",
    "sliderTrackFillSelected": "#276EF1",
    "sliderTrackFillSelectedHover": "#174EB6",
    "sliderTrackFillSelectedActive": "#123D90",
    "sliderTrackFillDisabled": "#B3B3B3",
    "sliderHandleFill": "#FFFFFF",
    "sliderHandleFillHover": "#FFFFFF",
    "sliderHandleFillActive": "#FFFFFF",
    "sliderHandleFillSelected": "#FFFFFF",
    "sliderHandleFillSelectedHover": "#FFFFFF",
    "sliderHandleFillSelectedActive": "#FFFFFF",
    "sliderHandleFillDisabled": "#CCCCCC",
    "sliderBorder": "#CCCCCC",
    "sliderBorderHover": "#276EF1",
    "sliderBorderDisabled": "#B3B3B3",
    "inputFill": "#F7F7F7",
    "inputFillEnhancer": "#E5E5E5",
    "inputFillError": "#FDF0EF",
    "inputFillDisabled": "#F0F0F0",
    "inputTextDisabled": "#B3B3B3",
    "menuFillHover": "#F7F7F7",
    "menuFontDefault": "#666666",
    "menuFontDisabled": "#CCCCCC",
    "menuFontHighlighted": "#276EF1",
    "menuFontSelected": "#000000",
    "notificationPrimaryBackground": "#EDF3FE",
    "notificationPrimaryText": "#174EB6",
    "notificationPositiveBackground": "#EBF8F2",
    "notificationPositiveText": "#057C44",
    "notificationWarningBackground": "#FEF3EC",
    "notificationWarningText": "#B4540B",
    "notificationNegativeBackground": "#FDF0EF",
    "notificationNegativeText": "#AE372A",
    "tagBackground": "#FFFFFF",
    "tagNeutralBackground": "#333333",
    "tagPrimaryBackground": "#276EF1",
    "tagPositiveBackground": "#07A35A",
    "tagWarningBackground": "#ED6F0E",
    "tagNegativeBackground": "#E54937",
    "tagRGBGradient": "255, 255, 255",
    "tagRGBGradientSecondary": "0, 0, 0",
    "tableHeadBackgroundColor": "#FFFFFF",
    "toastText": "#FFFFFF",
    "toastPrimaryBackground": "#174EB6",
    "toastPositiveBackground": "#057C44",
    "toastWarningBackground": "#B4540B",
    "toastNegativeBackground": "#AE372A"
  },
  "typography": {
    "font100": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "11px",
      "fontWeight": "normal",
      "lineHeight": "16px"
    },
    "font200": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "12px",
      "fontWeight": "normal",
      "lineHeight": "20px"
    },
    "font250": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "12px",
      "fontWeight": "bold",
      "lineHeight": "20px"
    },
    "font300": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "14px",
      "fontWeight": "normal",
      "lineHeight": "20px"
    },
    "font350": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "14px",
      "fontWeight": "bold",
      "lineHeight": "20px"
    },
    "font400": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "16px",
      "fontWeight": "normal",
      "lineHeight": "24px"
    },
    "font450": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "16px",
      "fontWeight": "bold",
      "lineHeight": "24px"
    },
    "font500": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "20px",
      "fontWeight": "bold",
      "lineHeight": "28px"
    },
    "font600": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "24px",
      "fontWeight": "bold",
      "lineHeight": "36px"
    },
    "font700": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "32px",
      "fontWeight": "bold",
      "lineHeight": "48px"
    },
    "font800": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "40px",
      "fontWeight": "bold",
      "lineHeight": "56px"
    },
    "font900": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "52px",
      "fontWeight": "bold",
      "lineHeight": "68px"
    },
    "font1000": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "72px",
      "fontWeight": "normal",
      "lineHeight": "96px"
    },
    "font1100": {
      "fontFamily": "system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
      "fontSize": "96px",
      "fontWeight": "normal",
      "lineHeight": "116px"
    }
  },
  "sizing": {
    "scale0": "2px",
    "scale100": "4px",
    "scale200": "6px",
    "scale300": "8px",
    "scale400": "10px",
    "scale500": "12px",
    "scale550": "14px",
    "scale600": "16px",
    "scale700": "20px",
    "scale800": "24px",
    "scale900": "32px",
    "scale1000": "40px",
    "scale1200": "48px",
    "scale1400": "56px",
    "scale1600": "64px",
    "scale2400": "96px",
    "scale3200": "128px",
    "scale4800": "192px"
  },
  "lighting": {
    "shadow400": "0 1px 4px hsla(0, 0%, 0%, 0.16)",
    "shadow500": "0 2px 8px hsla(0, 0%, 0%, 0.16)",
    "shadow600": "0 4px 16px hsla(0, 0%, 0%, 0.16)",
    "shadow700": "0 8px 24px hsla(0, 0%, 0%, 0.16)",
    "overlay0": "inset 0 0 0 1000px hsla(0, 0%, 0%, 0)",
    "overlay100": "inset 0 0 0 1000px hsla(0, 0%, 0%, 0.04)",
    "overlay200": "inset 0 0 0 1000px hsla(0, 0%, 0%, 0.08)",
    "overlay300": "inset 0 0 0 1000px hsla(0, 0%, 0%, 0.12)",
    "overlay400": "inset 0 0 0 1000px hsla(0, 0%, 0%, 0.16)",
    "overlay500": "inset 0 0 0 1000px hsla(0, 0%, 0%, 0.2)",
    "overlay600": "inset 0 0 0 1000px hsla(0, 0%, 0%, 0.24)"
  },
  "borders": {
    "border100": {
      "borderColor": "hsla(0, 0%, 0%, 0.04)",
      "borderStyle": "solid",
      "borderWidth": "1px"
    },
    "border200": {
      "borderColor": "hsla(0, 0%, 0%, 0.08)",
      "borderStyle": "solid",
      "borderWidth": "1px"
    },
    "border300": {
      "borderColor": "hsla(0, 0%, 0%, 0.12)",
      "borderStyle": "solid",
      "borderWidth": "1px"
    },
    "border400": {
      "borderColor": "hsla(0, 0%, 0%, 0.16)",
      "borderStyle": "solid",
      "borderWidth": "1px"
    },
    "border500": {
      "borderColor": "hsla(0, 0%, 0%, 0.2)",
      "borderStyle": "solid",
      "borderWidth": "1px"
    },
    "border600": {
      "borderColor": "hsla(0, 0%, 0%, 0.24)",
      "borderStyle": "solid",
      "borderWidth": "1px"
    },
    "radius100": "2px",
    "radius200": "4px",
    "radius300": "8px",
    "radius400": "12px",
    "useRoundedCorners": true
  },
  "animation": {
    "timing100": "0.25s",
    "timing400": "0.4s",
    "timing700": "0.6s",
    "easeOutCurve": "cubic-bezier(.2, .8, .4, 1)",
    "easeInCurve": "cubic-bezier(.8, .2, .6, 1)",
    "easeInOutCurve": "cubic-bezier(0.4, 0, 0.2, 1)"
  },
  "zIndex": {
    "modal": 2000
  },
  "tooltip": {
    "backgroundColor": "#333333"
  }
}

Next steps

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