current theme: placeholder

Docs :: Tokens

File nameSource
settings.tokens.cssGithub

Design tokens are the “atoms” of a design system. They define the design elements of a user interface, such as colors, typography, and spacing.

In mCSS, tokens are CSS custom properties that provide a flexible, coherent, and harmonious set of values designed to make implementing UI/UX projects fast and easy.

How to use tokens

When you start a new project, open settings.tokens.css and change the values of as many tokens as necessary to match the design you’re planning to implement. (Things like spacing might not need to change, but you’ll almost certainly need to customize your base and primary colors for instance.)

Themes offer an additional layer of abstraction for tokens (ie. settings.theme.default.css). These tokens only ever take another token for value and are useful to standardize UI elements in logical groups. For example, you can have a --light-border-color with a value of --base-100. This allows you to create tokens with meaning and context which makes them more intuitive to use.

elements.*, global.*, and page.* files tend to use abstracted theme tokens, while component.* generally use low level tokens. There are no hard and fast rules about the type of token you should use in your custom component. Just try to think where else this style is used in the design and if it comes up in many places with the same context, a new theme token is probably the best option.

Dimension

Dimension tokens can be used anywhere you need to set margin, padding, width, height, etc.

TokenValueDemo
xs14px
xs28px
xs312px
sm116px
sm220px
sm324px
md128px
md232px
md336px
lg140px
lg244px
lg348px
xl156px
xl264px
xl380px
xxl196px
xxl2112px
xxl3128px
mega1160px
mega2192px
mega3224px
giga1256px
giga2288px
giga3320px
tera1384px
tera2480px
tera3520px

Aspect ratio

TokenValueDemo
ar-square1
ar-landscape4/3
ar-portrait3/4
ar-widescreen16/9
ar-golden1.618/1

Typography

Font stack

There are 3 font stacks set up by default for the font-family CSS Property.

TokenValue
textui-sans-serif, system-ui, sans-serif
displayAvenir, Montserrat, Corbel, URW Gothic, source-sans-pro, ui-sans-serif, sans-serif
monospaceDank Mono, Inconsolata, Fira Mono, SF Mono, Monaco, Droid Sans Mono, Source Code Pro, Cascadia Code, Menlo, Consolas, DejaVu Sans Mono, ui-monospace, monospace

These stacks are optimized for fonts available on device, to maximize for speed and alleviate any layout shifts or flashes. You can find more stacks at Modern Font Stacks.

If you’d like to bring in your own fonts or Google fonts, you can override the display and text tokens inside your theme file.

Font size

Check out typescale.com if you need help creating your own sizes.

TokenValueDemo
text-xs0.694rem
Sample demo text
text-sm0.833rem
Sample demo text
text-md1rem
Sample demo text
text-lg1.2rem
Sample demo text
text-xl1.44rem
Sample demo text
display-sm1.728rem
Sample demo text
display-md2.074rem
Sample demo text
display-lg2.488rem
Sample demo text
display-xl2.986rem
Sample demo text
display-mega3.583rem
Demo text
display-giga4.299rem
Demo text

Font weight

TokenValueDemo
extra-light200
Sample demo text
light300
Sample demo text
book400
Sample demo text
semi-bold600
Sample demo text
bold700
Sample demo text
black900
Sample demo text

Letter spacing

TokenValueDemo
tracking-sm-0.05em
Sample demo text
tracking-md0.025em
Sample demo text
tracking-lg0.05em
Sample demo text
tracking-xl0.075em
Sample demo text
tracking-xxl0.15em
Sample demo text

Line height

TokenValueDemo
leading-xs1
Sample demo text
leading-sm1.15
Sample demo text
leading-md1.375
Sample demo text
leading-lg1.5
Sample demo text
leading-xl1.75
Sample demo text
leading-xxl2
Sample demo text

Color

Check out tints.dev if you want to make your own palettes programmatically.

Base

TokenValueDemo
base-0#fff
base-50#f6f7f9
base-100#edeef1
base-200#d6dbe1
base-300#b2bbc7
base-400#8897a8
base-500#697a8e
base-600#546375
base-700#4a5666
base-800#3c4550
base-900#353c45
base-950#23282e

Primary

TokenValueDemo
primary-50#f0f9ff
primary-100#e0f2fe
primary-200#bae6fd
primary-300#7dd3fc
primary-400#38bdf8
primary-500#0ea5e9
primary-600#0284c7
primary-700#0369a1
primary-800#075985
primary-900#0c4a6e
primary-950#082f49

Feedback

TokenValueDemo
yes-100#d5f6e8
yes-200#afebd4
yes-300#7adbbd
yes-400#46c4a0
yes-500#13886d
no-100#ffe4e6
no-200#fecdd3
no-300#fda4af
no-400#fb7185
no-500#e11d48
maybe-100#fff7d6
maybe-200#fff0b3
maybe-300#ffd64a
maybe-400#ffc220
maybe-500#f9a007

Borders

Border radius

TokenValueDemo
radius-sm3px
radius-md5px
radius-lg8px
radius-xl12px
radius-xxl16px
radius-round1e5px

Border width

TokenValueDemo
border-sm1px
border-md2px
border-lg4px
border-xl8px
border-xxl12px

Drop Shadow

It wouldn’t be super useful to list the values here. You can look at them on Github if you’re curious.

TokenDemo
shadow-sm
shadow-md
shadow-lg
shadow-xl
shadow-xxl

Opacity

TokenValue
o-00
o-10.2
o-20.4
o-30.6
o-40.8
o-51

Z-index

TokenValue
z-bottom-1000000000
z-00
z-110
z-220
z-330
z-440
z-550
z-top1000000000

Transition

TokenValue
transition220ms ease-in-out
transition-fast100ms ease-in-out