Skip to content

[Question] How to inherit parent style? #122

@horstleung

Description

@horstleung

Let's say we have a Text component and a Card component

<Card>
     <Text variant="body"/> 
<Card />

The body variant has a color: 'black' style.

What is the restyle way to do if we want to have a inverted card variant?

<Card variant="inverted">
     <Text variant="body"/> 
<Card />


// theme
cardVariants: {
    defaults: {
      backgroundColor: 'cardPrimaryBackground',
    },
    inverted: {
      backgroundColor: 'mainForeground',
      color: 'white' // <-- how to make the children text follow this color?
    }
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions