AlexanderRichey / styled-react-modal

Styled modal component for React 💅⚛️
The Unlicense
213 stars 22 forks source link

Is it possible to use tailwind utility classes instead of css ? #65

Closed hackwithharsha closed 1 year ago

hackwithharsha commented 2 years ago

In the following example, we are using CSS.. is it possible to replace them with tailwind utility classes? If so, how to do it ?

const StyledModal = Modal.styled`
  width: 20rem;
  height: 20rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: ${props => props.theme.colors.white};
`
AlexanderRichey commented 1 year ago

You can use the className prop on the resulting component. Or just put a child component under the <Modal /> component and put your tailwind classes there. For example:

<Modal isOpen={isOpen} />
  <div className="pt-6 space-y-4" />
</Modal>