Customizing
Design tokens are parameters that affect all UI look 'n' feel and they are the main configuration file of a Theme. Component-specific tokens often inherit from global tokens but are named specifically to apply those tokens in component development.
Global Tokens
FastStore uses a default theme called Brandless
, which provides structural styles for your components and pages. Please read Brandless's page to further information about our themeable architecture.
Its presets are defined on src/base/tokens.scss
in @faststore/ui (opens in a new tab) and it's separated in these main areas:
Colors
The store palette with all the tones needed.
See moreTypography
A standard scale and basic definitions for your text:
See morefont family
,weight
andsizes
.Spacing
All tokens used for spacings on the store:
See morepadding
,margins
andsizes
. It's also used as base for grid tokens.Grid & Layout
See morePadding
,Container
,Gaps
andBreakpoints
definitions.Interactive Controls
See moreTap
,States
andSizing
definitions.Refinements
See moreTransition
,Borders
andShadow
definitions.
Build your new theme
- Create a new
.scss
file onsrc/themes
(e.g.my-theme.scss
) in your starter project (opens in a new tab), and add the tokens you want to overwrite inside the.theme
class:
.theme {
// --------------------------------------------------------
// Colors (Branding Core)
// --------------------------------------------------------
// --------------------------------------------------------
// Typography (Branding Core)
// --------------------------------------------------------
// --------------------------------------------------------
// Spacing (UI Essentials)
// --------------------------------------------------------
// --------------------------------------------------------
// Grid & Layout (UI Essentials)
// --------------------------------------------------------
// --------------------------------------------------------
// Interactive Controls (UI Essentials)
// --------------------------------------------------------
// --------------------------------------------------------
// Refinements
// --------------------------------------------------------
// --------------------------------------------------------
// Components
// --------------------------------------------------------
}
- Go to
faststore.config.js
and change thetheme
to your file's name:
// Theming
theme: 'my-theme',
If you want, you can work on custom-theme.scss
file that's ready to use. Also, we provide two themes as examples: soft-blue and midnight.