### Install and Run Darwin UI Development Environment Source: https://github.com/surajmandalcell/darwin-ui/blob/main/CONTRIBUTING.md These commands are used to set up the development environment for Darwin UI. It includes installing dependencies, building the library, and running in watch mode for continuous development. The build:registry command is specifically for shadcn compatibility. ```bash # Install dependencies npm install # Build the library npm run build # Watch mode for development npm run dev # Build the registry (for shadcn compatibility) npm run build:registry ``` -------------------------------- ### Install Darwin UI using npm Source: https://github.com/surajmandalcell/darwin-ui/blob/main/docs/public/llms.txt This snippet shows how to install the Darwin UI library using npm. It's a prerequisite for using the library in your React project. ```bash npm install @pikoloo/darwin-ui ``` -------------------------------- ### Quick Start with Darwin UI Components in React Source: https://github.com/surajmandalcell/darwin-ui/blob/main/README.md A basic example of how to import and use Darwin UI components like Card and Button in a React application. It includes necessary imports for components and global styles. ```tsx import { Button, Card, CardHeader, CardTitle, CardContent, } from "@pikoloo/darwin-ui"; import "@pikoloo/darwin-ui/styles"; function App() { return ( Welcome to Darwin UI ); } ``` -------------------------------- ### Install Darwin UI with npm, yarn, or pnpm Source: https://github.com/surajmandalcell/darwin-ui/blob/main/README.md This snippet shows how to install the Darwin UI library using different package managers. It's the first step to integrating the components into your React project. ```bash npm install @pikoloo/darwin-ui # or yarn add @pikoloo/darwin-ui # or pnpm add @pikoloo/darwin-ui ``` -------------------------------- ### Progress Component Examples (React) Source: https://context7.com/surajmandalcell/darwin-ui/llms.txt Demonstrates the linear and circular Progress indicators from @pikoloo/darwin-ui. It covers different variants, sizes, indeterminate mode, and value display. ```tsx import { Progress, CircularProgress } from "@pikoloo/darwin-ui"; function ProgressExamples() { const [progress, setProgress] = useState(65); return (
{/* Linear progress */} {/* Variants */} {/* Indeterminate (loading) */} {/* Sizes */} {/* Circular progress */}
); } ``` -------------------------------- ### Badge Component Examples (React) Source: https://context7.com/surajmandalcell/darwin-ui/llms.txt Illustrates the various styles and variants of the Badge component from @pikoloo/darwin-ui. It showcases basic, semantic, and status-specific badges. ```tsx import { Badge } from "@pikoloo/darwin-ui"; function BadgeExamples() { return (
{/* Basic variants */} Default Secondary Outline Glass {/* Semantic variants */} Success Warning Error Info {/* Status variants */} Published Draft Archived New Read Responded
); } ``` -------------------------------- ### Configure ESLint for React and React DOM Linting Source: https://github.com/surajmandalcell/darwin-ui/blob/main/docs/README.md This JavaScript configuration integrates ESLint with React-specific linting rules using 'eslint-plugin-react-x' and 'eslint-plugin-react-dom'. It requires the necessary plugins to be installed and assumes TypeScript project configurations are available. ```javascript // eslint.config.js import reactX from 'eslint-plugin-react-x' import reactDom from 'eslint-plugin-react-dom' export default defineConfig([ globalIgnores(['dist']), { files: ['**/*.{ts,tsx}'] extends: [ // Other configs... // Enable lint rules for React reactX.configs['recommended-typescript'], // Enable lint rules for React DOM reactDom.configs.recommended, ], languageOptions: { parserOptions: { project: ['./tsconfig.node.json', './tsconfig.app.json'], tsconfigRootDir: import.meta.dirname, }, // other options... }, }, ]) ``` -------------------------------- ### DropdownMenu Example with React and TypeScript Source: https://context7.com/surajmandalcell/darwin-ui/llms.txt A comprehensive example demonstrating the usage of the DropdownMenu component from the '@pikoloo/darwin-ui' library. This snippet showcases how to integrate various sub-components like DropdownMenuItem, DropdownMenuCheckboxItem, and DropdownMenuSeparator to create a functional dropdown menu with options, settings, and a dark mode toggle. It utilizes 'lucide-react' for icons. ```tsx import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, } from "@pikoloo/darwin-ui"; import { Button } from "@pikoloo/darwin-ui"; import { Settings, User, LogOut, Moon } from "lucide-react"; function DropdownMenuExample() { const [darkMode, setDarkMode] = useState(false); return ( My Account console.log("Profile clicked")}> Profile ⇧⌘P console.log("Settings clicked")}> Settings ⌘, Dark Mode console.log("Logout")}> Log out ⇧⌘Q ); } ``` -------------------------------- ### Darwin UI Card Component Examples Source: https://context7.com/surajmandalcell/darwin-ui/llms.txt Demonstrates the usage of the Darwin UI Card component system, including standard cards and cards with a frosted glass effect. It shows how to structure content with header, title, description, content, footer, and action slots. ```tsx import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, CardAction } from "@pikoloo/darwin-ui"; import { Button } from "@pikoloo/darwin-ui"; function CardExample() { return (
{/* Standard card */} Account Settings Manage your account preferences and security settings.

