UNPKG

nowt-ui-library

Version:

Nothing unnecessary. Just clean UI.A lightweight and customizable UI component library built for speed and simplicity for React and Next.js.

427 lines (320 loc) β€’ 13.8 kB
# 🌿 nowt-ui > **Nothing unnecessary. Just clean UI.** A lightweight and customizable UI component library built for speed and simplicity. --- ## πŸš€ Features - 🎯 **Minimal & Performant** – Designed with performance in mind. - 🎨 **Themeable** – Customize styles to fit your brand. - 🧱 **Reusable Components** – Common building blocks like Button, Input, Modal, etc. - βš›οΈ **Framework Friendly** – Works great with React and modern JS frameworks. - πŸ› οΈ **Easy to Extend** – Build on top of it or fork it easily. ## ❀️ Why "nowt-ui"? β€œNowt” is British slang for β€œnothing” β€” because this library adds nothing unnecessary. Just clean, reusable components that work. --- ## πŸ› οΈ Getting Started > ⚠️ This library is currently under development. Only the `Button , Input , Card` component is available for now. More components coming soon! --- ## πŸš€ Installation ```bash npm install nowt-ui-library ``` --- # πŸ–ΌοΈ Components - [Button Component](#button-component) - [Input Component](#input-component) - [Card Component](#card-component) - [TextArea Component](#textarea-component) ## πŸ“¦ Usage ## Button Component ```tsx import React from 'react'; import { Button } from 'nowt-ui-library'; const App = () => { return ( <Button label="Click me" onClick={() => alert('Hi')} /> ); }; ``` --- ## βš™οΈ Props | Prop | Type | Default | Description | |-------------|------------------------------------------------------------|-------------|--------------------------------------------------| | `label` | `string` | β€” | Button text | | `onClick` | `() => void` | β€” | Function to call on button click | | `size` | `'small' | 'medium' | 'large'` | `'medium'` | Size of the button | | `variant` | `'primary' | 'secondary' | 'danger' | 'outline'` | `'primary'` | Visual style of the button | | `loading` | `boolean` | `false` | Shows a loading spinner if `true` | | `disabled` | `boolean` | `false` | Disables the button | | `fullWidth` | `boolean` | `false` | Makes the button take full width | | `bgColor` | `string` | β€” | Custom background color (overrides variant) | | `textColor` | `string` | β€” | Custom text color | --- ## πŸ“š Examples ### πŸ”΅ Primary Button ```tsx <Button label="Primary" /> ``` ### πŸ”΄ Danger with Large Size ```tsx <Button label="Delete" variant="danger" size="large" /> ``` ### ⏳ Loading State ```tsx <Button label="Loading..." loading /> ``` ### ⚫ Disabled Button ```tsx <Button label="Disabled" disabled /> ``` ### 🌈 Custom Colors ```tsx <Button label="Custom" bgColor="#222" textColor="#0f0" /> ``` ### ⬜ Outline Style ```tsx <Button label="Outline" variant="outline" /> ``` ### πŸ”„ Full Width ```tsx <Button label="Full Width" fullWidth /> ``` --- ## Input Component This version includes a powerful and reusable `<Input />` component with full TypeScript support. ``` npm install nowt-ui-library ``` ## πŸ”₯ Features - βœ… Fully typed with TypeScript - 🎯 Easy to customize with icons, styles, and classNames - ⚠️ Supports validation + error handling - 🧠 Works in React & Next.js - 🎨 Lightweight and reusable ### πŸ’‘ All Features Example ```tsx import React, { useState } from 'react'; // import from your UI lib import { Mail, Lock, User } from 'lucide-react'; // optional icons import { Input } from 'nowt-ui-library'; export default function Example() { const [value, setValue] = useState(''); return ( <div style={{ padding: 32, maxWidth: 450, margin: 'auto' }}> {/* βœ… label */} <Input label="Email" placeholder="Enter your email" value={value} onChange={(e) => setValue(e.target.value)} /> {/* βœ… labelClassName */} <Input label="Styled Label" labelClassName="custom-label" placeholder="With custom label" value={value} onChange={(e) => setValue(e.target.value)} /> {/* βœ… containerClassName */} <Input label="Container Class" containerClassName="custom-container" placeholder="Styled container" value={value} onChange={(e) => setValue(e.target.value)} /> {/* βœ… containerStyle */} <Input label="Container Style" containerStyle={{ backgroundColor: '#f3f4f6', padding: 10 }} placeholder="Styled container" value={value} onChange={(e) => setValue(e.target.value)} /> {/* βœ… helperText */} <Input label="Username" placeholder="e.g. lokesh_dev" helperText="Must be unique" value={value} onChange={(e) => setValue(e.target.value)} /> {/* βœ… error */} <Input label="Invalid Email" placeholder="example.com" error="This is not a valid email" value={value} onChange={(e) => setValue(e.target.value)} /> {/* βœ… leftIcon */} <Input label="With Left Icon" placeholder="example@email.com" leftIcon={<Mail size={16} />} value={value} onChange={(e) => setValue(e.target.value)} /> {/* βœ… rightIcon */} <Input label="With Right Icon" placeholder="Enter password" type="password" rightIcon={<span style={{ fontSize: 12 }}>πŸ‘οΈ</span>} value={value} onChange={(e) => setValue(e.target.value)} /> {/* βœ… Combined all */} <Input label="Full Combo" labelClassName="text-blue-500" containerClassName="rounded-md shadow" containerStyle={{ marginTop: 20 }} placeholder="All props together" helperText="Everything included" error={value.length < 3 ? 'Min 3 characters' : ''} leftIcon={<User size={16} />} rightIcon={<span style={{ fontSize: 12 }}>βœ…</span>} value={value} onChange={(e) => setValue(e.target.value)} /> </div> ); } ``` ### 🎨 Custom Styles You can easily style the `<Input />` component using CSS. Here's an example of how you can style the label and container: ``` .custom-label { font-weight: bold; color: green; } .custom-container { background: #fff0f0; padding: 10px; border-radius: 6px; color: #333; } ``` --- ## πŸ“˜ Props | Prop | Type | Description | |--------------------|-------------------------------|----------------------------------------| | `label` | `string` | Label displayed above the input | | `labelClassName` | `string` | Class for styling the label | | `containerClassName`| `string` | Custom class for the input container | | `containerStyle` | `React.CSSProperties` | Inline styles for the input container | | `helperText` | `string` | Info/help message under the input | | `error` | `string` | Error message (turns text red) | | `leftIcon` | `React.ReactNode` | Icon to show inside input on the left | | `rightIcon` | `React.ReactNode` | Icon to show inside input on the right | | `...rest` | Native `<input>` props | Supports all native input props | --- ## Card Component A clean, modern, and highly customizable React component for displaying premium cards β€” ideal for SaaS apps, dashboards, e-commerce, portfolios, testimonials, and more. > Built with ❀️ for developers who care about design and usability. --- ## πŸ”₯ Features - ⚑ Production-ready card UI - πŸ’… Customizable props (themes, actions, avatars, tags, etc.) - 🎨 Light & dark themes - πŸ“± Responsive & mobile-friendly - 🧩 Supports cover images, avatars, progress bars, badges, status icons & more ## πŸ“¦ Installation ```bash npm install nowt-ui-library ``` --- ## πŸš€ Usage ```tsx import React from 'react'; import {Card} from 'nowt-ui-library'; const App = () => { return ( <Card title="AI Conference 2025" subtitle="Starts April 14, 2025" image="https://images.pexels.com/photos/1181316/pexels-photo-1181316.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" description="Join over 10,000 developers and learn about the future of AI and ML." tag="Online" tags={['AI', 'ML', 'Future Tech']} theme="dark" width={400} hlight status="success" badge="Live" footer={<span style={{ fontWeight: 500 }}>Save your seat β†’</span>} /> ); }; ``` --- ## ✨ Props | Prop | Type | Description | |--------------|-----------------------|--------------------------------------------------------------------------| | `title` | `string` | Main title | | `subtitle` | `string` | Subtitle text | | `description`| `string` | Optional card description | | `image` | `string` | Optional cover image | | `avatar` | `string` | Optional avatar image (circular) | | `badge` | `string` | Small badge on top-left (e.g., Pro, Beta) | | `tag` | `string` | Highlighted tag above title | | `tags` | `string[]` | Array of tags (displayed as chips) | | `status` | `"success"` \| `"warning"` \| `"error"` \| `"neutral"` | Status dot beside avatar or tag | | `progress` | `number` | Optional progress bar (0-100) | | `theme` | `"light"` \| `"dark"` | Theme styling | | `width` | `number` | Width of the card (default `320`) | | `footer` | `ReactNode` | Content shown at bottom | | `actions` | `ReactNode` | Buttons, links, etc. for user action | | `hlight` | `boolean` | Apply hover highlight effect | --- ## 🎨 Custom Styling Wrap the component in your own layout or apply Tailwind/CSS classes via container. You can also extend it with your own `theme`, `animation`, or even slot-based customization. --- ## TextArea Component ## πŸ“¦ Installation ```bash npm install nowt-ui-library ``` --- ## πŸš€ Usage ```tsx import React from 'react'; import {TextArea} from 'nowt-ui-library'; const App = () => { return ( <TextArea label="Leave Feedback" theme="dark" autosize maxLength={300} onChange={(e) => setText(e.target.value)} value={text} emoji={true} width="100%" height={120} placeholder="Tell us what you think..." isMic={true} /> ); }; ``` ## ✨ Props | Prop | Type | Description | |-------------|----------------------------------------|-------------------------------------------------------| | `label` | `string` \| `null` \| `undefined` | Optional label for the textarea | | `maxLength` | `number` | Maximum number of characters allowed | | `autosize` | `boolean` | Whether the textarea should auto-resize | | `theme` | `Theme` | Custom theme object for styling | | `draftKey` | `string` | Key used to save textarea content as draft | | `width` | `string` \| `number` | Width of the textarea | | `height` | `string` \| `number` | Height of the textarea | | `emoji` | `boolean` | Enable emoji input inside textarea | | `isMic` | `boolean` | Show microphone icon for voice input | | `...rest` | `React.TextareaHTMLAttributes<HTMLTextAreaElement>` | All standard `<textarea>` HTML attributes | ## πŸ§‘β€πŸ’» Author Made with ❀️ by **Lokesh Choudhary** - πŸ™ GitHub: [@lokesh-choudhary](https://github.com/lokeshchoudharyprogrammer) - 🐦 Twitter (X): [@itscrazylokesh](https://x.com/itscrazylokesh) ---