Theming

Introduction

@deity/falcon-ui ships with powerful ThemeProvider based theming capabilities. Every component has default theme built-in, providing a consistent and pleasing look and feel out of the box, yet giving possibility to customize it in every detail.

Default theme

Default theme is influenced by constraint-based design system principles, based on typographic scale and 8px grid. It specifies font sizes, colors, spacings as well as many other values needed for creating consistent, systematic design. You can see all theme default values specified in source code, or

to view them in more visually pleasant way.

When using ThemeProvider without specifying theme prop, default theme is being used.

Additional resources

Customizing theme

All theme related customizations are done using createTheme function by providing necessary overrides and passing its output as theme prop to ThemeProvider. Example below shows how to override primary color and font family.

Theme customization

You can play around with theme values via

and see generated code on Theme editor's Download tab.

In addition to ovderriding default theme values, there is an easy way to override each component theme, via components section as shown below:

Component level theme customization

Every component accepts all of the responsive, theme-based style props as well as css prop.

The easiest way to find component key to use in components object in theme object is to use Theme Editor's Component Locator. Just click on the icon on the right to activate it and hover over interesting component to display it's key to use in components object (for example Card component below).

Custom themed components

In addition to built-in components, there is an easy way to create custom components with default theme that also plugin-in into the general theming system. This can be accomplished by themed factory as in example below.

tag specifies html tag Element will be rendered as, which can be overriden via as prop as shown in example below. defaultTheme accepts object with single key that will be key used in theme components section to overrride default components styles.

Custom theme based card component
Custom theme based card component rendered as an article

Theme

Component

Presets

Download


Colors
Spacing
Typography
Breakpoints
Borders
Miscellaneous