Your account is currently active and in good standing.

{/* Glass effect card */} Glass Card This card has the frosted glass effect enabled.

Perfect for overlaying on images or gradients.

); } ``` -------------------------------- ### Table Component Example (React) Source: https://context7.com/surajmandalcell/darwin-ui/llms.txt Demonstrates the usage of the Table component from @pikoloo/darwin-ui. It includes features like headers, body, rows, cells, loading states, and empty states. It utilizes other components like Badge and Button. ```tsx import { Table, TableHead, TableBody, TableRow, TableCell, TableHeaderCell, TableLoadingRows, TableEmptyRow, } from "@pikoloo/darwin-ui"; import { Badge } from "@pikoloo/darwin-ui"; function TableExample() { const [loading, setLoading] = useState(false); const users = [ { id: 1, name: "John Doe", email: "john@example.com", status: "active" }, { id: 2, name: "Jane Smith", email: "jane@example.com", status: "pending" }, { id: 3, name: "Bob Wilson", email: "bob@example.com", status: "inactive" }, ]; const getStatusBadge = (status: string) => { const variants = { active: "success", pending: "warning", inactive: "secondary", }; return {status}; }; return ( Name Email Status Actions {loading ? ( ) : users.length === 0 ? (

No users found

) : ( users.map((user) => ( {user.name} {user.email} {getStatusBadge(user.status)} )) )}
); } ``` -------------------------------- ### Tabs Component Example with Spring Transitions Source: https://context7.com/surajmandalcell/darwin-ui/llms.txt Demonstrates the usage of the Tabs component from Darwin UI, featuring spring-based transitions and ARIA accessibility. It requires React's useState hook for managing the active tab and imports necessary components from '@pikoloo/darwin-ui'. ```tsx import { Tabs, TabsList, TabsTrigger, TabsContent } from "@pikoloo/darwin-ui"; import { useState } from "react"; function TabsExample() { const [activeTab, setActiveTab] = useState("overview"); return ( Overview Analytics Reports Settings

Overview

Your dashboard overview content goes here.

Analytics

View your analytics and metrics.

Reports

Generate and download reports.

); } ``` -------------------------------- ### Darwin UI Button Component Examples Source: https://context7.com/surajmandalcell/darwin-ui/llms.txt Showcases various implementations of the Darwin UI Button component, including different variants, icon usage, loading states, sizes, and compound components. It utilizes Framer Motion for animations and Lucide React for icons. ```tsx import { Button } from "@pikoloo/darwin-ui"; import { Save, Trash2, Settings } from "lucide-react"; import { useState } from "react"; function ButtonExamples() { const [loading, setLoading] = useState(false); return (
{/* Basic variants */} {/* With icons */} {/* Loading state */} {/* Sizes */} {/* Icon button */} {/* Full width with glass effect */} {/* Compound components */} Ghost Shorthand Outline Shorthand Delete Shorthand
); } ``` -------------------------------- ### Configure ESLint for Type-Aware Linting in TypeScript Source: https://github.com/surajmandalcell/darwin-ui/blob/main/docs/README.md This JavaScript configuration enhances ESLint for TypeScript projects by enabling type-aware lint rules. It requires TypeScript project configurations like 'tsconfig.node.json' and 'tsconfig.app.json' to be present. ```javascript export default defineConfig([ globalIgnores(['dist']), { files: ['**/*.{ts,tsx}'] extends: [ // Other configs... // Remove tseslint.configs.recommended and replace with this tseslint.configs.recommendedTypeChecked, // Alternatively, use this for stricter rules tseslint.configs.strictTypeChecked, // Optionally, add this for stylistic rules tseslint.configs.stylisticTypeChecked, // Other configs... ], languageOptions: { parserOptions: { project: ['./tsconfig.node.json', './tsconfig.app.json'], tsconfigRootDir: import.meta.dirname, }, // other options... }, }, ]) ``` -------------------------------- ### Integrate Darwin UI Styles with Tailwind CSS Source: https://github.com/surajmandalcell/darwin-ui/blob/main/README.md Provides the necessary CSS import statement to integrate Darwin UI's styles with your existing Tailwind CSS setup, ensuring consistent design across your application. ```css /* In your global CSS */ @import "tailwindcss"; @import "@pikoloo/darwin-ui/styles"; ``` -------------------------------- ### URL Path Normalization in Darwin UI Source: https://github.com/surajmandalcell/darwin-ui/blob/main/docs/index.html This JavaScript code snippet normalizes the URL path for the Darwin UI library. It decodes and reconstructs the search parameters if the path starts with a '/'. This ensures consistent URL handling within the application. ```javascript function(l) { if (l.search[1] === '/') { var decoded = l.search.slice(1).split('&').map(function(s) { return s.replace(/~and~/g, '&') }).join('?'); window.history.replaceState(null, null, l.pathname.slice(0, -1) + decoded + l.hash ); } }(window.location)) ``` -------------------------------- ### Import Darwin UI Styles Source: https://github.com/surajmandalcell/darwin-ui/blob/main/docs/public/llms.txt This code snippet demonstrates how to import the necessary styles for Darwin UI into your application's entry point. This ensures that all components are styled correctly. ```javascript import '@pikoloo/darwin-ui/styles.css'; ``` -------------------------------- ### Clone Darwin UI Repository Source: https://github.com/surajmandalcell/darwin-ui/blob/main/CONTRIBUTING.md Instructions for forking and cloning the Darwin UI repository to your local machine. This is the initial step for contributing to the project. ```bash git clone https://github.com/YOUR_USERNAME/darwin-ui.git ``` -------------------------------- ### Input and TextArea Components with Darwin UI Source: https://context7.com/surajmandalcell/darwin-ui/llms.txt Demonstrates the use of Input, SearchInput, and Textarea components from '@pikoloo/darwin-ui'. Supports features like icons, error/success states, search variants, and auto-resizing textareas. Requires 'lucide-react' for icons. ```tsx import { Input, SearchInput, Textarea } from "@pikoloo/darwin-ui"; import { Mail, Lock } from "lucide-react"; function InputExamples() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [search, setSearch] = useState(""); const [bio, setBio] = useState(""); const [emailError, setEmailError] = useState(false); const validateEmail = (value: string) => { setEmail(value); setEmailError(!value.includes("@") && value.length > 0); }; return (
{/* Basic input with icon */} } value={email} onChange={(e) => validateEmail(e.target.value)} error={emailError} /> {/* Password input */} } value={password} onChange={(e) => setPassword(e.target.value)} /> {/* Search input (built-in search icon) */} setSearch(e.target.value)} /> {/* Success state */} {/* Sizes */} {/* TextArea with auto-resize */} setBio(e.target.value)} autoResize size="md" /> {/* TextArea with manual resize */}