randmarcomps v1.30.0
randmarcomps
A simple TypeScript React component library with Tailwind CSS v4 styling.
Installation
npm install randmarcomps
Requirements
This component library requires the following dependencies:
Tailwind CSS v4
npm install tailwindcss@^4.0.0
React Router
Several components (like Navbar and Topbar) require React Router:
npm install react-router-dom@^7.3.0
Components that use React Router include:
- Navbar (uses useParams, Link)
- Topbar (uses useNavigate, useParams)
Usage
1. Import the CSS
First, import the component library's CSS in your application:
import 'randmarcomps/styles.css';
This will include all the necessary styles, including custom Randmar colors like randmar-red
, randmar-blue
, etc.
2. Import Components
Then import the components you need:
import {
InputOTP,
InputOTPGroup,
InputOTPSeparator,
InputOTPSlot,
Button
} from 'randmarcomps';
function App() {
return (
<div>
<Button variant="blue">Blue Button</Button>
<Button variant="red">Red Button</Button>
<InputOTP maxLength={6}>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot index={3} />
<InputOTPSlot index={4} />
<InputOTPSlot index={5} />
</InputOTPGroup>
</InputOTP>
</div>
);
}
Alternative: Using with Tailwind Source Directive
If you prefer to use Tailwind's source directive to process the components:
/* In your main CSS file (e.g., src/index.css) */
@import 'tailwindcss';
@source "../node_modules/randmarcomps/dist";
/* Rest of your CSS */
This directive tells Tailwind to process the components from randmarcomps when generating your CSS. If you're using a different path structure, adjust the path accordingly.
Custom Colors
The library includes these custom Randmar colors:
randmar-red
randmar-blue
randmar-purple
randmar-green
randmar-black
randmar-yellow
These are available when you import the CSS file.
Compatibility
This library is designed to work with:
- React 19
- React Router 7
- Tailwind CSS v4
If you're using earlier versions, you may encounter compatibility issues:
- Tailwind v3: You may encounter styling issues due to differences in the CSS layer system
- React Router <7: The API may have changed between versions
Development
npm run dev
- Start development servernpm run build
- Build the librarynpm run lint
- Lint the code