Skip to content

Styles from theme not being applied #1244

Answered by atanasster
danchristian asked this question in Q&A
Discussion options

You must be logged in to vote

@danchristian - its probably a bit confusing, but the styles link is specific that those styles apply for MDX components only.

You can have a couple options:

  1. You can add a heading key in the text theme key:
export const theme = {
  ...
  text: {
  ...
    heading: {
      fontFamily: "heading",
      lineHeight: "heading",
      fontWeight: "heading",
      fontSize: 6
    },
  },
  styles: {
  },
  1. You can use the theme-ui/mdx Styled component:
  <Styled.h2>Components</Styled.h2>
  1. You can use the variant prop to specify the theme key:
<Box as="h2" variant="styles.h2">Components</Box>
or
<Heading variant="styles.h2">Components</Heading >

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@danchristian
Comment options

Answer selected by danchristian
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@danchristian
Comment options

@atanasster
Comment options

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