# Once UI - Design System for Next.js ## Introduction Once UI is a comprehensive indie design system and component library built specifically for Next.js applications. It provides developers with 110+ pre-built React components featuring built-in styling, animations, and accessibility support, eliminating the need for custom CSS while maintaining complete design flexibility. The library emphasizes a design-first approach with a cohesive design language, customizable themes, and seamless integration with Next.js 13+ server and client component patterns. At its core, Once UI delivers a rich ecosystem of layout components (Flex, Grid), typography elements (Text, Heading), interactive controls (Button, Input, Select, DatePicker), data visualization tools (BarChart, LineChart, PieChart), and over 15 visual effect components (RevealFx, TypeFx, CountFx, GlitchFx) powered by a robust theming system with 13 color schemes and extensive customization options. The library is distributed as `@once-ui-system/core` (v1.5.2, MIT licensed) and includes full TypeScript support, ARIA accessibility features, and optimized server/client component rendering for superior performance in production environments. --- ## API Documentation and Code Examples ### Installation and Setup Installing Once UI in a Next.js project ```bash npm install @once-ui-system/core ``` ```typescript // app/layout.tsx import '@once-ui-system/core/css/styles.css'; import '@once-ui-system/core/css/tokens.css'; import { ThemeProvider, LayoutProvider, DataThemeProvider, ToastProvider, IconProvider } from '@once-ui-system/core'; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` --- ### Layout Components - Flex and Grid Responsive flexbox and grid layouts with prop-based styling ```typescript import { Flex, Grid, Column, Row } from '@once-ui-system/core'; export function ResponsiveLayout() { return ( Item 1 Item 2 Item 3 Left Right ); } ``` --- ### Button Component Interactive button with variants, icons, and loading states ```typescript import { Button, IconButton } from '@once-ui-system/core'; export function ButtonExamples() { const handleClick = () => { console.log('Button clicked'); }; return ( {/* Primary button with icon */} {/* Button as link */} {/* Loading state */} {/* Full width button */} {/* Icon button */} ); } ``` --- ### Input and Form Controls Text inputs with validation, prefixes, and character counting ```typescript import { Input, PasswordInput, NumberInput, Textarea } from '@once-ui-system/core'; import { useState } from 'react'; export function FormExample() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [age, setAge] = useState(); const [comment, setComment] = useState(''); const validateEmail = (value: string) => { if (!value.includes('@')) { return 'Please enter a valid email address'; } return null; }; return ( setEmail(e.target.value)} validate={validateEmail} hasPrefix={} description="We'll never share your email" characterCount maxLength={100} /> setPassword(e.target.value)} description="Must be at least 8 characters" /> setAge(parseInt(e.target.value))} min={0} max={120} />