This repository contains the files with the configuration of the Design Tokens for TailwindCSS and DaisyUI that can be used with Tokens Studio for Figma (Figma Tokens).
Design Tokens are a way of abstracting design values into reusable, single sources of truth represented as data, that ensure systematically unified and cohesive product experiences. These values can include colors, typography, spacing, and more. By using Design Tokens, you can create a unified and consistent design system.
To use these Design Tokens, you need to have the Tokens Studio for Figma (Figma Tokens) plugin installed in your Figma account. Once installed, you can import the JSON files into your Tokens Studio and use them to create your design system.
These files were made with the standard version of the plugin without the Advanced themes or Compositions options that require a Pro account.
The files are divided into diferents sets, although in this way it is not possible to use Multi File Sync (Pro).
This repository contains the following files:
- core.tw.figmaTokens.json: A JSON file containing the global configuration of the Design Tokens for TailwindCSS v.3.
- light.daisy.json and dark.daisy.json: A JSON file containing the configuration of the Design Tokens for DaisyUI with the variables of the default light and dark theme.
-
Spacing:
spacing
- Same as TW, the spacing scale is inherited by the
padding
,margin
,widht
,height
,maxHeight
,gap
,inset
, andspace
using this token reference as value. - To build the spacing tokens, it's constructed using this formula:
{fontSize.base} * (value in rem)
without rem/px. More information about using Math: Link.
- Same as TW, the spacing scale is inherited by the
-
Typography:
typography
- Values:
fontFamily
,fontWeight
,lineHeight
,fontSize
,letterSpacing
,paragraphSpacing
,paragraphIndent
,textDecoration
,textTransform
.
- Values:
-
Color:
colors
- In addition to the 5 gray palettes, there's an extra one called
default-gray
that you can use as a token reference and quickly replace the main palette.{colors.default-gray.400} = {color.slate.400}
- The
primary
,secondary
,status
orbase
tokens are being used in the DaisyUI file.
- In addition to the 5 gray palettes, there's an extra one called
-
Sizing:
sizing
andscreens
sizing
use the token referencesspacing
for width and height values.
-
Border Radius:
borderRadius
-
Border Width:
borderWidth
-
Border:
borderStyle
-
Opacity:
opacity
-
Box Shadow:
boxShadow
-
Font Family:
fontFamily
- The
fontFamily.sans
has the value"SF Pro, system-ui, sans-serif"
. It uses the Mac system font SF Pro and it doesn't use the allowedsystem-ui
by Figma, in order to use the variable typography values. - Also, you can remove
SF Pro
to usesystem-ui
, replace it with the variable typographySegoe UI
from Windows, or use any other typography.
- The
-
Font Weight:
FontWeight
- The default TW configuration includes the
fontWeights
:thin
,extralight
,light
,normal
,medium
,semibold
,bold
,extrabold
, andblack
. - They have been expanded with the
fontStretch
no available in TW:default
,italic
,compressed
,condensed
, andexpanded
from the SF Pro variable font.
- The default TW configuration includes the
-
Line Height:
lineHeight
-
Font Size:
fontSize
- Calculated
fontSize
tokens based on{fontSize.base}
.
- Calculated
-
Letter Spacing:
letterSpacing
-
Paragraph Spacing:
paragraphSpacing
-
Text Case:
textTransform
-
Text Decoration:
textDecoration
-
Dimension:
dimension
dimension
use the token referencesspacing
.- This token is introduced in order to support the upcoming W3C format: Link
Full default config JSON for Tailwind 3.2.7: Link
-
Color:
d_colors
:d_colors.semantic
,d_colors.base
andd_colors.status
. -
Border Radius:
d_borderRadius
-
Border Width:
d_borderWidth
-
Text Case:
d_textTransform
-
Other:
d_other.buttons
The light and dark themes use a prefix to differentiate themselves from TW since they use the same reference. However, both of these themes use the same prefix=d_
to show the theme change when using Apply to selection
and changing the active set.
[data-theme="light"] {
color-scheme: light;
--p: {d_colors.semantic.primary};
--s: {d_colors.semantic.secondary};
--a: {d_colors.semantic.accent};
--n: {d_colors.base.neutral};
--b1: {d_colors.base.base-100};
}
[data-theme="light"] {
color-scheme: light;
--in: {d_colors.status.info};
--inc: {d_colors.status.info-content};
--su: {d_colors.status.success};
--suc: {d_colors.status.success-content};
--wa: {d_colors.status.warning};
--wac: {d_colors.status.warning-content};
--er: {d_colors.status.error};
--erc: {d_colors.status.error-content};
--rounded-box: {d_borderRadius.rounded-box};
--rounded-btn: {d_borderRadius.rounded-btn};
--rounded-badge: {d_borderRadius.rounded-badge};
--animation-btn: ;
--animation-input: ;
--btn-text-case: {d_textTransform.btn-text-case};
--btn-focus-scale: {d_others.btn-focus-scale};
--border-btn: {d_borderWidth.border-btn};
--tab-border: {d_borderWidth.tab-border};
--tab-radius: {d_borderRadius.tab-radius};
--pf: {d_colors.semantic.primary-focus};
--pc: {d_colors.semantic.primary-content};
--sf: {d_colors.semantic.secondary-focus};
--sc: {d_colors.semantic.secondary-content};
--af: {d_colors.semantic.accent-focus};
--ac: {d_colors.semantic.accent-content};
--nf: {d_colors.base.neutral-focus};
--nc: {d_colors.base.neutral-content};
--b2: {d_colors.base.base-200};
--b3: {d_colors.base.base-300};
--bc: {d_colors.base.base-content};
}
If you would like to contribute to this repository, feel free to create a pull request with your changes.