Socket
Socket
Sign inDemoInstall

@styled-system/should-forward-prop

Package Overview
Dependencies
17
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @styled-system/should-forward-prop

Utility for filtering Styled System props with Emotion's shouldForwardProp option


Version published
Weekly downloads
159K
increased by1.5%
Maintainers
1
Install size
209 kB
Created
Weekly downloads
 

Readme

Source

@styled-system/should-forward-prop

Utility for filtering Styled System props with Emotion's shouldForwardProp option

npm i @styled-system/should-forward-prop
import styled from '@emotion/styled'
import {
  space,
  color,
  typography
} from 'styled-system'
import shouldForwardProp from '@styled-system/should-forward-prop'

const Box = styled('div', { shouldForwardProp })(
  space,
  color,
  typography
)

Custom Props

To exclude other custom props not included in Styled System, use the createShouldForwardProp utility.

import styled from '@emotion/styled'
import { space, color } from 'styled-system'
import { createShouldForwardProp, props } from '@styled-system/should-forward-prop'

const shouldForwardProp = createShouldForwardProp([
  ...props,
  'd',
  'x'
])

const Box = styled('div', {
  shouldForwardProp
})(props => ({
  display: props.d,
  fontWeight: props.x ? 'bold' : null,
}),
  space,
  color
)

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