Skip to content

Font Styles not getting applied by default #2035

Answered by hasparus
Altair2169 asked this question in Q&A
Discussion options

You must be logged in to vote

The "fonts" property in the theme is a scale. This is where you define design tokens — you prepare ingredients for later use.

Other things can grab these tokens from scales and use them.

As you noticed, body styles we apply use colors.background, but you can use these scales yourself with sx prop and variants.

import { Heading } from "theme-ui";

<Heading>Woop</Heading>; // uses fontFamily: "heading" internally

<Heading as="h3" sx={{ fontFamily: "subHeading" }}>
And we can use previously defined tokens in "sx" prop.
</Heading>;

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Altair2169
Comment options

@hasparus
Comment options

@Altair2169
Comment options

Answer selected by Altair2169
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants