Socket
Socket
Sign inDemoInstall

@styled-system/variant

Package Overview
Dependencies
3
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @styled-system/variant

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


Version published
Weekly downloads
476K
decreased by-0.31%
Maintainers
1
Install size
62.9 kB
Created
Weekly downloads
 

Readme

Source

@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

FAQs

Last updated on 17 Feb 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc