Utilities for controlling the font family of an element.
export default {
theme: {
extend: {
fontFamily: {
sans: ['ui-sans-serif', 'system-ui'],
serif: ['ui-serif', 'Georgia'],
mono: ['ui-monospace', 'SFMono-Regular'],
display: ['Oswald'],
body: ['Open Sans'],
},
},
},
}
Font families can be specified as an array or as a simple comma-delimited string:
{
// Array format:
"sans": ["Helvetica", "Arial", "sans-serif"],
// Comma-delimited format:
"sans": "Helvetica, Arial, sans-serif",
}
Note that Windi CSS does not automatically escape font names for you. If you're using a font that contains an invalid identifier, wrap it in quotes or escape the invalid characters.
{
// Won't work:
"sans": ["Exo 2", /* ... */],
// Add quotes:
"sans": ["\"Exo 2\"", /* ... */],
}
Utilities for controlling the font size of an element.
export default {
theme: {
fontSize: {
'xs': '.75rem',
'sm': '.875rem',
'tiny': '.875rem',
'base': '1rem',
'lg': '1.125rem',
'xl': '1.25rem',
'2xl': '1.5rem',
'3xl': '1.875rem',
'4xl': '2.25rem',
'5xl': '3rem',
'6xl': '4rem',
'7xl': '5rem',
},
},
}
You can provide a default line-height for each of your font-sizes using a tuple of the form [fontSize, lineHeight] in your windi.config.js file.
export default {
theme: {
fontSize: {
sm: ['14px', '20px'],
base: ['16px', '24px'],
lg: ['20px', '28px'],
xl: ['24px', '32px'],
},
},
}
If you also want to provide a default letter-spacing value for a font size, you can do so using a tuple of the form [fontSize, { letterSpacing, lineHeight }]
in your windi.config.js file.
export default {
theme: {
fontSize: {
'2xl': ['24px', {
letterSpacing: '-0.01em',
}],
// Or with a default line-height as well
'3xl': ['32px', {
letterSpacing: '-0.02em',
lineHeight: '40px',
}],
},
},
}
Utilities for controlling the font smoothing of an element.
Utilities for controlling the style of text.
Utilities for controlling the font weight of an element.
export default {
theme: {
fontWeight: {
'hairline': 100,
'extra-light': 100,
'thin': 200,
'light': 300,
'normal': 400,
'medium': 500,
'semibold': 600,
'bold': 700,
'extrabold': 800,
'extra-bold': 800,
'black': 900,
},
},
}
Utilities for controlling the variant of numbers.
The hyphens utilities specifies how words should be hyphenated when text wraps across multiple lines. It can prevent hyphenation entirely, hyphenate at manually-specified points within the text, or let the browser automatically insert hyphens where appropriate.
Utilities for controlling the tracking (letter spacing) of an element.
export default {
theme: {
letterSpacing: {
tightest: '-.075em',
tighter: '-.05em',
tight: '-.025em',
normal: '0',
wide: '.025em',
wider: '.05em',
widest: '.25em',
},
},
}
Utilities for controlling the leading (line height) of an element.
export default {
theme: {
extend: {
lineHeight: {
'extra-loose': '2.5',
},
},
},
}
The tab-size utilities are used to customize the width of tab characters (U+0009).
export default {
theme: {
tabSize: {
sm: '2',
md: '4',
lg: '8',
},
},
}
Utilities for controlling the alignment of text.
Utilities for controlling the text color of an element.
export default {
theme: {
textColor: {
primary: '#3490dc',
secondary: '#ffed4a',
danger: '#e3342f',
},
},
}
Utilities for controlling the decoration of text.
Utilities for controlling the type of text decoration.
Utilities for controlling the color of text decoration.
export default {
theme: {
textDecorationColor: {
primary: '#3490dc',
secondary: '#ffed4a',
danger: '#e3342f',
},
},
}
Utilities for controlling the style of text decoration.
Utilities for controlling the thickness of text decorations.
export default {
theme: {
extend: {
textDecorationLength: {
sm: '1px',
md: '2px',
lg: '4px',
},
},
},
}
Utilities for controlling the offset of text decoration.
export default {
theme: {
textDecorationOffset: {
sm: '1px',
md: '2px',
lg: '4px',
},
},
}
Utilities for controlling the opacity of an element's decoration color. This is a fallback of Text Decoration Color beginning with WindiCSS v3.4.0.
export default {
theme: {
extend: {
textDecorationOpacity: {
10: '0.1',
20: '0.2',
95: '0.95',
},
},
},
}
Utilities for controlling the indentation of text.
export default {
theme: {
extend: {
textIndent: {
'4xl': '5rem',
'5xl': '6rem',
},
},
},
}
Utilities for controlling the opacity of an element's text color.
export default {
theme: {
extend: {
textOpacity: {
10: '0.1',
20: '0.2',
95: '0.95',
},
},
},
}
Utilities for controlling the shadow of a text element.
export default {
theme: {
textShadow: {
'DEFAULT': '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)', // If a DEFAULT shadow is provided, it will be used for the non-suffixed shadow utility.
'2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
'3xl': '0 35px 60px -15px rgba(0, 0, 0, 0.3)',
},
},
}
Utilities for controlling the stroke of a text element.
Utilities for controlling the width of text stroke.
export default {
theme: {
extend: {
textStrokeWidth: {
'xl': '6',
'2xl': '8',
},
},
},
}
Utilities for controlling the color of text stroke.
export default {
theme: {
textStrokeColor: {
primary: '#3490dc',
secondary: '#ffed4a',
danger: '#e3342f',
},
},
}
Utilities for controlling the transformation of text.
Utilities for controlling text overflow in an element.
Utilities for controlling the vertical alignment of an inline or table-cell box.
Utilities for controlling an element's white-space property.
Utilities for controlling word breaks in an element.
The writing-mode
utility sets whether lines of text are laid out horizontally or vertically, as well as the direction in which blocks progress. When set for an entire document, it should be set on the root element (html element for HTML documents).
The writing-orientation
utility sets the orientation of the text characters in a line. It only affects text in vertical mode (when writing-mode
is not horizontal-tb
). It is useful for controlling the display of languages that use vertical script, and also for making vertical table headers.