This is the full developer documentation for Dreamy UI. --- title: Introduction --- # Introduction Dreamy UI is a React UI library that provides a set of customizable components and utilities to build performant, websites with ease. ## Motivation > info: Note: this isn't about which library is better, every library has its own pros and cons. Many UI libraries are built on top of CSS-in-JS libraries like [Styled Components](https://styled-components.com/) or [Emotion](https://emotion.sh/). These libraries provide a great developer experience, but they come with a cost: they use runtime CSS styles, which slow down rendering, performance and limit some features, like streaming. Dreamy UI is built on top of [Panda CSS](https://panda-css.com/), which is a CSS-in-JS library that provides strongly typed CSS styles, that are generated at **build time**, incredibly improving website performance and not decreasing developer experience. ## Solution Introducing Dreamy UI, a library that allows you to write your favorite CSS-in-JS code, while still enjoying native CSS performance. Dream comes with many utilities to write your website even faster with Boolean style props. Let's say you are sure your flex component will be column, so instead of typing `flexDir="column"`, it is possible to write `col` or `column` as prop 🎉. You can mix and use any styling style to your preference. Dream is highly customizable, meaning you can modify any component recipe in panda config. If you have had used any CSS-in-JS library before, you are fully familiar with styling components and you'll have no problem with Dream. --- ## FAQ ### What's the difference between Dream and tailwind/panda CSS? Dream is a component library, which uses Panda CSS and it's peer dependency. Tailwind and panda CSS are not component libraries, they are styling engines that provide a set of utilities to write CSS styles. ### Does Dreamy UI support SSR? Yes, Dreamy UI supports SSR. You can use it with Next.js, Remix, etc. ### Why does Dreamy UI use motion? [motion](https://motion.dev/) is a great library for animations, which provides ease of using animations in React. It is well tested and makes working with animations a breeze. ### Does Dreamy UI support React Server Components? Yes, Dreamy UI supports React Server Components. You can use it with Next.js or Remix, etc. Most basic components are supported and Dream provides set of RSC component alternatives for client ones, for example `Input` component has a RSC version called `InputRSC`, which works the same, but doesn't offer support for `Field` usage. ### Does Dreamy UI work in other libraries like Vue, Solid, etc? No, Dreamy UI is a React library. It is not designed to work with other libraries. --- title: Installation --- # Install Dreamy UI ## Quick Start (Recommended) Use the automated CLI to set up Dreamy UI in your project: ```bash npx @dreamy-ui/cli init ``` --- The CLI will automatically: 1. Detect your framework (React Router v7, Next.js, or Vite) 2. Install all required dependencies (Panda CSS + Dreamy UI) 3. Create and configure `panda.config.ts` 4. Update `vite.config.ts` or `postcss.config.mjs` with Panda CSS PostCSS plugin 5. Remove default Tailwind CSS (React Router v7 and Next.js only) 6. Set up CSS files with proper imports 7. Create a `DreamyProvider` component 8. Update your `tsconfig.json` with `@/*` path alias and styled-system (if using TypeScript) 9. Next.js also gets `styled-system/*` path alias for proper type resolution 10. Run Panda CSS codegen to generate the styled-system 11. Add recommended components (button, flex, text, heading) to get you started 12. Prints out code to add to the root of your application ## Manual Installation If you prefer manual installation or need more control, follow the framework-specific guides: - [Next.js](/docs/frameworks/next.js) - [React Router](/docs/frameworks/react-router) - [Remix](/docs/frameworks/remix) - [Vite](/docs/frameworks/vite) ### 1. Follow panda CSS installation steps Install panda by following the [panda CSS installation](https://panda-css.com/docs/overview/getting-started#installation) for your framework. ### 2. Install Dreamy UI ```bash pnpm install @dreamy-ui/react @dreamy-ui/panda-preset @dreamy-ui/cli motion ``` ### 3. Add Dream preset After installing, you should configure your panda config with Dream preset. Copy and paste the following code into your `panda.config.ts` file: ```ts {1-4, 9-25} import createDreamyPreset, { dreamyPlugin } from "@dreamy-ui/panda-preset"; import { defineConfig } from "@pandacss/dev"; import { patterns } from "./app/components/patterns"; import { recipes } from "./app/components/recipes"; export default defineConfig({ preflight: true, watch: true, jsxFramework: "react", jsxStyleProps: "all", outExtension: "js", jsxFactory: "dreamy", include: [ "./app/**/*.{js,jsx,ts,tsx}" // Replace with your app source directory ], presets: [createDreamyPreset()], plugins: [dreamyPlugin()], patterns: { extend: patterns }, theme: { extend: { recipes } }, globalCss: { extend: {} }, staticCss: { extend: {} }, }); ``` Note: The `patterns` and `recipes` imports are automatically configured by the CLI based on your framework. The paths will be adjusted for Next.js (`./src/components` or `./components`) or Vite (`./src/components`). ### 4. Add Dream Provider Add `DreamyProvider` to the root of your app. It is a wrapper for your app, which provides Dreamy UI with all the necessary context. ```tsx import { DreamyProvider } from "@dreamy-ui/react"; import domMax from "motion/react"; export default function App() { return ( ); } ``` ### 5. Try and see Dream in action Create a new component and use some Dreamy UI components! ```tsx import { Button } from "@dreamy-ui/react"; export default function Index() { return ; } ``` --- title: CLI Reference --- # Dreamy UI CLI The Dreamy UI CLI helps you initialize and manage your Dreamy UI project with ease. ## Installation The CLI is included when you install the `@dreamy-ui/cli` package: ```bash pnpm add -D @dreamy-ui/cli ``` ## Commands ### init Initialize Dreamy UI in your project with automatic setup. ```bash pnpm dreamy init ``` **What it does:** 1. Detect your framework (React Router v7, Next.js, or Vite) 2. Install all required dependencies (Panda CSS + Dreamy UI) 3. Create and configure `panda.config.ts` 4. Update `vite.config.ts` or `postcss.config.mjs` with Panda CSS PostCSS plugin 5. Remove default Tailwind CSS (React Router v7 and Next.js only) 6. Set up CSS files with proper imports 7. Create a `DreamyProvider` component 8. Update your `tsconfig.json` with `@/*` path alias and styled-system (if using TypeScript) 9. Next.js also gets `styled-system/*` path alias for proper type resolution 10. Run Panda CSS codegen to generate the styled-system 11. Add recommended components (button, flex, text, heading) to get you started 12. Prints out code to add to the root of your application **Options:** - `--yes, -y` - Skip all prompts and use defaults - `--skip-install` - Skip dependency installation (useful if you want to install manually) - `--skip-components` - Skip adding recommended components (button, flex, text, heading) **Examples:** ```bash # Interactive setup with prompts dreamy init # Skip all prompts dreamy init --yes # Skip dependency installation dreamy init --skip-install # Skip adding default components dreamy init --skip-components ``` --- ### add Add Dreamy UI components to your project. ```bash dreamy add [components...] ``` **Examples:** ```bash # Add a single component dreamy add button # Add multiple components dreamy add button input card # Add all components dreamy add --all # Add components interactively dreamy add ``` **Options:** - `--all` - Add all available components - `--force, -f` - Overwrite existing files - `--dry-run, -d` - Preview changes without writing files - `--outdir ` - Specify output directory for components - `--tsx` - Force TypeScript output **What it does:** 1. Downloads component files from the registry 2. Installs component dependencies (other components) 3. Adds required recipes and patterns 4. Runs Panda CSS codegen --- ### list List all available components in the Dreamy UI registry. ```bash dreamy list ``` Shows a table of all available components with their names and descriptions. --- ### diff Compare your local components with the registry versions. ```bash dreamy diff [component] ``` **Examples:** ```bash # Check differences for a specific component dreamy diff button # Check all components dreamy diff ``` **What it shows:** - Files that are up-to-date ✓ - Files that differ from registry ✗ - Files that don't exist locally → - A detailed diff of changes --- ## Troubleshooting ### CLI not found If you get a "command not found" error, try installing the command again: ```bash pnpm install -D @dreamy-ui/cli ``` ### Framework not detected If the CLI can't detect your framework: 1. Make sure you have a config file (`next.config.js`, `react-router.config.ts`, or `vite.config.ts`) 2. The file should be in the root of your project 3. Try running from your project root directory ### TypeScript errors after init After running `init`, you might need to: 1. Restart your TypeScript server (VS Code: Cmd/Ctrl + Shift + P → "Restart TS Server") 2. Run `npx panda codegen` to generate types 3. Check that `styled-system/**/*` is in your `tsconfig.json` include array ### Dependency installation fails If dependency installation fails during `init`, run without installing dependencies: ```md dreamy init --skip-install # Then manually install dependencies pnpm add -D @pandacss/dev @pandacss/postcss @dreamy-ui/cli pnpm add @dreamy-ui/react @dreamy-ui/panda-preset motion ``` --- ## Environment Variables The CLI respects these environment variables: - `HTTPS_PROXY` - Use a proxy for fetching components from the registry - `REGISTRY_URL` - Override the default registry URL (for development) --- ## Getting Help For more help with any command: ```md dreamy --help dreamy [command] --help ``` Visit our [documentation](https://dreamy-ui.com/docs) for more information. --- title: Charts --- # Charts Dreamy UI does not include built-in chart components, but you can easily create beautiful charts using [recharts](https://recharts.org/) and integrate them seamlessly with Dreamy UI's theming system using the `token()` utility from Panda CSS. ## Installation Install recharts in your project: ```bash npm install recharts # or pnpm add recharts # or yarn add recharts ``` ## Using Tokens for Styling Panda CSS generates a `styled-system` folder in your project that includes a `token()` utility function. This function allows you to access design tokens like colors, spacing, and other theme values that match your Dreamy UI configuration. Import the `token` function from your generated styled-system: ```tsx import { token } from "styled-system/tokens"; ``` You can then use `token()` to get theme values for styling your charts: ```tsx // Get color tokens const primaryColor = token("colors.primary"); const borderColor = token("colors.border.muted"); const textColor = token("colors.fg"); // Get spacing tokens const spacing = token("spacing.4"); // Returns the spacing value for 4 ``` ## Examples ### Bar Chart A simple bar chart with theme-aware colors: ```tsx import { Bar, BarChart, CartesianGrid, XAxis, YAxis } from "recharts"; import { token } from "styled-system/tokens"; const data = [ { name: "Jan", value: 400 }, { name: "Feb", value: 300 }, { name: "Mar", value: 500 }, { name: "Apr", value: 280 }, { name: "May", value: 390 }, ]; function BarChartExample() { return ( ); } ``` ### Line Chart with Multiple Series A line chart with multiple data series using different theme colors: ```tsx import { Line, LineChart, CartesianGrid, XAxis, YAxis, Legend, ResponsiveContainer } from "recharts"; import { token } from "styled-system/tokens"; const data = [ { month: "Jan", sales: 4000, revenue: 2400 }, { month: "Feb", sales: 3000, revenue: 1398 }, { month: "Mar", sales: 2000, revenue: 9800 }, { month: "Apr", sales: 2780, revenue: 3908 }, { month: "May", sales: 1890, revenue: 4800 }, { month: "Jun", sales: 2390, revenue: 3800 }, ]; function LineChartExample() { return ( ); } ``` ### Pie Chart A pie chart with custom colors from your theme: ```tsx import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip } from "recharts"; import { token } from "styled-system/tokens"; const data = [ { name: "Desktop", value: 400 }, { name: "Mobile", value: 300 }, { name: "Tablet", value: 200 }, { name: "Other", value: 100 }, ]; const COLORS = [ token("colors.primary"), token("colors.secondary"), token("colors.success"), token("colors.info"), ]; function PieChartExample() { return ( `${name}: ${(percent * 100).toFixed(0)}%`} outerRadius={120} fill={token("colors.primary")} dataKey="value" > {data.map((entry, index) => ( ))} ); } ``` ## Customization Since recharts is built on top of SVG, you have full control over styling. Use the `token()` function to access any design token from your Dreamy UI theme: - **Colors**: `token("colors.primary")`, `token("colors.border.muted")`, `token("colors.fg")` - **Spacing**: `token("spacing.4")`, `token("spacing.8")` - **Border Radius**: `token("radii.md")`, `token("radii.lg")` - **Shadows**: `token("shadows.lg")` - **And more**: Any token defined in your Panda CSS configuration This ensures your charts automatically match your application's theme and color mode (light/dark), providing a consistent visual experience throughout your application. --- title: LLMs --- # LLMs Dreamy UI has a `llms.txt` file that contains a whole documentation, you can use with your own LLM. ## LLMs.txt - [/llms.txt](https://dreamy-ui.com/llms.txt): The main LLMs.txt file ## Usage Copy paste the following URL into your custom docs field in your editor: <>https://dreamy-ui.com/llms.txt ### Cursor Use `@Docs` feature in Cursor to include the LLMs.txt files in your project. [Read more](https://docs.cursor.com/context/@-symbols/@-docs) ### Windsurf Reference the LLMs.txt files using `@` or in your `.windsurfrules` files. [Read more](https://docs.windsurf.com/windsurf/memories#memories-and-rules) --- title: MCP Server --- # MCP Server Dreamy UI has a MCP server that you can use to get information about the components and patterns. ## Usage The Dreamy UI has a [Model Context Protocol](https://modelcontextprotocol.io/introduction) server that provides AI assistants (like Claude Code, Cursor, and Copilot) with access to the Dreamy UI component library. ## Tools The Dreamy UI MCP exposes the following tools to AI agents: ### Component Tools - **`get_components`**: Get a complete list of all available components - **`get_component`**: Get detailed props, types, and configuration options for any component - **`get_component_example`**: Get example code for a specific Dreamy UI component ## Setup The MCP server currently supports only [stdio transport](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#stdio) and is published at `@dreamy-ui/mcp`. ### Cursor In the `.cursor/mcp.json` file at the root of your project, add the following configuration: ```json { "mcpServers": { "dreamy-ui": { "command": "npx", "args": ["-y", "@dreamy-ui/mcp"] } } } ``` > If Cursor doesn't automatically detect the changes, restart the editor or > manually enable the Dreamy UI server via "MCP Tools." ### Visual Studio Code > Make sure you have the > [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) > and > [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) > extensions installed. In the `.vscode/mcp.json` file at the root of your project, add the MCP server block: ```json { "servers": { "dreamy-ui": { "command": "npx", "args": ["-y", "@dreamy-ui/mcp"] } } } ``` The MCP server is now ready to use. Click on Start on the MCP server. ### Claude Code > Make sure you have Claude Code installed. Visit > [Anthropic docs](https://docs.anthropic.com/en/docs/claude-code/mcp) for > installation instructions. Run the following command in your terminal to add the Dreamy UI MCP server: ```bash claude mcp add dreamy-ui -- npx -y @dreamy-ui/mcp ``` The MCP server is now ready to use. Start a Claude Code session by running `claude`. ### Windsurf 1. <>Navigate to "Settings" > "Windsurf Settings" > "Cascade" 2. <>Click the "Manage MCPs" button, then click the "View raw config" button. 3. <>Add the following to the MCP configuration file (`.codeium/windsurf/mcp_config.json`): ```json { "mcpServers": { "dreamy-ui": { "command": "npx", "args": ["-y", "@dreamy-ui/mcp"] } } } ``` > You might need to click the "Refresh" button to see the MCP server in the > list. ### Zed 1. <>Go to Settings > Open Settings 2. <>In the `settings.json` file, add MCP server as a new **context server** ```json { "context_servers": { "dreamy-ui": { "source": "custom", "command": "npx", "args": ["-y", "@dreamy-ui/mcp"] } } } ``` ### Custom MCP Client To run the MCP server in a local or development environment using a custom MCP client, you need to add the MCP server to the client's configuration file. ```json { "mcpServers": { "dreamy-ui": { "command": "npx", "args": ["-y", "@dreamy-ui/mcp"] } } } ``` --- title: Skills --- # Skills Dreamy UI provides agent skills that you can use with AI assistants like Cursor to enhance your development workflow. ## What are Skills? Skills are reusable, shareable capabilities that extend AI assistant functionality. Unlike rules (which contain everything to copy), skills are lightweight commands that install predefined functionality. ## Installation To add Dreamy UI skills to your project, run: ```bash npx skills add dreamy-ui/dreamy-ui ``` This command will install the Dreamy UI skills package, making specialized capabilities available to your AI assistant. ## Usage Once installed, the skills will be automatically available to your AI assistant. The skills provide enhanced context and capabilities specifically tailored for working with Dreamy UI components and patterns. --- title: Using Next.js --- # Using Dreamy UI with Next.js ## Quick Start (Recommended) Use the automated CLI to set up Dreamy UI in your project: ```bash npx @dreamy-ui/cli init ``` --- The CLI will automatically: 1. Detect your framework (React Router v7, Next.js, or Vite) 2. Install all required dependencies (Panda CSS + Dreamy UI) 3. Create and configure `panda.config.ts` 4. Update `vite.config.ts` or `postcss.config.mjs` with Panda CSS PostCSS plugin 5. Remove default Tailwind CSS (React Router v7 and Next.js only) 6. Set up CSS files with proper imports 7. Create a `DreamyProvider` component 8. Update your `tsconfig.json` with `@/*` path alias and styled-system (if using TypeScript) 9. Next.js also gets `styled-system/*` path alias for proper type resolution 10. Run Panda CSS codegen to generate the styled-system 11. Add recommended components (button, flex, text, heading) to get you started 12. Prints out code to add to the root of your application ## Manual Installation ### 1. Follow the Panda CSS installation guide Follow the [Panda CSS installation guide](https://panda-css.com/docs/installation/nextjs) to set up Panda CSS in your Next.js project. ### 2. Install Dreamy UI Install Dreamy UI in your project: ```bash pnpm add @dreamy-ui/react @dreamy-ui/panda-preset motion ``` ### 2. Configure panda.config.ts Configure environment and panda presets in your `panda.config.ts` file: ```ts {1, 10-16} import createDreamyPreset, { dreamyPlugin } from "@dreamy-ui/panda-preset"; import { defineConfig } from "@pandacss/dev"; export default defineConfig({ ..., preflight: true, jsxFramework: "react", jsxStyleProps: "all", outExtension: "js", include: [ "./src/**/*.{js,jsx,ts,tsx}", ], presets: [ createDreamyPreset() ], plugins: [dreamyPlugin], theme: { extend: {} }, globalCss: { extend: {} }, staticCss: { extend: {} } }); ``` ### 3. Add styled-system to tsconfig.json Add the following configuration to your `tsconfig.json` file: ```json {6, 13-14} { "compilerOptions": { ... "paths": { "@/*": ["./components/ui/*"], "styled-system/*": ["./styled-system/*"] } }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", "styled-system/**/*", ".next/types/**/*.ts" ], "exclude": ["node_modules"] } ``` **Note:** Next.js requires both the `styled-system/*` path alias AND the include entry for proper type resolution. The CLI automatically configures both for you. {/* Add the following alias to your `next.config.ts` file: ```ts {2,5-12} import type { NextConfig } from "next"; import { resolve } from "node:path"; export default { webpack: (config) => { config.resolve.alias = { ...config.resolve.alias, "styled-system": resolve(__dirname, "./styled-system"), }; return config; } } satisfies NextConfig; ``` */} ### 4. Add Dreamy Provider After configuring Panda CSS, finally we can add the main Dreamy Provider to your `app/layout.tsx`. First create a `dreamy-provider.tsx` file in `components/dreamy-provider.tsx` (or `src/components/dreamy-provider.tsx` if using src directory): ```tsx "use client"; import { DreamyProvider as BaseDreamyProvider } from "@dreamy-ui/react"; import type { ColorMode } from "@dreamy-ui/react"; const domMax = () => import("motion/react").then((mod) => mod.domMax); interface DreamyProviderProps { children: React.ReactNode; colorMode?: ColorMode; } export function DreamyProvider({ children, colorMode }: DreamyProviderProps) { return ( {children} ); } ``` Next, add the `DreamyProvider` component to your `app/layout.tsx` file. This way we pass the color mode from server-side cookies so the initial document request will have the correct user color mode without flashing: ```tsx {2-3, 12, 15-19} ... import { DreamyProvider } from "@/components/dreamy-provider"; import { getSSRColorMode } from "@dreamy-ui/react/rsc"; import { cookies } from "next/headers"; ... export default async function RootLayout({ children }: Readonly<{ children: React.ReactNode; }>) { const colorMode = getSSRColorMode((await cookies()).toString()); return ( {children} ); } ``` ### 5. Start using Dreamy UI Let's write some Dreamy UI in `app/page.tsx`. ```tsx {1, 4} import { Button } from "@dreamy-ui/react"; export default function Home() { return ; } ``` --- title: Using React Router --- # Using Dreamy UI with React Router ## Quick Start (Recommended) Use the automated CLI to set up Dreamy UI in your project: ```bash npx @dreamy-ui/cli init ``` --- The CLI will automatically: 1. Detect your framework (React Router v7, Next.js, or Vite) 2. Install all required dependencies (Panda CSS + Dreamy UI) 3. Create and configure `panda.config.ts` 4. Update `vite.config.ts` or `postcss.config.mjs` with Panda CSS PostCSS plugin 5. Remove default Tailwind CSS (React Router v7 and Next.js only) 6. Set up CSS files with proper imports 7. Create a `DreamyProvider` component 8. Update your `tsconfig.json` with `@/*` path alias and styled-system (if using TypeScript) 9. Next.js also gets `styled-system/*` path alias for proper type resolution 10. Run Panda CSS codegen to generate the styled-system 11. Add recommended components (button, flex, text, heading) to get you started 12. Prints out code to add to the root of your application ## Manual Installation ### 1. Follow the Panda CSS installation guide Follow the [Panda CSS installation guide](https://panda-css.com/docs/installation/react-router) to set up Panda CSS in your React Router project. ### 2. Install Dreamy UI Install Dreamy UI in your project: ```bash pnpm install @dreamy-ui/react @dreamy-ui/panda-preset motion ``` ### 2. Configure panda.config.ts Configure environment and panda presets in your `panda.config.ts` file: ```ts {1, 10-16} import createDreamyPreset, { dreamyPlugin } from "@dreamy-ui/panda-preset"; import { defineConfig } from "@pandacss/dev"; export default defineConfig({ ..., preflight: true, jsxFramework: "react", jsxStyleProps: "all", outExtension: "js", include: [ "./src/**/*.{js,jsx,ts,tsx}", ], presets: [ createDreamyPreset() ], plugins: [dreamyPlugin], theme: { extend: {} }, globalCss: { extend: {} }, staticCss: { extend: {} } }); ``` ### 3. Add styled-system alias to tsconfig.json Add the following alias to your `tsconfig.json` file: ```json {9} { "include": [ "**/*.ts", "**/*.tsx", "**/.server/**/*.ts", "**/.server/**/*.tsx", "**/.client/**/*.ts", "**/.client/**/*.tsx", "styled-system/*" ], ... } ``` {/* Add the following alias to your `vite.config.ts` file: ```ts {1, 4-8} import { resolve } from "node:path"; export default defineConfig({ resolve: { alias: { "styled-system": resolve(__dirname, "./styled-system") } }, ... }) ``` */} ### 4. Add Dreamy Provider After configuring Panda CSS, finally we can add the main Dreamy Provider to your `app/root.tsx`. (Optional, only for Framework mode) To fix color mode flashing on document request, we need to get color mode from the loader, to render the correct color mode. ```tsx {2-4, 5, 9-13, 15, 18, 23, 32-39} ... import { DreamyProvider } from "@dreamy-ui/react"; import { getColorModeHTMLProps, getSSRColorMode } from "@dreamy-ui/react/rsc"; import type { Route } from "./+types/root"; import { useRouteLoaderData } from "react-router"; // Loaders only work for Framework mode, // you can skip this, if you are using React Router as library mode. export function loader({ request }: Route.LoaderArgs) { return { colorMode: getSSRColorMode(request) }; } const domMax = () => import("motion/react").then((mod) => mod.domMax); export function Layout({ children }: { children: React.ReactNode }) { const { colorMode } = useRouteLoaderData("root") ?? {}; return ( {children} ); } ... ``` ### 5. Start using Dreamy UI Let's write some Dreamy UI in `app/routes/_index.tsx`. ```tsx {1, 4} import { Button } from "@dreamy-ui/react"; export default function Index() { return ; } ``` --- title: Using Remix --- # Using Dreamy UI with Remix ## Quick Start (Recommended) Use the automated CLI to set up Dreamy UI in your project: ```bash npx @dreamy-ui/cli init ``` --- The CLI will automatically: 1. Detect your framework (React Router v7, Next.js, or Vite) 2. Install all required dependencies (Panda CSS + Dreamy UI) 3. Create and configure `panda.config.ts` 4. Update `vite.config.ts` or `postcss.config.mjs` with Panda CSS PostCSS plugin 5. Remove default Tailwind CSS (React Router v7 and Next.js only) 6. Set up CSS files with proper imports 7. Create a `DreamyProvider` component 8. Update your `tsconfig.json` with `@/*` path alias and styled-system (if using TypeScript) 9. Next.js also gets `styled-system/*` path alias for proper type resolution 10. Run Panda CSS codegen to generate the styled-system 11. Add recommended components (button, flex, text, heading) to get you started 12. Prints out code to add to the root of your application ## Manual Installation ### 1. Follow the Panda CSS installation guide Follow the [Panda CSS installation guide](https://panda-css.com/docs/installation/remix) to set up Panda CSS in your Remix project. ### 2. Install Dreamy UI Install Dreamy UI in your project: ```bash pnpm install @dreamy-ui/react @dreamy-ui/panda-preset motion ``` ### 2. Configure panda.config.ts Configure environment and panda presets in your `panda.config.ts` file: ```ts {1, 10-16} import createDreamyPreset, { dreamyPlugin } from "@dreamy-ui/panda-preset"; import { defineConfig } from "@pandacss/dev"; export default defineConfig({ ..., preflight: true, jsxFramework: "react", jsxStyleProps: "all", outExtension: "js", include: [ "./src/**/*.{js,jsx,ts,tsx}", ], presets: [ createDreamyPreset() ], plugins: [dreamyPlugin], theme: { extend: {} }, globalCss: { extend: {} }, staticCss: { extend: {} } }); ``` ### 3. Add styled-system alias to tsconfig.json and vite.config.ts Add the following alias to your `tsconfig.json` file: ```json {4} { "include": [ ... "styled-system/*" ], ... } ``` {/* Add the following alias to your `vite.config.ts` file: ```ts {1, 4-8} import { resolve } from "node:path"; export default defineConfig({ resolve: { alias: { "styled-system": resolve(__dirname, "./styled-system") } }, ... }) ``` */} ### 4. Add Dreamy Provider After configuring Panda CSS, finally we can add the main Dreamy Provider to your `app/root.tsx`. To fix color mode flashing on document request, we need to get color mode from the loader, to render the correct color mode. ```tsx {2-4, 6-10, 12, 15, 20, 29-36} ... import { DreamyProvider } from "@dreamy-ui/react"; import { getColorModeHTMLProps, getSSRColorMode } from "@dreamy-ui/react/rsc"; import type { LoaderFunctionArgs } from "@remix-run/node"; export function loader({ request }: LoaderFunctionArgs) { return { colorMode: getSSRColorMode(request) }; } const domMax = () => import("motion/react").then((mod) => mod.domMax); export function Layout({ children }: { children: React.ReactNode }) { const { colorMode } = useRouteLoaderData("root") ?? {}; return ( {children} ); } ... ``` ### 5. Start using Dreamy UI Let's write some Dreamy UI in `app/routes/_index.tsx`. ```tsx {1, 4} import { Button } from "@dreamy-ui/react"; export default function Index() { return ; } ``` --- title: Using Vite --- # Using Dreamy UI with Vite ## Quick Start (Recommended) Use the automated CLI to set up Dreamy UI in your project: ```bash npx @dreamy-ui/cli init ``` --- The CLI will automatically: 1. Detect your framework (React Router v7, Next.js, or Vite) 2. Install all required dependencies (Panda CSS + Dreamy UI) 3. Create and configure `panda.config.ts` 4. Update `vite.config.ts` or `postcss.config.mjs` with Panda CSS PostCSS plugin 5. Remove default Tailwind CSS (React Router v7 and Next.js only) 6. Set up CSS files with proper imports 7. Create a `DreamyProvider` component 8. Update your `tsconfig.json` with `@/*` path alias and styled-system (if using TypeScript) 9. Next.js also gets `styled-system/*` path alias for proper type resolution 10. Run Panda CSS codegen to generate the styled-system 11. Add recommended components (button, flex, text, heading) to get you started 12. Prints out code to add to the root of your application ## Manual Installation ### 1. Follow the Panda CSS installation guide Follow the [Panda CSS installation guide](https://panda-css.com/docs/installation/vite) to set up Panda CSS in your Vite project. ### 2. Install Dreamy UI Install Dreamy UI in your project: ```bash pnpm install @dreamy-ui/react @dreamy-ui/panda-preset motion ``` ### 2. Configure panda.config.ts Configure environment and panda presets in your `panda.config.ts` file: ```ts {1, 10-16} import createDreamyPreset, { dreamyPlugin } from "@dreamy-ui/panda-preset"; import { defineConfig } from "@pandacss/dev"; export default defineConfig({ ..., preflight: true, jsxFramework: "react", jsxStyleProps: "all", outExtension: "js", include: [ "./src/**/*.{js,jsx,ts,tsx}", ], presets: [ createDreamyPreset() ], plugins: [dreamyPlugin], theme: { extend: {} }, globalCss: { extend: {} }, staticCss: { extend: {} } }); ``` ### 3. Add styled-system alias to tsconfig.json and vite.config.ts Add the following alias to your `tsconfig.json` file: ```json {4} { "include": [ ... "styled-system/*" ], ... } ``` {/* Add the following alias to your `vite.config.ts` file: ```ts {1, 4-8} import { resolve } from "node:path"; export default defineConfig({ resolve: { alias: { "styled-system": resolve(__dirname, "./styled-system") } }, ... }) ``` */} ### 4. Add Dreamy Provider After configuring Panda CSS, finally we can add the main Dreamy Provider to your app root: ```tsx {2-3, 6-10, 12} ... import { DreamyProvider } from "@dreamy-ui/react"; import { domMax } from "motion/react"; ReactDOM.createRoot(document.getElementById("root")).render( ); ``` ### 5. Start using Dreamy UI Now you can start using Dreamy UI in your `src/App.tsx`. ```tsx import { Button } from "@dreamy-ui/react"; function App() { return ; } export default App; ``` --- title: Customization --- # Customization Dreamy UI depends on [pandaCSS](https://panda-css.com) as build-time css-in-js styling engine. That means every customization related to styling should be done in panda config. ## Theming Dreamy UI Preset contains only most basic styling options like background color, fonts, etc. If you want to customize more, you can extend the theme in panda config. Most basic panda config would look like this. You can extend any theme property you want in `theme.extend` object. ```ts export default defineConfig({ preflight: true, jsxFramework: "react", jsxStyleProps: "all", outExtension: "js", include: [ "./app/**/*.{js,jsx,ts,tsx}", ], presets: [ createDreamPreset() ], plugins: [dreamyPlugin], theme: { extend: { /** * Extend theme properties here */ } }, globalCss: { extend: {} }, staticCss: { extend: {} } }) ``` > info: Tip: If body font is provided and heading font is not, Dreamy UI will automatically use body font for headings. ## Customizing Components Every component in Dreamy UI has it's own recipe/slot recipe. Dreamy UI adds components to your project via CLI. That means you can go into recipes or patterns folder and manually edit the theme to your liking. Do not forget to generate panda styled-system after changing the recipe or pattern. ```bash pnpm panda codegen ``` ## Motion Variants Dreamy UI uses [Motion](https://motion.dev) under the hood for animations. You can customize how every animated component enters and exits by passing a `motionVariants` object to `DreamyProvider`. Each key corresponds to a component and holds a `Variants` object from Motion. By default, Dreamy UI uses `defaultMotionVariants`, a set of smooth, subtle animations that feel just right in any app. Use the exported `MotionVariants` type for full type safety when writing your own variants object: ```tsx import { DreamyProvider, type MotionVariants } from "@dreamy-ui/react"; const myMotionVariants: MotionVariants = { modal: { initial: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.9 } }, overlay: { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 } }, tooltip: { ... }, popover: { ... }, collapse: { ... }, checkboxCheckIcon: { ... }, actionBar: { ... } }; export default function App() { return ( {children} ); } ``` > info: All keys are required. You must provide variants for every component listed above, otherwise components with a missing key will have no animation. If you only want to tweak one or two components and keep the rest as-is, spread `defaultMotionVariants` and override just the keys you need: ```tsx import { DreamyProvider, defaultMotionVariants, type MotionVariants } from "@dreamy-ui/react"; const myMotionVariants: MotionVariants = { ...defaultMotionVariants, modal: { initial: { opacity: 0, y: -20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -20 } } }; ``` Dreamy UI also ships a ready-to-use `bouncyMotionVariants` preset that gives all components a springy, playful feel: ```tsx import { DreamyProvider, bouncyMotionVariants } from "@dreamy-ui/react"; {children} ``` There's the comparison of default and bouncy motion variants and transition: Default Bouncy ## Default Transition The `defaultTransition` prop sets the base Motion transition that is passed to `MotionConfig` and applied globally to all animated elements that don't define their own transition. ```tsx import { DreamyProvider } from "@dreamy-ui/react"; {children} ``` A matching `bouncyDefaultTransition` is also exported for use alongside `bouncyMotionVariants`: ```tsx import { DreamyProvider, bouncyMotionVariants, bouncyDefaultTransition } from "@dreamy-ui/react"; {children} ``` --- title: Panda Preset --- # Panda Preset Dreamy UI comes with a preset for pandaCSS, which provides tokens, patterns, recipes and utilities that are required for components to be styled. Color values should be only hex, rgb or hsl values. `createDreamyPreset` function accepts the object argument with following types: ```ts interface LightDarkColor { light: string; dark: string; } interface PresetOptions { /** * The background color for your app. */ backgrounds: LightDarkColor; /** * Fonts for body, heading and mono. If heading font is not provided, it will use body font for headings. */ fonts: { body: string; heading: string; mono: string; }; /** * Primary color for your app. * @default "{ light: '#000000', dark: '#ffffff' }" */ primaryColor: string | LightDarkColor; /** * Secondary color for your app. * @default "{ light: '#000000', dark: '#ffffff' }" */ secondaryColor: string | LightDarkColor; /** * Border radius for your app. * @default "md" */ rounded: BorderRadius; /** * Color for the primary button. It depends on the `primaryColor` option. * @default Dream will automatically resolve contrast to match the `primaryColor` option. */ buttonPrimaryTextColor: string | LightDarkColor; /** * Color for the secondary button. It depends on the `secondaryColor` option. * @default Dream will automatically resolve contrast to match the `secondaryColor` option. */ buttonSecondaryTextColor: string | LightDarkColor; } ``` Here's a preset configuration in `panda.config.ts` of Dreamy UI Docs: ```ts {2, 7-22} import createDreamyPreset, { dreamyPlugin } from "@dreamy-ui/panda-preset"; import { defineConfig } from "@pandacss/dev"; export default defineConfig({ ... presets: [ createDreamyPreset({ backgrounds: { light: "#FFF" dark: "#080808", }, fonts: { body: "Geist", heading: "Manrope" }, primaryColor: "#6056aa", secondaryColor: "#d193bb", rounded: "md" }) ], plugins: [dreamyPlugin()] }); ``` In other words, that's how default preset args look like: ```ts {2, 7-29} import createDreamyPreset, { dreamyPlugin } from "@dreamy-ui/panda-preset"; import { defineConfig } from "@pandacss/dev"; export default defineConfig({ ... presets: [ createDreamyPreset({ backgrounds: { light: "#fff", dark: "#0D0D0E" }, fonts: { body: "sans-serif", heading: "sans-serif", mono: "monospace" }, primaryColor: { light: "#000000", dark: "#ffffff" }, secondaryColor: { light: "#000000", dark: "#ffffff" }, rounded: "md" }) ], plugins: [dreamyPlugin()] }); ``` --- title: Tokens --- # Tokens Dreamy UI comes with a preset for Panda CSS, which provides tokens, patterns, recipes and utilities that are required for components to be styled. Tokens are meant to be type safe way of using CSS, meaning your app stays consistent and they are easy to change. ### Typography Use `size` or `textStyle` for typography instead of only `fontSize`. These properties will apply the correct font size, line height and font weight, including responsive sizes. Small text Medium text Large text ```tsx Small text Medium text Large text ``` Main colors for foreground are `fg`, `fg.max`, `fg.medium` and `fg.disabled`. Use these tokens for typography. Max text Main text Secondary text Disabled text ```tsx Max text Main text Secondary text Disabled text ``` ### Background colors Background colors are `bg`, which will be the current background color. `bg.light` and `bg.dark` are the light and dark background colors. Current Background Light background Dark background ```tsx Current Background Light background Dark background ``` ### Action colors Main action colors are `primary` and `secondary`, which you define in the dreamy preset in `panda.config.ts`. Use these colors for buttons, links, etc. <>Primary <>Secondary ```tsx Primary Secondary ``` Dreamy exports a `success`, `warning`, `error` and `info` semantic tokens to easily signalize the status of an action. <>Success <>Warning <>Error <>Info ```tsx Success Warning Error Info ``` ### Alphas Alphas are easy way to create a slightly transparent color. These colors will be black alphas for light color mode and white alphas for dark. *": { p: 2 } }} > Alpha 50 Alpha 100 Alpha 200 Alpha 300 Alpha 400 Alpha 500 Alpha 600 Alpha 700 Alpha 800 Alpha 900 Alpha 950 ```tsx Alpha 50 Alpha 100 Alpha 200 Alpha 300 Alpha 400 Alpha 500 Alpha 600 Alpha 700 Alpha 800 Alpha 900 Alpha 950 ``` ### Borders Borders are `border`, `border.muted` and `border.hover`. Use these tokens for borders. Default border Muted border Hover border ```tsx Default border Muted border Hover border ``` ### Radii Use `l1` for small rounded, `l2` for medium rounded and `l3` for large rounded. Those are values that are generated from radius property in `createDreamyPreset`. Semantic tokens <>Extra Small rounded <>Small rounded <>Medium rounded <>Large rounded <>Padding 2 <>Padding 3 <>Padding 4 <>Padding 5 <>Padding 6 Design tokens <>None rounded <>XS rounded <>SM rounded <>MD rounded <>LG rounded <>XL rounded <>2XL rounded <>3XL rounded <>Full rounded ```tsx Semantic tokens Extra Small rounded Small rounded Medium rounded Large rounded Padding 2 Padding 3 Padding 4 Padding 5 Padding 6 Design tokens None rounded XS rounded SM rounded MD rounded LG rounded XL rounded 2XL rounded 3XL rounded Full rounded ``` ### Other tokens Using other blur, shadows, durations, etc. When building your app, use tokens for consistency. ```tsx Blurred box Shadowed box Fast transition ``` For more information visit [Panda CSS docs](https://panda-css.com/docs/customization/theme), since Dreamy UI extends Panda CSS default preset. --- title: Fonts --- # Using fonts Learn how to use custom fonts in your project. For more bare bone guide, see [pandaCSS docs](https://panda-css.com/docs/guides/fonts). ## Own font files This is the easiest way to use custom fonts in your project. You can add your font files to the `public` folder and use them in your project. Then we need to set the font face and use the fonts in the `panda.config.ts` file. If you font is variable, you can skip the array and just use one object. ```ts {3-24} export default defineConfig({ ... globalFontface: { Metropolis: [ { src: 'url(/fonts/Metropolis-Bold.otf) format("opentype")', fontWeight: "700", fontStyle: "normal", fontDisplay: "swap" }, { src: 'url(/fonts/Metropolis-Regular.otf) format("opentype")', fontWeight: "400", fontStyle: "normal", fontDisplay: "swap" }, { src: 'url(/fonts/Metropolis-Light.otf) format("opentype")', fontWeight: "300", fontStyle: "normal", fontDisplay: "swap" } ] } }); ``` Now we just have to set the tokens in dreamy preset. Heading font is optional, if not provided, it will use body font for headings. ```ts {5-8} export default defineConfig({ ... presets: [ createDreamyPreset({ fonts: { heading: "Metropolis", // optional body: "Metropolis", } }) ], globalFontface: { ... } }); ``` ## Next.js Next.js provides a built-in way to use Google Fonts and local fonts at once. ```tsx import { Fira_Code } from 'next/font/google' import localFont from 'next/font/local' export const MonaSans = localFont({ src: '../fonts/Mona-Sans.woff2', display: 'swap', variable: '--font-mona-sans' }) export const FiraCode = Fira_Code({ weight: ['400', '500', '700'], display: 'swap', subsets: ['latin'], variable: '--font-fira-code' }) export default function Layout(props) { const { children } = props return ( {children} ) } ``` Then make sure to set the fonts in the dreamy preset in the `panda.config.ts` file. ```ts {4-7} export default defineConfig({ presets: [ createDreamyPreset({ fonts: { body: "var(--font-mona-sans)", heading: "var(--font-fira-code)", } }) ], ... }); ``` --- title: Gotchas --- # Gotchas In this document we'll list some gotchas about how to use Dreamy UI. ## Properly using tokens See [Tokens docs](/docs/theming/tokens) page to learn about how to use type-safe tokens in your app. ## Lazy loading Dreamy UI can be used with a lazily loaded motion/react. If your bundler supports lazy loading, you can do it like this: #### 1. Create a `features.ts` file in your project root. Re-export there needed functions. ```ts import { domMax } from "motion/react"; export default domMax; ``` #### 2. Lazily import the features in your app root. ```tsx {1, 14-18, 20} const motionFeatures = () => import("./features").then((mod) => mod.default); export function Layout({ children }: { children: React.ReactNode }) { return ( ... {children} ); } ``` ## Button as a Link In many cases, you might want to use a Button as a Link. You can use polymorphic props to achieve this. ```tsx import { Link } from "react-router"; import { Button } from "@/ui"; export function LinkButton() { return ( ); } ``` ## Fastest way to center a div Dreamy UI provides various utilities to use, like `center`, which is a `alignItems="center"` and `justifyContent="center"`. Centered ```tsx {1} Centered ``` ## Making Forms The best practice is to use `` component to wrap your form elements with nice label, help text and error message. See [Field docs](/docs/components/field) page to learn more. Name <>Enter your preferred name <>Name cannot be empty ```tsx Name Enter your preferred name Name cannot be empty ``` Alternatively use props in Field for label, help text and error. ```tsx ``` ## Boolean style props Dreamy UI adds panda `utilities` for faster writing styles. Most used CSS properties are available as boolean props. ```tsx // full -> width="full" // nowrap -> wrap="nowrap" // relative -> pos="relative" // semibold -> fontWeight="semibold" Boolean Box ``` ## Polymorphic props Of any of the Dreamy UI components, you can pass `as` prop to change the element type. Use `asChild` prop to merge the component with the child component. Use `asComp` to pass a custom component to the component. Same as `asChild`, but allows merging without the children component. <>I render as section. Inspect to see the element type. ```tsx I render as section. Inspect to see the element type. ``` ## Customization If you dislike any of the token, component recipe or default values of the patterns like `Flex`, you can customize it with: - Components: Modify recipe and pattern files directly in the `recipes` and `patterns` folders. - Tokens: Modify the panda tokens in the `panda.config.ts` file. See [Panda Docs](https://panda-css.com/docs/customization/theme) for more information. Please note that Dreamy UI uses user's `styled-system` as design system, so any changes you make to the `panda.config.ts`, will be applied to all Dreamy UI components. This means components are always in sync with variants, patterns and token types. See [Customization](/docs/theming/customization) for more information. If you struggle, please do not hesitate to ask for help on Discord. --- title: Accordion description: Accordion is set of components that allow you to create toggleable content. isServerComponent: false source: /packages/react/src/components/accordion/accordion.tsx themeSource: /packages/system/src/recipes/accordion.ts --- ## Installation ```bash pnpm dreamy add accordion ``` ## Usage Accordion is a component that allows you to toggle the visibility of content. {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ```tsx {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ``` ### Allow Multiple Open You can allow multiple open items by using the `allowMultiple` prop. {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ```tsx {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ``` ### Allow Toggle You can allow toggle single item by using the `allowToggle` prop. With `allowMultiple` prop, it will be always possible to toggle them. {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ```tsx {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ``` ### Controlled You can control the Accordion by using the `onValueChange` prop. ```tsx export function ControlledAccordion() { const [value, setValue] = useState(0); return ( setValue(i)} > {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ); } ``` ### With icon {Array.from({ length: 3 }).map((_, index) => ( } color="fg.medium" /> Item {index + 1} Hi! ))} ```tsx {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ``` ### Variants You can change the variant of the Accordion by using the `variant` prop. Outline {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} Solid {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} Subtle {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ```tsx Outline {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} Solid {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} Subtle {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ``` ### Sizes You can change the size of the Accordion by using the `size` prop. Small {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} Medium {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} Large {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ```tsx Small {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} Medium {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} Large {Array.from({ length: 3 }).map((_, index) => ( Item {index + 1} Hi! ))} ``` --- title: Action Bar description: Action Bar is used to display a bottom action bar with a set of actions for selected items. isServerComponent: false source: /packages/react/src/components/action-bar/use-action-bar.ts themeSource: /website/compositions/recipes/action-bar.ts --- ## Installation ```bash pnpm dreamy add action-bar ``` ## Usage Action Bar is a component that displays a set of actions at the bottom of the screen, typically used for bulk operations on selected items. ```tsx function ControlledActionBar() { const { isOpen, onToggle, onClose } = useControllable(); return ( <> Show Action Bar 2 items selected ); } ``` ### With Close Trigger Add a close button to allow users to dismiss the action bar manually. ```tsx function ActionBarWithClose() { const { isOpen, onToggle, onClose } = useControllable(); return ( <> Show Action Bar 5 items selected ); } ``` ### Multiple Actions You can include multiple action buttons to provide various operations. ```tsx function ActionBarMultiple() { const { isOpen, onToggle, onClose } = useControllable(); return ( <> Show Action Bar 12 files selected ); } ``` ### Sizes You can change the size of the action bar using the `size` prop. Small Medium Large ```tsx function ActionBarSizes({ size = "md" }: { size?: ActionBarVariantProps["size"] }) { const { isOpen, onToggle, onClose } = useControllable(); return ( <> Show {size} Action Bar 2 selected ); } ``` ### With Table Integration A common use case is integrating the action bar with table selections. ```tsx interface User { id: number; name: string; age: number; gender: string; isSelected: boolean; } function ActionBarTable() { const [users, setUsers] = useState([ { id: 1, name: "John Doe", age: 20, gender: "Male", isSelected: false }, { id: 2, name: "Jane Doe", age: 22, gender: "Female", isSelected: false }, { id: 3, name: "Jim Doe", age: 25, gender: "Male", isSelected: false } ]); const { isOpen, onClose } = useControllable({ isOpen: users.some((user) => user.isSelected), onClose: () => setUsers((prev) => prev.map((user) => ({ ...user, isSelected: false }))) }); const toggleSelection = useCallback((id: number) => { setUsers((prev) => prev.map((user) => (user.id === id ? { ...user, isSelected: !user.isSelected } : user)) ); }, []); const unselectAll = useCallback(() => { setUsers((prev) => prev.map((user) => ({ ...user, isSelected: false }))); }, []); const toggleSelectionAll = useCallback(() => { setUsers((prev) => prev.map((user) => ({ ...user, isSelected: !prev.every((user) => user.isSelected) })) ); }, []); return ( <> user.isSelected)} isIndeterminate={ users.some((user) => user.isSelected) && !users.every((user) => user.isSelected) } onChangeValue={toggleSelectionAll} /> Name Age Gender {users.map((user, index) => ( td:first-of-type": { borderStartStartRadius: "l2" }, "& > td:last-of-type": { borderStartEndRadius: "l2" } }} _hover={{ bg: "alpha.50" }} _last={{ "& > td:first-of-type": { borderEndStartRadius: "l2" }, "& > td:last-of-type": { borderEndEndRadius: "l2" } }} bg={user.isSelected ? "alpha.50" : "transparent"} cursor={"pointer"} key={index} onClick={() => toggleSelection(user.id)} > toggleSelection(user.id)} /> {user.name} {user.age} {user.gender} ))} {users.filter((user) => user.isSelected).length} selected ); } ``` ### Uncontrolled Usage You can use the action bar in an uncontrolled mode with `defaultIsOpen`. ```tsx console.log('closed')}> 1 selected ``` --- title: Alert description: Alert signalizes the user about important information. isServerComponent: true source: /packages/react/src/components/alert/alert.tsx themeSource: /packages/system/src/recipes/alert.ts --- ## Installation ```bash pnpm dreamy add alert ``` ## Usage Alert signalizes the user about important information. ```tsx ``` ### Status The `status` prop changes the color of the alert and the icon. ```tsx ``` ### Variants The `variant` prop changes the style of the alert. ```tsx ``` --- title: Autocomplete description: Autocomplete is a text input that filters a list of options as the user types. isServerComponent: false --- ## Installation ```bash pnpm dreamy add autocomplete ``` ## Usage Basic usage of Autocomplete. Items are passed as an array of `{ value, label }` objects. The dropdown filters automatically as the user types. ```tsx const fruits = [ { value: "strawberry", label: "Strawberry" }, { value: "banana", label: "Banana" }, { value: "orange", label: "Orange" }, { value: "cherry", label: "Cherry" }, { value: "mango", label: "Mango" }, ]; ``` ### Size Autocomplete comes with 4 different sizes. {["sm", "md", "lg"].map((size) => ( ))} ```tsx {["sm", "md", "lg"].map((size) => ( ))} ``` ### Variant Autocomplete can be used in `outline` or `solid` variant. {["outline", "filled", "flushed", "filledOutline"].map((variant) => ( ))} ```tsx ``` ### Controlled Control the selected value externally with `value` and `onChangeValue`. ```tsx export function ControlledAutocomplete() { const [value, setValue] = useState(null); return ( Selected: {value ?? "none"} ); } ``` ### Custom filter Pass a `filterFn` prop to override the default case-insensitive substring matching. The function receives each item and the current query string; return `true` to include the item. item.label.toLowerCase().startsWith(query.toLowerCase())} > ```tsx item.label.toLowerCase().startsWith(query.toLowerCase()) } > ``` ### Custom item rendering Use the `renderItem` prop on `Autocomplete.Content` to fully customise how each item is displayed. The render function receives the filtered `AutocompleteItem` and must return a React node. Use `Autocomplete.Item` with the matching `value` so selection still works correctly. ( {item.label} )} /> ```tsx ( {item.label} )} /> ``` ### With icon Pass an `icon` prop to `Autocomplete.Input` to show a leading icon inside the input. ```tsx } /> ``` ### Clearable By default, a clear button appears when a value is selected. Set `isClearable={false}` to hide it. ```tsx ``` ### No results text Customise the message shown when no items match the query with the `noResultsText` prop on `Autocomplete.Content`. ```tsx ``` ### Async loading Fetch items when the autocomplete is opened using the `onOpen` prop. Use `noResultsContent` on `Autocomplete.Content` to show a spinner while loading. ```tsx export function AsyncAutocomplete() { const [isLoading, setIsLoading] = useState(true); const [items, setItems] = useState([]); function fetchItems() { if (items.length > 0) return; fetch("/api/fake-select-data") .then((res) => res.json()) .then((data: string[]) => setItems(data.map((s) => ({ value: s, label: s.charAt(0).toUpperCase() + s.slice(1) }))) ) .finally(() => setIsLoading(false)); } return ( : undefined} /> ); } ``` ### Virtualized For large lists (100+ items), use `Autocomplete.VirtualContent` instead of `Autocomplete.Content`. It uses windowed rendering — only visible items are in the DOM — which significantly improves performance and reduces memory usage. ```tsx const manyItems = Array.from({ length: 1000 }, (_, i) => ({ value: `item-${i}`, label: `Item ${i + 1}`, })); ``` #### Props - `estimatedItemHeight` — Estimated height of each item in pixels. For different autocomplete sizes: `xs`: `26`, `sm`: `28`, `md`: `32`, `lg`: `40`. Default: `32` - `overscan` — Number of items to render outside the visible area. Higher values reduce flickering during fast scrolling. Default: `5` - `maxHeight` — Maximum height of the virtualized list in pixels. Default: `300` ```tsx ``` ### Selected item background scheme You can customise the background color of the selected item with the `selectedItemBackgroundScheme` prop. {["primary", "success", "warning", "error", "none"].map((scheme) => ( <> {scheme} ))} ```tsx {["primary", "success", "warning", "error", "none"].map((scheme) => ( ))} ``` --- title: Avatar description: Avatar is a simple `div` tag with styled system. isServerComponent: false source: /packages/react/src/components/Avatar/Avatar.tsx themeSource: /packages/system/src/recipes/avatar.ts --- ## Installation ```bash pnpm dreamy add avatar ``` ## Usage Avatar is a component that displays a user's profile picture without blocking navigation to load the image. ```tsx ``` ### Sizes You can set the size of the avatar by using the `size` prop. ```tsx ``` ### Avatar Group AvatarGroup is a wrapper around Avatars that displays a number of avatars grouped together in a stack. Use `maxAvatars` prop to limit the number of avatars displayed. ```tsx ``` ### Variants You can change the variant of the avatar by using the `variant` prop. ```tsx ``` ### Badge You can add a badge to the avatar by creating an absolute container inside relative one. ```tsx ``` ### Show border You can show a border around the avatar by using the `showBorder` prop. This will create a border with a current background color. Use `borderColor` prop to change the color of the border. ```tsx ``` ### Persona Using more Dreamy UI components, you can create a nice looking persona component. <>Alexandra <>Dream ```tsx Alexandra Dream ``` --- title: Badge description: Badge can be used to highlight important information. isServerComponent: true source: /packages/react/src/components/badge/badge.tsx themeSource: /packages/system/src/recipes/badge.ts --- ## Installation ```bash pnpm dreamy add badge ``` ## Usage Badge is a component that can be used to highlight important information. Prime ```tsx Prime ``` ### Variants You can change the variant of the Badge by using the `variant` prop. Outline Subtle Plain ```tsx Outline Subtle Plain ``` ### (Color) Schemes You can change the color scheme of the Badge by using the `scheme` prop. Don't mistake this with the css `colorScheme` property. Primary Secondary Success Warning Error Info None ```tsx Primary Secondary Success Warning Error Info None ``` ### Schemes with variants You can combine the `variant` and `scheme` props to create a badge with different variants and colors. <>Primary <>Secondary <>Success <>Warning <>Error <>Info <>None ```tsx Primary Secondary Success Warning Error Info None ``` --- title: Box description: Box is a simple `div` tag with styled system. isServerComponent: true source: /packages/react/src/components/box/Box.tsx --- ## Installation ```bash pnpm dreamy add box ``` ## Usage Box is the most fundamental layout component that provides basic styling capabilities. Use it as a building block for creating custom layouts and designs. <>This is a box ```jsx This is a box ``` --- title: Breadcrumb description: Breadcrumb is used to display a page's location within a site's hierarchical structure. isServerComponent: false source: /packages/react/src/components/breadcrumb/use-breadcrumb.ts themeSource: /website/compositions/recipes/breadcrumb.ts --- ## Installation ```bash pnpm dreamy add breadcrumb ``` ## Usage Breadcrumb is a component that displays the current page location within a navigational hierarchy. Docs Components Breadcrumb ```tsx Docs Components Breadcrumb ``` ### Custom Separator You can customize the separator between breadcrumb items by passing children to `Breadcrumb.Separator`. Home Category Product ```tsx Home Category Product ``` ### With Icons Add icons to breadcrumb links by including them as children alongside the text. <>Home <>Products Laptop ```tsx Home Products Laptop ``` ### With Ellipsis Use `Breadcrumb.Ellipsis` to indicate collapsed breadcrumb items. Home Category Subcategory Current Page ```tsx Home Category Subcategory Current Page ``` ### Sizes You can change the size of the breadcrumb by using the `size` prop. Small Home Category Current Medium Home Category Current Large Home Category Current ```tsx Small Home Category Current Medium Home Category Current Large Home Category Current ``` ### Variants You can change the variant of the breadcrumb by using the `variant` prop. Plain Home Category Current Underline Home Category Current ```tsx Plain Home Category Current Underline Home Category Current ``` ### With Router Integration You can use breadcrumb with routing libraries by using the `asChild` prop or replacing the `href` with appropriate routing props. ```tsx import { Link } from "react-router"; Home Products Laptop ``` --- title: Button description: Button is a primary action element that performs an action when clicked. isServerComponent: false source: /packages/react/src/components/button/button.tsx themeSource: /packages/system/src/recipes/button.ts --- ## Installation ```bash pnpm dreamy add button ``` ## Usage Button is used to trigger an action or event, such as submitting a form or opening a dialog. It provides various styling options and supports different variants. ```tsx ``` ### Variants You can change the variant of the Button by using the `variant` prop. ```tsx ``` ### Sizes You can set the size of the Button by using the `size` prop. ```tsx ``` ### Color When using `solid`, `outline` and `ghost` variants, the button color will follow the current color scheme. For `solid` and `ghost` variants, you can just use `color` property, it will work the same. However for `outline` variant, you need to use only `scheme` property. ```tsx ``` ### Using Icons You can add icons on left or right side of the Button by using the `leftIcon` or `rightIcon` prop. **Left Icon** ```tsx ``` **Right Icon** ```tsx ``` ### Disabled You can disable the Button by using the `isDisabled` prop. ```tsx ``` ### Loading State You can show the loading state of the Button by using the `isLoading` prop. ```tsx ``` **With label** ```tsx ``` **With label and spinner on the right** ```tsx ``` ### Disable ripple You can disable the ripple effect of the Button by using the `disableRipple` prop. This can be provided in `DreamyProvider` as a global setting. ```tsx ``` ### Group Use the `Group` component to group multiple Buttons together. ```tsx ``` ### As Link Often you need to use a Button as a link. You can do this by using the `as` prop. ```tsx ``` ### Different active state If you dislike the default ripple effect, you can customize the button recipe to use a different active state. For example scale the button when it's pressed. Scale Scale + Ripple ```tsx {15-18} export const button = defineRecipe({ className: "button", staticCss: ["*"], jsx: [ "Button", "ModalCloseButton", "PopoverCloseButton", "CloseButton", "IconButton", "ModalCloseButtonBase", "ButtonIcon" ], base: parts({ root: { _active: { scale: 0.95 }, transitionProperty: "background-color, color, border-color, fill, scale", ... ``` --- title: Card description: Card is a component that displays content in a card format. isServerComponent: false source: /packages/react/src/components/card/card.tsx themeSource: /packages/system/src/recipes/card.ts --- ## Installation ```bash pnpm dreamy add card ``` ## Usage Card is a component that displays content in a card format, for example a blog post, a product, a user profile or a form. Card Title <>This is the card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. ```tsx Card Title This is the card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. ``` ### Variants You can change the variant of the card by using the `variant` prop. Elevated <>This is the card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. Outline <>This is the card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. ```tsx Elevated This is the card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. Outline This is the card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. ``` ### With Divider Example of a card with a dividers layout. Dreamy UI logo Dreamy UI dreamy-ui.com Create dream websites with next-gen DX and crispy UI. Powered by Panda CSS. <>Visit source code on GitHub } /> ```tsx Dreamy UI logo Dreamy UI dreamy-ui.com Create dream websites with next-gen DX and crispy UI. Powered by Panda CSS. Visit source code on GitHub ``` ### Sizes Example of a card with different sizes using the `size` prop. Small Card <>This is the small card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. Medium Card <>This is the medium card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. Large Card <>This is the large card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. ```tsx Small Card This is the small card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. Medium Card This is the medium card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. Large Card This is the large card body. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec odio vel dui euismod fermentum. Curabitur nec odio vel dui euismod fermentum. ``` ### With form Example of a card with a multiple fields and a buttons. > info: Tip: `full` is an alias for `width="full"`. Form Card <>Fill in the form below to create an account ```tsx Form Card Fill in the form below to create an account ``` ### As Link Example of a card as a link, that navigates to a different page. } maxW="sm"> Dreamy UI logo Dreamy UI dreamy-ui.com Create dream websites with next-gen DX and crispy UI. Powered by Panda CSS. <>Star on GitHub } /> ```tsx } maxW="sm"> Dreamy UI logo Dreamy UI dreamy-ui.com Create dream websites with next-gen DX and crispy UI. Powered by Panda CSS. Star on GitHub } /> ``` --- title: Checkbox Card description: A selectable card component that behaves like a checkbox isServerComponent: false source: /packages/react/src/components/checkbox-card/checkbox-card.tsx themeSource: /packages/system/src/recipes/checkbox-card.ts --- ## Installation ```bash pnpm dreamy add checkbox-card ``` ## Usage Checkbox Card is a component that allows you to select a value from a list of options. ```tsx ``` ### Variant Change the variant of the checkbox card. ```tsx ``` ### Checkbox variant Change the checkbox variant of the checkbox card. ```tsx ``` ### Scheme Change the color scheme of the checkbox card. ```tsx ``` ### Size Change the checkbox card size. ```tsx ``` ### Controlled Use `isChecked` and `onChange`, `onChangeValue` to control the checkbox card. ```tsx export function ControlledCheckboxCard() { const [isChecked, setIsChecked] = useState(false); return ( <> Selected: {isChecked ? "true" : "false"} ); } ``` ### Checkbox Group Use `CheckboxGroup` to compose multiple checkboxes or checkbox cards. ```tsx function CheckboxCardGroupControl() { const [value, setValue] = useState>(["1"]); return ( <> Selected: {value.join(", ")} ); } ``` --- title: Checkbox description: Checkbox is used to select one or more options from a list. isServerComponent: false source: /packages/react/src/components/checkbox/checkbox.tsx themeSource: /packages/system/src/recipes/checkbox.ts --- ## Installation ```bash pnpm dreamy add checkbox ``` ## Usage Checkbox allows users to select multiple options from a list. Use it for multi-selection scenarios and boolean preferences. <>Default ```tsx Default ``` ### Scheme Change the color scheme of the checkbox. Primary Secondary Success Warning Error Info None ```tsx Primary Secondary Success Warning Error Info None ``` ### Variant Change the appearance variant of the checkbox. Outline Solid ```tsx Outline Solid ``` ### Size Change the checkbox size. Small Medium Large ```tsx Small Medium Large ``` ### Controlled Use `isChecked` and `onChange`, `onChangeValue` to control the checkbox. ```tsx export function ControlledCheckbox() { const [isChecked, setIsChecked] = useState(false); return ( <> Selected: {isChecked ? "true" : "false"} Controlled ); } ``` ### Checkbox group Use `CheckboxGroup` to compose multiple checkboxes. Use `value` and `onChange` in `` to control the selected checkboxes. CheckboxGroup also accepts all the variant props of the Checkbox component. Every Checkbox in the CheckboxGroup should have a unique `value` prop. ```tsx function CheckboxGroupControl() { const [value, setValue] = useState>(["1"]); return ( <> Selected: {value.join(", ")} Option 1 Option 2 Option 3 ); } ``` --- title: Close Button description: CloseButton can be used to close a container. isServerComponent: false source: /website/compositions/ui/close-button.tsx themeSource: /website/compositions/recipes/close-button.ts --- ## Installation - `CloseButton` - The true CloseButton component. ```bash pnpm dreamy add close-button ``` ## Usage `CloseButton` is built on top of the `Button`, so all props of [Button](./button) are available. Can be used to close any container. `aria-label` prop is required for accessibility. ```tsx ``` --- title: Date Picker description: Date Picker allows users to select a date from a calendar popover. isServerComponent: false source: /packages/react/src/components/date-picker/date-picker.tsx themeSource: /packages/system/src/recipes/date-picker.ts --- ## Installation ```bash pnpm dreamy add date-picker ``` ## Usage Date Picker provides a calendar interface for selecting dates. It can be used with either an input field or a button trigger. ### With Input The most common usage is with an input field that displays the selected date. ```tsx ``` ### With Button Trigger You can also use a button as the trigger instead of an input field. Select Date ```tsx Select Date ``` ### With View Navigation Add `DatePicker.Nav` below the `Control` to let users switch between Day, Month, and Year views. The default view is Day (the standard calendar grid). Month view shows a 3-column month grid. Year view shows a scrollable 3-column year grid from the current year +10 down to 1919, with custom year inputs at the top (for future years) and bottom (for years before 1919). ```tsx ``` ### Controlled You can control the date picker's value using the `value` and `onChange` props. ```tsx function ControlledDatePicker() { const [date, setDate] = useState(null); return ( ); } ``` ### With Default Value Set an initial date using the `defaultValue` prop. ```tsx ``` ### Date Range Constraints Use `minDate` and `maxDate` to restrict selectable dates. ```tsx ``` ### Week Start By default, Date Picker starts the week on Monday (`weekStartsOn={1}`). Use `weekStartsOn` to change the first day of the week (`0` = Sunday, `1` = Monday, ... `6` = Saturday). ```tsx ``` ### Custom Date Format Customize the date format displayed in the input using the `dateFormat` prop. The format uses dayjs format strings. ```tsx ``` ### Custom Placeholder Set a custom placeholder text for the input field. ```tsx ``` ### Custom Header and Footer Child Props Pass props to `DatePicker.Header` and `DatePicker.Footer` child parts to customize labels, variants, and styles while keeping the default structure. ```tsx ``` ### AIO (All-in-One) Use `DatePicker.AIO` when you want the full date picker structure in one component. It renders `Input`, `PopoverContent`, `Header`, `Calendar`, and `Footer` for you. ```tsx function DatePickerAIOExample() { const [date, setDate] = useState(null); function handleApply() { console.log("Date applied:", date); } function handleCancel() { console.log("Date selection cancelled"); } return ( ); } ``` ### Sizes Date Picker comes in three sizes: `sm`, `md`, and `lg`. ```tsx ``` --- title: Divider description: Divider is used to display line separator between elements. isServerComponent: true source: /packages/react/src/components/divider/divider.tsx themeSource: /packages/system/src/recipes/divider.ts --- ## Installation ```bash pnpm dreamy add divider ``` ## Usage Divider creates a visual separation between sections of content. It can be horizontal or vertical and helps organize your layout. ```tsx ``` ### Orientation You can change the orientation of the Divider by using the `orientation` prop. Horizontal Vertical ```tsx Horizontal Vertical ``` ### Label You can add a label between dividers to create a visual separation. OR ```tsx OR ``` --- title: Editable description: Editable can be used to create editable fields, where default view should be a text. isServerComponent: false source: /packages/react/src/components/editable/editable.tsx themeSource: /packages/system/src/recipes/editable.ts --- ## Installation ```bash pnpm dreamy add editable ``` ## Usage Editable is a component that allows you to edit text, in a compact way. The placeholder will be shown in the preview, when the value is empty. ```tsx ``` ### Double Click Editable can be used to trigger edit mode on double click. Double click the preview to enter edit mode, enter to submit, esc to cancel. ```tsx ``` ### Controlled Use `value` and `onChange` to control the editable value. ```tsx function ControlledEditable() { const [value, setValue] = useState("Meow"); return ( ); } ``` ### Accessing internal state {({ isEditing, onSubmit, onCancel, onEdit }) => { return ( <> isEditing: {isEditing ? "true" : "false"} ); }} ```tsx {({ isEditing, onSubmit, onCancel, onEdit }) => { return ( <> isEditing: {isEditing ? "true" : "false"} ); }} ``` ### Start with edit view Use `startWithEditView` to use edit state by default. Click "Render" to render the editable. ```tsx ``` ### Is preview focusable Use `isPreviewFocusable` to control whenever the preview should be focusable, that means it can be focused via keyboard or click. It is `true` by default. ```tsx ``` ### Submit on blur Use `submitOnBlur` to control when the value should be submitted on blur. Default is `true`. This example won't submit, when blur happens. ```tsx ``` ### onCancel, onSubmit, onEdit, onBlur Use `onCancel`, `onSubmit`, `onEdit`, `onBlur` to handle the editable events. Open the console toast({ title: "onCancel" })} onSubmit={() => toast({ title: "onSubmit" })} onEdit={() => toast({ title: "onEdit" })} onBlur={() => toast({ title: "onBlur" })} > ```tsx toast({ title: "onCancel" })} onSubmit={() => toast({ title: "onSubmit" })} onEdit={() => toast({ title: "onEdit" })} onBlur={() => toast({ title: "onBlur" })} > ``` ### Select all on focus Whenever text in input should be selected when entering edit mode. ```tsx ``` ### Final Focus Ref Use `finalFocusRef` to set the ref of element to receive focus when edit mode exits. ```tsx function FinalFocusRefEditable() { const ref = useRef(null); return ( <> ); } ``` --- title: Empty State description: Used to indicate when a resource is empty or unavailable. isServerComponent: false source: /packages/react/src/components/empty-state/empty-state.tsx themeSource: /packages/panda-preset/src/recipes/empty-state.ts --- ## Installation ```bash pnpm dreamy add empty-state ``` ## Usage Empty State is used to indicate when a resource is empty or unavailable, for example when there are no items in a table, no search results, or an empty cart. Your cart is empty Explore our products and add items to your cart ```tsx Your cart is empty Explore our products and add items to your cart ``` ### Sizes Use the `size` prop to set the size of the Empty state. Your cart is empty Explore our products and add items to your cart Your cart is empty Explore our products and add items to your cart Your cart is empty Explore our products and add items to your cart ```tsx Your cart is empty Explore our products and add items to your cart Your cart is empty Explore our products and add items to your cart Your cart is empty Explore our products and add items to your cart ``` ### With Action Here's an example of an empty state with an action button. Start adding tokens Add a new design token to get started ```tsx Start adding tokens Add a new design token to get started ``` ### With List Here's an example of an empty state with a list. No results found Try adjusting your search Try removing filters Try different keywords ```tsx No results found Try adjusting your search Try removing filters Try different keywords ``` --- title: Field description: Field provides a way to add accessible labels to form elements. isServerComponent: false source: /packages/react/src/components/field/field.tsx themeSource: /packages/system/src/recipes/field.ts --- ## Installation ```bash pnpm dreamy add field ``` ## Usage Field is a wrapper component that provides a way to create accessible form elements. <>Username <>This is the username you will use to login ```tsx Username This is the username you will use to login ``` - **Required** Required indicator is automatically added to the label when the `isRequired` prop is passed. <>Username ```tsx Username ``` - **Invalid** Input will be marked as invalid when the `isInvalid` prop is passed. Also the `Field.Error` component will be shown if it is present. <>Username ```tsx Username ``` - **Disabled** Whole field will be disabled when the `isDisabled` prop is passed. <>Username ```tsx Username ``` ### Field Error Field error **will show only** when the `Field` has `isInvalid` prop. <>Username <>This username is too short! ```tsx Username This username is too short! ``` ### Field Hint Field hint can be used to prompt the user with additional information. <>Username <>This is the username you will use to login ```tsx Username This is the username you will use to login ``` ### Using Field components as props You can use `label`, `hint`, `error` as props to the `Field` component. This can be helpful when you don't need to apply any additional props or styles to the particular components. ```tsx ``` ### Horizontal If you prefer horizontal layout, you can use `orientation="horizontal"` prop. <>Username ```tsx Username ``` --- title: Fieldset description: A set of form controls optionally grouped under a common name. isServerComponent: false source: /packages/react/src/components/fieldset/fieldset.tsx themeSource: /packages/system/src/recipes/fieldset.ts --- ## Installation ```bash pnpm dreamy add fieldset ``` ## Usage Fieldset is a component that groups related form controls under a common name, making it easier to structure and manage forms. <>Contact details <>Please provide your contact details below. <>Name <>Email address <>Country <>United Kingdom <>Canada <>United States ```tsx Contact details Please provide your contact details below. Name Email address Country United Kingdom Canada United States ``` ### Disabled Use the `disabled` prop to disable the fieldset, which disables all input elements within it. <>Shipping details <>Street address <>Country <>United Kingdom <>Canada <>United States <>Delivery notes