
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-tailwind-quickstyle
Advanced tools
A utility function to create styled React components with Tailwind CSS with less boilerplate
A utility function to create styled React components with Tailwind CSS with less boilerplate.
Styled Components have the ability to be designed and extended. Tailwind CSS allows for rapid development. The intention is for a better developer experience for prototyping by combining the two features.
import styled from 'styled-components';
export const Image = styled.img`
position: relative;
object-fit: contain;
width: 100%;
border-radius: 6px;
`;
Source: Mamba UI
<div className="max-w-xs p-6 rounded-md shadow-md dark:bg-coolGray-900 dark:text-coolGray-50">
<img src="https://source.unsplash.com/300x300/?random" alt="" className="object-cover object-center w-full rounded-md h-72 dark:bg-coolGray-500">
<div className="mt-6 mb-2">
<span className="block text-xs font-medium tracking-widest uppercase dark:text-violet-400">Quisque</span>
<h2 className="text-xl font-semibold tracking-wide">Nam maximus purus</h2>
</div>
<p className="dark:text-coolGray-100">Mauris et lorem at elit tristique dignissim et ullamcorper elit. In sed feugiat mi. Etiam ut lacinia dui.</p>
</div>
React: v17
Tailwind CSS: 2.2
npm i react-tailwind-quickstyle
const Component = base(element, className, children);
The base function defaults to a div element if parameters are not provided.
Container, Form, and Input components:
import { base } from 'react-tailwind-quickstyle';
const Input = base('input', 'w-full');
const Form = base('form', 'm-5 col-span-3');
const Container = base('div', 'grid grid-cols-3');
const Login = ()=>{
return (
<Container>
<Form onSubmit={}>
<Input type='text' />
</Form>
</Container>
)
}
import { base } from 'react-tailwind-quickstyle';
const Input = base('input', 'w-full');
const Form = base('form', 'm-5 col-span-3');
const Container = base('div', 'grid grid-cols-3');
const Login = ()=>{
return (
<Container className='mx-5 my-3'>
<Form onSubmit={}>
<Input type='text' />
</Form>
</Container>
)
}
The Container component is now equivalent to:
<Container className='mx-5 my-3 grid grid-cols-3'>...</Container>
const Span = base(
'span',
'block text-xs font-medium tracking-widest uppercase dark:text-violet-400',
'Quisque'
);
const H2 = base(
'h2',
'text-xl font-semibold tracking-wide',
'Nam maximus purus'
);
const TextWrapper = base(
'img',
'mt-6 mb-2',
<>
<Span />
<H2 />
</>
);
const SomeComponent = () => {
return <TextWrapper />;
};
However, changing the children props of Span and H2 within SomeComponent would be more difficult after nesting, so it is not recommended to nest if the children props may change.
All components created with the base function have forwardRef included and a ref prop is available:
import { base } from 'react-tailwind-quickstyle';
const Input = base('input', 'w-full');
const Form = base('form', 'm-5 col-span-3');
const Container = base('div', 'grid grid-cols-3');
const Login = ()=>{
const inputRef = useRef<HTMLInputElement>(null)
return (
<Container>
<Form onSubmit={}>
<Input ref={inputRef} type='text' />
</Form>
</Container>
)
}
forwardRef included. (not illustrated in example below)
import * as React from 'react';
import { Box } from 'react-tailwind-quickstyle';
const Example = () => {
return (
<>
<Box
as='button'
type='button'
className='px-3 py-2 m-10 bg-blue-500 hover:bg-blue-300 text-white uppercase'
>
box button
</Box>
</>
);
};
FAQs
A utility function to create styled React components with Tailwind CSS with less boilerplate
The npm package react-tailwind-quickstyle receives a total of 0 weekly downloads. As such, react-tailwind-quickstyle popularity was classified as not popular.
We found that react-tailwind-quickstyle 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.