@styled-system/variant
Read the docs: https://styled-system.com/variants
Last updated 6 years ago by jxnblk .
MIT · Original npm
$ cnpm install @styled-system/variant 
SYNC missed versions from official npm registry.

@styled-system/variant

Read the docs: https://styled-system.com/variants

Usage

import styled from 'styled-components'
import variant from '@styled-system/variant'

const Button = styled('button')(
  variant({
    variants: {
      primary: {
        color: 'white',
        bg: 'primary',
        ':hover': {
          bg: 'black',
        }
      },
      secondary: {
        color: 'white',
        bg: 'secondary',
        ':hover': {
          bg: 'black',
        }
      },
    }
  })
)

// <Button variant='primary' />
// <Button variant='secondary' />

Options

  • variants: object of theme-aware variant styles with user-defined shape
  • prop: (default variant) custom prop name for variant
  • scale: optional theme key for adding variants to the theme object

MIT License

Current Tags

  • 5.0.0-alpha.0                                ...           alpha (6 years ago)
  • 5.1.5                                ...           latest (6 years ago)
  • 5.0.0-12                                ...           next (6 years ago)

3 Versions

  • 5.0.0-12                                ...           6 years ago
  • 5.0.0-alpha.0                                ...           6 years ago
  • 5.1.5                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org