# 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 1Item 2Item 3LeftRight
);
}
```
---
### 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}
/>
);
}
```
---
### Select Component
Searchable dropdown with single and multi-select support
```typescript
import { Select } from '@once-ui-system/core';
import { useState } from 'react';
export function SelectExample() {
const [country, setCountry] = useState('');
const [skills, setSkills] = useState([]);
const countries = [
{ label: "United States", value: "us" },
{ label: "Canada", value: "ca" },
{ label: "United Kingdom", value: "uk" },
{ label: "Australia", value: "au" },
{ label: "Germany", value: "de" },
{ label: "France", value: "fr" },
{ label: "Japan", value: "jp" },
{ label: "Brazil", value: "br" }
];
const skillOptions = [
{ label: "JavaScript", value: "js" },
{ label: "TypeScript", value: "ts" },
{ label: "React", value: "react" },
{ label: "Node.js", value: "node" }
];
return (
{/* Single select with search */}
);
}
```
---
### Dialog Component
Modal dialogs with custom content and footer actions
```typescript
import { Dialog, Button, Text, Flex } from '@once-ui-system/core';
import { useState } from 'react';
export function DialogExample() {
const [isOpen, setIsOpen] = useState(false);
const [isConfirmOpen, setIsConfirmOpen] = useState(false);
const handleConfirm = () => {
console.log('Confirmed!');
setIsConfirmOpen(false);
};
return (
{/* Basic dialog */}
{/* Confirmation dialog with footer */}
);
}
```
---
### DatePicker and DateInput
Date and time selection with range support
```typescript
import { DatePicker, DateInput, DateRangeInput, DateRange } from '@once-ui-system/core';
import { useState } from 'react';
export function DatePickerExample() {
const [date, setDate] = useState(new Date());
const [inputDate, setInputDate] = useState();
const [dateRange, setDateRange] = useState(null);
return (
{/* Standalone date picker with time */}
{/* Date input field */}
{/* Date range input */}
{/* Display selected values */}
{dateRange && (
Selected: {dateRange.from?.toLocaleDateString()} - {dateRange.to?.toLocaleDateString()}
)}
);
}
```
---
### Toast Notifications
Global notification system with variants
```typescript
import { useToast, Button, Flex } from '@once-ui-system/core';
export function ToastExample() {
const { addToast } = useToast();
return (
);
}
```
---
### BarChart Component
Data visualization with customizable series and legends
```typescript
import { BarChart } from '@once-ui-system/core/modules';
export function BarChartExample() {
const salesData = [
{ label: "Q1 2024", Sales: 45000, Revenue: 38000, Profit: 12000 },
{ label: "Q2 2024", Sales: 52000, Revenue: 44000, Profit: 15000 },
{ label: "Q3 2024", Sales: 61000, Revenue: 53000, Profit: 18500 },
{ label: "Q4 2024", Sales: 58000, Revenue: 49000, Profit: 16000 }
];
return (
);
}
```
---
### LineChart Component
Time-series data visualization with date formatting
```typescript
import { LineChart } from '@once-ui-system/core/modules';
export function LineChartExample() {
const timeSeriesData = [
{
date: new Date("1980-01-01"),
"Median Income": 22340,
"College Tuition": 3040
},
{
date: new Date("1990-01-01"),
"Median Income": 31056,
"College Tuition": 6371
},
{
date: new Date("2000-01-01"),
"Median Income": 41824,
"College Tuition": 13467
},
{
date: new Date("2010-01-01"),
"Median Income": 49341,
"College Tuition": 18462
},
{
date: new Date("2020-01-01"),
"Median Income": 52357,
"College Tuition": 25320
}
];
return (
);
}
```
---
### CodeBlock Component
Syntax-highlighted code with 140+ language support
```typescript
import { CodeBlock } from '@once-ui-system/core/modules';
export function CodeBlockExample() {
return (
);
}
```
---
### Carousel Component
Image carousel with auto-play and thumbnails
```typescript
import { Carousel } from '@once-ui-system/core';
export function CarouselExample() {
return (
{/* Auto-playing carousel with controls */}
{/* Carousel with line indicator */}
);
}
```
---
### RevealFx Component
Animated reveal effect for smooth content appearance
```typescript
import { RevealFx, Heading, Text } from '@once-ui-system/core';
export function RevealFxExample() {
return (
Welcome to Once UI
Build with clarity, speed, and quiet confidence
);
}
```
---
### TypeFx Component
Typewriter animation effect for text
```typescript
import { TypeFx } from '@once-ui-system/core';
export function TypeFxExample() {
return (
{/* Single word typewriter */}
{/* Looping multiple words */}
);
}
```
---
### CountFx Component
Animated number counting with formatting
```typescript
import { CountFx, Flex } from '@once-ui-system/core';
import { useState, useEffect } from 'react';
export function CountFxExample() {
const [value, setValue] = useState(0);
useEffect(() => {
setTimeout(() => setValue(9999), 1000);
}, []);
return (
{/* Smooth counting */}
{/* Wheel effect */}
`$${num.toLocaleString()}`}
/>
{/* Progress percentage */}
`${num}%`}
/>
);
}
```
---
### GlitchFx Component
Glitch visual effect for text and elements
```typescript
import { GlitchFx, Heading } from '@once-ui-system/core';
export function GlitchFxExample() {
return (
{/* Hover-triggered glitch */}
Hover Me
{/* Continuous glitch */}
Continuous Glitch Effect
);
}
```
---
### Table Component
Sortable data tables with custom styling
```typescript
import { Table } from '@once-ui-system/core';
export function TableExample() {
return (
);
}
```
---
### TagInput Component
Tag-based input for multiple values
```typescript
import { TagInput } from '@once-ui-system/core';
import { useState } from 'react';
export function TagInputExample() {
const [tags, setTags] = useState(['React', 'TypeScript']);
return (
);
}
```
---
### Accordion Component
Collapsible content sections
```typescript
import { Accordion, AccordionGroup, Text } from '@once-ui-system/core';
export function AccordionExample() {
return (
{/* Single accordion */}
Once UI is a comprehensive design system for Next.js applications
with 110+ components and rich animations.
{/* Accordion group (only one open at a time) */}
Install Once UI with: npm install @once-ui-system/core
)
},
{
title: "Getting Started",
content: (
Import components and wrap your app with ThemeProvider
)
},
{
title: "Customization",
content: (
Customize themes, colors, and styling through provider props
)
}
]}
/>
);
}
```
---
### DropdownWrapper Component
Custom dropdown with floating-ui positioning
```typescript
import { DropdownWrapper, Button, Option, Column, Icon } from '@once-ui-system/core';
import { useState } from 'react';
export function DropdownExample() {
const [isOpen, setIsOpen] = useState(false);
const [selected, setSelected] = useState('');
const options = [
{ label: "Dashboard", value: "dashboard", icon: "home" },
{ label: "Settings", value: "settings", icon: "gear" },
{ label: "Profile", value: "profile", icon: "user" },
{ label: "Logout", value: "logout", icon: "signOut" }
];
return (
Menu
}
dropdown={
{options.map((option) => (
}
onClick={() => {
setSelected(option.value);
setIsOpen(false);
}}
>
{option.label}
))}
}
/>
);
}
```
---
### useTheme Hook
Dynamic theme switching and management
```typescript
import { useTheme, Button, Flex } from '@once-ui-system/core';
export function ThemeExample() {
const { theme, setTheme } = useTheme();
return (
);
}
```
---
### EmojiPicker Component
Emoji selection with categories and search
```typescript
import { EmojiPicker, EmojiPickerDropdown, Button, Flex, Icon } from '@once-ui-system/core';
import { useState } from 'react';
export function EmojiPickerExample() {
const [emoji, setEmoji] = useState('');
const [showPicker, setShowPicker] = useState(false);
const [dropdownEmoji, setDropdownEmoji] = useState('');
return (
{/* Standard emoji picker */}
{showPicker && (
{
setEmoji(emoji);
setShowPicker(false);
}}
onClose={() => setShowPicker(false)}
/>
)}
{/* Emoji picker dropdown */}
{dropdownEmoji || }
Add Emoji
}
onSelect={setDropdownEmoji}
placement="bottom-start"
/>
);
}
```
---
### Avatar and AvatarGroup
User profile images with fallback and grouping
```typescript
import { Avatar, AvatarGroup } from '@once-ui-system/core';
export function AvatarExample() {
return (
{/* Single avatars */}
{/* Avatar group */}
);
}
```
---
### Badge Component
Status indicators and labels
```typescript
import { Badge, Logo, Text, Line, LetterFx } from '@once-ui-system/core';
export function BadgeExample() {
return (
{/* Simple badge */}
New
{/* Complex badge with logo */}
An ecosystem, not a UI kit
);
}
```
---
### MasonryGrid Component
Pinterest-style masonry layouts
```typescript
import { MasonryGrid, Flex, Text } from '@once-ui-system/core';
export function MasonryGridExample() {
const itemHeights = [16, 6, 4, 6, 16, 12, 7, 24, 4, 12, 6, 2, 24, 17, 12, 5];
return (
{itemHeights.map((height, index) => (
Item {index + 1}
))}
);
}
```
---
## Summary
Once UI provides a production-ready design system that accelerates Next.js development through its comprehensive component library, intelligent theming system, and rich animation capabilities. The primary use cases include building modern web applications, SaaS products, data dashboards, marketing websites, and documentation portals where visual polish and developer experience are paramount. Its prop-based styling approach eliminates CSS complexity while maintaining full customization through design tokens, responsive breakpoints, and theme providers.
Integration patterns emphasize server/client component optimization for Next.js 13+, centralized theme configuration through context providers, and modular imports for tree-shaking and optimal bundle sizes. The library excels in scenarios requiring rapid prototyping, consistent design systems across large applications, data visualization with interactive charts, and engaging user experiences powered by 15+ animation effects. With TypeScript support, accessibility compliance, and extensive documentation at docs.once-ui.com, Once UI delivers professional-grade UI components suitable for indie projects through enterprise applications, all while maintaining the flexibility to customize every aspect of the design system to match specific brand requirements.