Skip to content

How to use variants with Box, Flex, etc.? #2010

@TranquilMarmot

Description

@TranquilMarmot

Looking at the docs here: https://theme-ui.com/components/variants

It says:

The following components support the variant prop, but do not include default variant keys.

  • Box
  • Flex
  • etc.

But it does not specify how to use variant with those components. I see with other components, there is a specific "Variant group" in the table (i.e. Grid goes with grids, Button goes with buttons) but there's no variant group for Box or Flex.

Using the Theme type to specify a theme in TypeScript, there is no way to add a boxes variant group. The Box component seems to be looking at a variants key but you also cannot add that in TypeScript.

How do you define variants for Box and all of the other components that don't have their own variant group?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions