### Install and run dev environment Source: https://github.com/once-ui-system/core/blob/main/CONTRIBUTING.md Installs dependencies and starts the dev environment. Boots the docs app at http://localhost:3000 and the dev sandbox at http://localhost:3001 in parallel via Turborepo. ```bash pnpm install pnpm dev ``` -------------------------------- ### Clone, install, and run development servers Source: https://github.com/once-ui-system/core/blob/main/README.md Clones the repository, installs dependencies with pnpm, and starts the development servers. The postinstall hook builds the core library automatically. ```bash git clone https://github.com/once-ui-system/core.git cd core pnpm install pnpm dev ``` -------------------------------- ### Install and build all workspaces Source: https://github.com/once-ui-system/core/blob/main/ARCHITECTURE.md Installs all workspaces and builds the core via postinstall, then rebuilds everything via Turbo. ```bash pnpm install # installs all workspaces + builds core via postinstall ``` ```bash pnpm build # rebuild everything via Turbo ``` -------------------------------- ### Install @once-ui-system/core via npm Source: https://github.com/once-ui-system/core/blob/main/README.md Installs the @once-ui-system/core package via npm. ```bash npm install @once-ui-system/core ``` -------------------------------- ### Install Once UI Core 2.0 Source: https://github.com/once-ui-system/core/blob/main/MIGRATING.md Install the latest major version of the core package. The build will not work until the migration steps are completed. ```bash npm install @once-ui-system/core@2 ``` -------------------------------- ### Advanced setup with breakpoints (Providers.tsx) Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/contexts/layoutProvider.mdx Pass a breakpoint object to LayoutProvider. This example shows a full provider stack with ThemeProvider, DataThemeProvider, ToastProvider, and IconProvider. ```tsx import { IconProvider, ToastProvider, ThemeProvider, DataThemeProvider, LayoutProvider } from "@once-ui-system/core"; export function Providers({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` -------------------------------- ### Install and initialize Once UI agent harness Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/ai-coding.mdx Install the core package and initialize the agent harness with a one-time command that writes AGENTS.md and a Cursor rule. The TypeScript block is conceptual, listing the harness files to read in your agent environment. ```bash npm install @once-ui-system/core npx once-ui-init-agent # writes AGENTS.md + Cursor rule in your app (one-time) ``` ```tsx // Conceptual — read in your agent environment // @once-ui-system/core/ai/manifest.json // @once-ui-system/core/ai/rules.compact.md // @once-ui-system/core/ai/tasks/pricing.json // @once-ui-system/core/ai/components/Grid.json ``` -------------------------------- ### Install Once UI Starter with npx Source: https://github.com/once-ui-system/core/blob/main/apps/docs/public/llms.txt Command to scaffold a new Once UI project using the starter template. ```bash npx create-once-ui-app@latest my-app ``` -------------------------------- ### DialogProvider Setup for Stacked Dialogs Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/components/dialog.mdx Wrap your app or dialog subtree in DialogProvider to enable stacked dialogs to coordinate focus and inert behavior on the base dialog. This is a required setup for the stacked dialogs example. ```tsx import { DialogProvider } from '@once-ui-system/core'; export default function Layout({ children }) { return {children}; } ``` -------------------------------- ### Responsive Flex example output Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/hooks/useResponsiveClasses.mdx Example of a Flex component with responsive props. The hook applies 'flex-column' on medium screens and 'flex-row' on large+ screens. ```tsx {/* Hook applies 'flex-column' on medium screens */} {/* Hook applies 'flex-row' on large+ screens */} ``` -------------------------------- ### Run documentation site Source: https://github.com/once-ui-system/core/blob/main/ARCHITECTURE.md Starts the development server for the apps/docs documentation site on port 3000. ```bash cd apps/docs && pnpm dev # http://localhost:3000 ``` -------------------------------- ### Simple ToastProvider setup in layout.tsx Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/contexts/toastProvider.mdx Wrap your app with ToastProvider to activate toast functionality. This is the minimal setup required to use useToast. ```tsx {children} ``` -------------------------------- ### Run development sandbox Source: https://github.com/once-ui-system/core/blob/main/ARCHITECTURE.md Starts the development server for the apps/dev sandbox on port 3001. ```bash cd apps/dev && pnpm dev # http://localhost:3001 ``` -------------------------------- ### Advanced setup with Providers.tsx and once-ui.config.js Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/contexts/dataThemeProvider.mdx Advanced setup: create a single source of truth for style configuration in once-ui.config.js and use a Providers component to wrap your app. The Providers.tsx file imports dataStyle from the config and passes its values to DataThemeProvider, while once-ui.config.js exports the dataStyle object with the same shape as the props. ```tsx import { dataStyle } from "@/resources/once-ui.config"; import { DataThemeProvider, ThemeProvider, IconProvider, ToastProvider } from "@once-ui-system/core"; import { ChartVariant, ChartMode } from "@once-ui-system/core/data"; export function Providers({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` ```tsx export const dataStyle = { variant: "gradient", // flat | gradient | outline mode: "categorical", // categorical | divergent | sequential height: 24, // default chart height axis: { stroke: "var(--neutral-alpha-weak)", }, tick: { fill: "var(--neutral-on-background-weak)", fontSize: 11, line: false }, }; ``` -------------------------------- ### Initialize agent with npx once-ui-init-agent Source: https://github.com/once-ui-system/core/blob/main/packages/core/AGENTS.md One-time project setup command that writes AGENTS.md and a Cursor rule in the consumer app. ```bash # One-time project setup (writes AGENTS.md + Cursor rule in consumer app) npx once-ui-init-agent ``` -------------------------------- ### Advanced IconProvider setup with Providers.tsx and icons.ts Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/contexts/iconProvider.mdx Advanced setup: create a separate icons.ts file and a Providers component. The Providers component wraps the app with ThemeProvider, DataThemeProvider, ToastProvider, and IconProvider. The icons.ts file defines an iconLibrary object and augments the IconLibraryOverrides interface so that type-checks. ```tsx import { iconLibrary } from "../resources/icons.ts"; import { IconProvider, ToastProvider, ThemeProvider, DataThemeProvider } from "@once-ui-system/core"; export function Providers({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` ```tsx // Your own icons, merged with the ones Once UI ships import { HiChevronUp, HiChevronDown, HiChevronRight, HiChevronLeft, HiOutlineArrowPath, HiOutlineSun, HiOutlineMoon, HiOutlineEye, HiOutlineEyeSlash, HiOutlineClipboard, HiOutlineMagnifyingGlass, HiOutlineLink, HiArrowUpRight, HiOutlineShieldCheck, HiOutlineSparkles, HiOutlineComputerDesktop, HiOutlineQuestionMarkCircle, HiOutlineInformationCircle, HiOutlineExclamationTriangle, HiOutlineExclamationCircle, HiOutlineCheckCircle, HiOutlineXMark, HiOutlineUser, HiOutlineEyeDropper, HiOutlineMinus, HiOutlinePlus, HiOutlineCalendar, HiOutlineDocumentDuplicate, HiOutlineCheck, HiOutlineArrowsPointingIn, HiOutlineArrowsPointingOut, } from "react-icons/hi2"; export const iconLibrary = { chevronUp: HiChevronUp, chevronDown: HiChevronDown, chevronRight: HiChevronRight, chevronLeft: HiChevronLeft, refresh: HiOutlineArrowPath, light: HiOutlineSun, dark: HiOutlineMoon, help: HiOutlineQuestionMarkCircle, info: HiOutlineInformationCircle, warning: HiOutlineExclamationTriangle, danger: HiOutlineExclamationCircle, checkbox: HiOutlineCheck, check: HiOutlineCheckCircle, copy: HiOutlineDocumentDuplicate, eyeDropper: HiOutlineEyeDropper, clipboard: HiOutlineClipboard, person: HiOutlineUser, close: HiOutlineXMark, openLink: HiOutlineLink, arrowUpRight: HiArrowUpRight, minus: HiOutlineMinus, plus: HiOutlinePlus, calendar: HiOutlineCalendar, eye: HiOutlineEye, eyeOff: HiOutlineEyeSlash, search: HiOutlineMagnifyingGlass, security: HiOutlineShieldCheck, sparkle: HiOutlineSparkles, computer: HiOutlineComputerDesktop, minimize: HiOutlineArrowsPointingIn, maximize: HiOutlineArrowsPointingOut, }; // Teach Once UI these names, so type-checks. // Derived from the object above, so the two cannot drift apart. declare module "@once-ui-system/core" { interface IconLibraryOverrides extends Record {} } ``` -------------------------------- ### Monorepo pnpm scripts for dev, build, start, lint, format, typecheck, test, and clean Source: https://github.com/once-ui-system/core/blob/main/AGENTS.md Standard pnpm scripts for the monorepo. pnpm dev runs all dev servers in parallel (docs on :3000, dev on :3001, core watch). pnpm build builds everything, pnpm start starts all built apps, and pnpm lint runs Biome via Turbo. ```bash pnpm dev ``` ```bash pnpm dev:core ``` ```bash pnpm dev:docs ``` ```bash pnpm dev:dev ``` ```bash pnpm build ``` ```bash pnpm build:core ``` ```bash pnpm build:docs ``` ```bash pnpm build:dev ``` ```bash pnpm start ``` ```bash pnpm start:docs ``` ```bash pnpm start:dev ``` ```bash pnpm lint ``` ```bash pnpm format ``` ```bash pnpm typecheck ``` ```bash pnpm test ``` ```bash pnpm clean ``` -------------------------------- ### Spacing tokens usage example Source: https://github.com/once-ui-system/core/blob/main/packages/core/ai/rules.md Shows the recommended way to use spacing tokens via props like gap and padding, versus raw CSS in a style object. The good example uses Column with gap="8" and padding="24"; the bad example uses a div with inline style. ```tsx // Good // Bad
``` -------------------------------- ### Import manifest from package Source: https://github.com/once-ui-system/core/blob/main/packages/core/AGENTS.md Import the manifest JSON using a readable path that is version-pinned to your install. ```tsx // Readable paths (version-pinned to your install) import manifest from '@once-ui-system/core/ai/manifest.json'; ``` -------------------------------- ### useStyle Overrides Example (tsx) Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/contexts/themeProvider.mdx Shows how to use data-theme and data-border attributes to override styles in a Column and Row layout. The example includes a dark theme with playful border for the Column, and a light theme with rounded border for the Row. ```tsx {children} {children} ``` -------------------------------- ### RevealFx Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/effects/revealFx.mdx Documentation for the RevealFx component, including usage example and prop reference. ```APIDOC ## RevealFx ### Description Animates content into view using a vertical translateY motion. You can control the speed, delay, and triggering behavior. ### Usage ```tsx The revolution begins Get ready for the next phase. ``` ### Props - **children** (ReactNode) - What is revealed. - **revealed** (boolean) - Whether it has played. Latch this off useInViewport for a below-the-fold reveal. - **revealedByDefault** (boolean) - Start revealed, for content that is already on screen. - **speed** (string | number) - Named duration, or a number of milliseconds. - **delay** (number) - Milliseconds before it starts. Stagger a set with index * 100. - **translateY** (number | string) - How far it travels. A number is rem, a token is a spacing step. - **className** (string) - Additional CSS class names. - **style** (CSSProperties) - Inline styles. ``` -------------------------------- ### HoloFx Component Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/effects/holoFx.mdx Documentation for the HoloFx component, including its props and usage example. ```APIDOC ## HoloFx Component ### Description A lighting and texture effect that simulates a holographic sheen. It layers interactive visual effects like shine, burn, and texture over any content block, using radial masks and mouse tracking to shift light and create movement. Not supported on touch-screens. ### Props #### HoloFx Props - **children** - The content to apply the effect to. - **className** - Additional CSS class names. - **style** - Inline styles. - **shine** - The specular highlight layer. See Shine Props below. - **burn** - The blown-out highlight layer. See Burn Props below. - **texture** - The overlaid texture layer. See Texture Props below. #### Shine Props - **opacity** (number) - Default: `30` - Opacity of the shine layer. - **filter** (string) - Default: `-` - CSS filter applied to the shine layer. - **blending** (mixBlendMode) - Default: `color-dodge` - Blend mode for the shine layer. - **mask** (MaskOptions) - Default: `-` - Mask options for the shine layer. #### Burn Props - **opacity** (number) - Default: `30` - Opacity of the burn layer. - **filter** (string) - Default: `brightness(0.2) contrast(2)` - CSS filter applied to the burn layer. - **blending** (mixBlendMode) - Default: `color-dodge` - Blend mode for the burn layer. - **mask** (MaskOptions) - Default: `-` - Mask options for the burn layer. #### Texture Props - **opacity** (number) - Default: `10` - Opacity of the texture layer. - **filter** (string) - Default: `-` - CSS filter applied to the texture layer. - **blending** (mixBlendMode) - Default: `color-dodge` - Blend mode for the texture layer. - **image** (string) - Default: `repeating-linear-gradient(...)` - Image or gradient used for the texture. - **mask** (MaskOptions) - Default: `-` - Mask options for the texture layer. #### Mask Options - **maskPosition** (string) - Default: `100 200` - Position of the mask. ### Example ```tsx Proxima B ``` ### Performance HoloFx automatically detects low-end devices and the `prefers-reduced-motion` system setting. When either is detected, the mouse-tracking effect is paused. The effect also pauses when the element is outside the viewport. You can override this with the `reducedMotion` prop. ``` -------------------------------- ### UserMenu Component Source: https://github.com/once-ui-system/core/blob/main/apps/docs/src/content/components/userMenu.mdx Documentation for the UserMenu component, including its props and usage examples. ```APIDOC ## UserMenu Component ### Description Renders a user avatar and name, and opens a dropdown for settings or account-level actions when clicked or focused. Built on top of `DropdownWrapper` and `User` components. ### Props | Prop | Type | Default | Description | |------|------|---------|-------------| | `name` | `string` | - | The user's name to display. | | `subline` | `ReactNode` | - | Additional text or node displayed under the name. | | `avatarProps` | `AvatarProps` | - | Props passed to the underlying `Avatar` component. | | `loading` | `boolean` | `false` | When `true`, shows skeleton content while loading profile data. | | `minWidth` | `SpacingToken` | - | Minimum width of the dropdown. | | `maxWidth` | `SpacingToken` | - | Maximum width of the dropdown. | | `minHeight` | `SpacingToken` | - | Minimum height of the dropdown. | | `className` | `string` | - | Additional CSS class name. | | `style` | `CSSProperties` | - | Inline style object. | | `selected` | `boolean` | - | Mark the trigger as active while the menu is open. | | `placement` | `string` | - | Which side the menu opens on. | | `dropdown` | `ReactNode` | - | The menu contents. | ### Example ```tsx