### Basic IconProvider Setup Source: https://docs.once-ui.com/once-ui/contexts/iconProvider Wrap your application with IconProvider and pass an object of icons as props. This example shows how to import and provide a single icon. ```tsx import { HiHome } from "react-icons/hi2"; {children} ``` -------------------------------- ### Simple ToastProvider Setup Source: https://docs.once-ui.com/once-ui/contexts/toastProvider Wrap your application with ToastProvider to enable toast functionality. This is the most basic setup. ```tsx {children} ``` -------------------------------- ### Pulse Component Examples Source: https://docs.once-ui.com/once-ui/components/pulse Basic examples demonstrating the Pulse component with different sizes and variants. ```html ``` -------------------------------- ### Dropdown Placement Example Source: https://docs.once-ui.com/once-ui/components/dropdownWrapper Shows how to control the dropdown's position relative to the trigger element using the 'placement' prop. This example positions the dropdown above the trigger. ```javascript const [isOpen, setIsOpen] = useState(false); return ( setIsOpen(!isOpen)}> Open Upward } dropdown={ } /> ); ``` -------------------------------- ### Removable Chip Example Source: https://docs.once-ui.com/once-ui/form-controls/chip Provides a dynamic example of removable chips, demonstrating how to manage a list of chips and display toast notifications upon removal. This snippet requires the use of `useToast` and `useState` hooks. ```javascript const { useState } = require('react'); const { useToast } = require('@/hooks/useToast'); // Assuming useToast is imported from a local hook const { Row } = require('@/components/Row'); // Assuming Row component is imported const { Chip } = require('@/components/Chip'); // Assuming Chip component is imported const { addToast } = useToast(); const [chips, setChips] = useState([ { id: "1", label: "React", icon: "code" }, { id: "2", label: "TypeScript", icon: "code" }, { id: "3", label: "Next.js" } ]); const handleRemove = (id) => { const chipToRemove = chips.find(chip => chip.id === id); setChips(chips.filter(chip => chip.id !== id)); addToast({ variant: "danger", message: "Removed " + chipToRemove.label + " chip" }); }; {chips.map(chip => ( handleRemove(chip.id)} /> ))} ``` -------------------------------- ### CursorCard Placement Options Source: https://docs.once-ui.com/once-ui/components/cursorCard Examples showcasing different placement configurations for the CursorCard overlay content. ```jsx Top left } overlay={ Top left } /> Top } overlay={ Top } /> Bottom right } overlay={ Bottom right } /> ``` -------------------------------- ### Basic LayoutProvider Setup Source: https://docs.once-ui.com/once-ui/contexts/layoutProvider Wrap your application's root component with LayoutProvider to enable window size tracking for responsive components. ```tsx {children} ``` -------------------------------- ### Basic SplitView Example Source: https://docs.once-ui.com/once-ui/components/splitView Demonstrates a basic horizontal SplitView with default settings. Use this for standard left-right resizable panels. ```jsx Left Panel This is the left panel content. You can resize this panel by dragging the divider. } rightPanel={ Right Panel This is the right panel content. The divider is draggable and provides visual feedback. } /> ``` -------------------------------- ### Add Once UI to Existing Project Source: https://docs.once-ui.com/once-ui/quick-start Install the core Once UI package into an existing project using npm. ```bash npm install @once-ui-system/core ``` -------------------------------- ### InteractiveDetails Basic Examples Source: https://docs.once-ui.com/once-ui/form-controls/interactiveDetails Demonstrates the basic usage of InteractiveDetails with a label, a label and description, and a label with a tooltip. ```jsx ``` -------------------------------- ### Compact CodeBlock Example Source: https://docs.once-ui.com/once-ui/modules/codeBlock This example shows the CodeBlock in compact mode, which reduces vertical spacing for a more condensed display. Use this when screen real estate is limited. ```javascript console.log('Compact mode example'); ``` ```javascript ``` -------------------------------- ### Basic Textarea Example Source: https://docs.once-ui.com/once-ui/form-controls/textarea A simple Textarea component with a label, placeholder, and a fixed number of lines. ```jsx