Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
tailwind-styled-components
Advanced tools
Create tailwind css react components like styled components with classes name on multiple lines
Create tailwind css react components like styled components with classes name on multiple lines
# using npm
npm i -D tailwind-styled-components
# using yarn
yarn add -D tailwind-styled-components
import tw from "tailwind-styled-components"
You can use tailwind-styled-components without using styled components
const Container = tw.div`
flex
items-center
justify-center
flex-col
w-full
bg-indigo-600
`
Will be rendered as
<div class="flex items-center justify-center flex-col w-full bg-indigo-600">
<!-- children -->
</div>
const RedContainer = tw(Container)`
bg-red-600
`
Will be rendered as
<div class="flex items-center justify-center flex-col w-full bg-red-600">
<!-- children -->
</div>
Overrides the parent background color class
Extend styled components
const StyledComponentWithCustomJs = styled.div`
filter: blur(1px)
`
const = tw(StyledComponentWithCustomJs)`
flex
`
Will be rendered as
<div class="flex" style="filter: blur(1px);">
<!-- children -->
</div>
import React from "react"
import tw from "tailwind-styled-components"
import styled from "styled-components"
const Container = tw.div`
flex
items-center
justify-center
`
// Create a <Title> react component that renders an <h1> which is
// indigo and sized at 1.125rem
const Title = tw.h1`
text-lg
text-indigo-500
`
// Create a <SpecialBlueContainer> react component that renders a <section> with
// a special blue background color
const Container = styled.section`
background-color: #0366d6;
`
// Create a <Container> react component that extends the SpecialBlueContainer to render
// a tailwind <section> with the special blue background and adds the flex classes
const Container = tw(SpecialBlueContainer)`
flex
items-center
justify-center
w-full
`
// Use them like any other React component – except they're styled!
<Container>
<Title>Hello World, this is my first tailwind styled component!</Title>
</Container>
FAQs
Create tailwind css react components like styled components with classes name on multiple lines
The npm package tailwind-styled-components receives a total of 11,679 weekly downloads. As such, tailwind-styled-components popularity was classified as popular.
We found that tailwind-styled-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.