npm

@vue-styled-system/variant

5.1.11 • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @vue-styled-system/variant

Weekly Downloads

1

Version

5.1.11

License

MIT

Unpacked Size

10.9 kB

Total Files

7

Last publish

Collaborators

  • kwanpham