Guidance for using and tuning typography.
Shuriken UI provides BaseHeading
, BaseParagraph
and BaseText
components to render titles and body copy. These components share size and weight props and map to an underlying type system to ensure consistent typography throughout your app.
Iam a text paragraph here to show you how to use the typography components. Each one has a configurable size, weight and line height.
<template>
<BaseHeading
as="h4"
size="lg"
weight="semibold"
class="mb-4"
>
Iam a text heading
</BaseHeading>
<BaseParagraph size="md">
Iam a text paragraph here to show you how to
use the typography components. Each one has a
configurable size, weight and line height.
</BaseParagraph>
</template>
You can nest typography components to create rich text formatting.
<template>
<BaseParagraph size="sm">
This is a
<BaseText weight="semibold">
very important
</BaseText>
message!
</BaseParagraph>
</template>
The typographic system is based on a 13 step scale, every step has a corresponding font-size, line-height and letter-spacing value which are all designed to be used in combination.
Size | Font size | Letter spacing | Line height |
---|---|---|---|
xs | 0.75rem | 0 | 1rem |
sm | 0.875rem | 0 | 1.25rem |
md | 1rem | 0 | 1.5rem |
lg | 1.125rem | 0 | 1.75rem |
xl | 1.25rem | 0 | 1.75rem |
2xl | 1.5rem | 0 | 2rem |
3xl | 1.875rem | 0 | 2.25rem |
4xl | 2.25rem | 0 | 2.5rem |
5xl | 3rem | 0 | 1 |
6xl | 3.75rem | 0 | 1 |
7xl | 4.5rem | 0 | 1 |
8xl | 6rem | 0 | 1 |
9xl | 8rem | 0 | 1 |
The following weights are supported. When using the typography components, you can use the weight
prop to set the font weight.
Weight | Default Value |
---|---|
light | 300 |
normal | 400 |
medium | 500 |
semibold | 600 |
bold | 700 |
extrabold | 800 |
Both BaseHeading
and BaseParagraph
components use the --font-sans
and --font-heading
CSS variables to set the font family.
You can override them in your CSS file to use custom fonts, note that fonts should be loaded separately in your project.
@theme {
/** Fonts */
--font-sans: Inter, sans-serif;
--font-heading: Roboto, sans-serif;
}
With this new CSS variables approach, Tailwind v4 is able to infer font classes if your variables start with the --font-*
prefix. If you create a --font-custom
variable, Tailwind will automatically generate classes like font-custom
.
Use the @nuxt/fonts
module to load custom fonts in your Nuxt.js project.
pnpm add -D @nuxt/fonts
export default defineNuxtConfig({
modules: [
'@shuriken-ui/nuxt',
'@nuxt/fonts', ],
fonts: {
experimental: {
processCSSVariables: true, },
},
})