Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwriting variant styles #56

Open
aidana12 opened this issue Oct 25, 2021 · 0 comments
Open

Overwriting variant styles #56

aidana12 opened this issue Oct 25, 2021 · 0 comments

Comments

@aidana12
Copy link
Member

It seems it’s not possible to easily overwrite the styles of a variant.

E.g. if I want to change the font weight by adding the fontWeight prop:

<Heading fontWeight="regular" variant="h1">
   Heading 1
</Heading>

adding fontWeight prop doesn’t overwrite the styles of the variant, it still has fontWeight bold as set in the variant object:

baseStyles: {
    color: 'grey900',
    // fontWeight: 'bold',
  },

  variants: {
    variant: {
      h1: {
        fontSize: [5, 8],
        lineHeight: '120%',
        letterSpacing: 'revert',
        fontWeight: 'bold',
      },
      ...
    }
  }
}

It doesn’t matter whether the fontWeight property is in the base styles or the variant styles, both cannot be overwritten with a simple fontWeight prop.

Screenshot 2021-10-25 at 09 18 33

Overwriting variants isn’t a thing we do often (neither should we do it often), but sometimes it is needed. I know we can overwrite it in other ways, but would be nice if it was possible to do it with a style prop just like it was before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant