Answers for "styled.components conditional props"

2

styled components conditional hover

import { css, styled } from 'styled-components'

styled.div`
   ${props => props.shouldHover && css`
      &:hover {
        background: 'red';
      }
   `}
`
Posted by: Guest on May-29-2021
0

conditionally changing styled components based on props

const Text = styled.p`
  color: ${(props) => (props.red ? 'red' : 'blue')};
`
Posted by: Guest on May-27-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language