0.1.1 • Published 8 months ago
@jonali1/react-components v0.1.1
@jonali1/react-components
A collection of React components built with Next.js.
Installation
npm install @jonali1/react-components
# or
yarn add @jonali1/react-componentsUsage
With Default Styles
// Import the component
import { Button } from '@jonali1/react-components';
// Import the styles
import '@jonali1/react-components/styles.css';
function App() {
return (
<Button
label="Click me"
onClick={() => console.log('Button clicked!')}
/>
);
}With Tailwind CSS
If your application already uses Tailwind CSS, you can use the variant="tailwind" prop to use Tailwind classes instead of the default styles:
// Import the component
import { Button } from '@jonali1/react-components';
// No need to import styles.css when using Tailwind variant
function App() {
return (
<Button
label="Click me"
onClick={() => console.log('Button clicked!')}
variant="tailwind"
/>
);
}Components
Button
A customizable button component.
Props
label(string): The text to display on the buttononClick(function, optional): Callback function when button is clickedclassName(string, optional): Additional CSS classes to apply to the buttonvariant(string, optional): Style variant to use. Options: 'default' (uses included CSS) or 'tailwind' (uses Tailwind classes)
Development
# Install dependencies
npm install
# Run development server
npm run next:dev
# Build the library
npm run buildLicense
MIT