# DaisyUI Integration Guide This document explains how DaisyUI has been integrated into this Rust web application template using UnoCSS. ## Overview DaisyUI is a semantic component library built on top of Tailwind CSS that provides pre-built components like buttons, cards, modals, and more. This project integrates DaisyUI using the `unocss-preset-daisy` preset, which allows you to use DaisyUI components with UnoCSS instead of Tailwind CSS. ## Installation DaisyUI has been integrated using the following steps: 1. **Installed the preset**: `unocss-preset-daisy` package 2. **Updated UnoCSS configuration**: Added the DaisyUI preset to `uno.config.ts` 3. **Created example components**: Added comprehensive examples in `client/src/components/daisy_example.rs` 4. **Added route**: Created `/daisyui` route to showcase the components ## Configuration The DaisyUI preset is configured in `uno.config.ts`: ```typescript import { presetDaisy } from "unocss-preset-daisy"; export default defineConfig({ // ... other config presets: [ presetUno(), presetAttributify(), presetIcons({ scale: 1.2, autoInstall: true, collections: { carbon: () => import("@iconify-json/carbon/icons.json").then((i) => i.default), }, }), presetTypography(), presetWebFonts({ fonts: { // ... }, }), presetDaisy(), // DaisyUI preset ], // ... other config }); ``` ## Available Components The integration includes all standard DaisyUI components: ### Buttons - `btn` - Basic button - `btn-primary`, `btn-secondary`, `btn-accent` - Colored buttons - `btn-outline` - Outline buttons - `btn-ghost`, `btn-link` - Ghost and link buttons - `btn-lg`, `btn-md`, `btn-sm`, `btn-xs` - Button sizes ### Cards - `card` - Basic card container - `card-body` - Card content area - `card-title` - Card title - `card-actions` - Card action buttons area ### Forms - `form-control` - Form control wrapper - `label` - Form labels - `input` - Text inputs with `input-bordered` variant - `select` - Select dropdowns with `select-bordered` variant - `checkbox` - Checkboxes - `radio` - Radio buttons ### Feedback - `alert` - Alert messages with variants: `alert-info`, `alert-success`, `alert-warning`, `alert-error` - `badge` - Small status indicators with color variants - `progress` - Progress bars with color variants - `loading` - Loading spinners and dots ### Navigation - `tabs` - Tab navigation with `tab-lifted` variant - `modal` - Modal dialogs with `modal-box` content ### Layout - `hero` - Hero sections with `hero-content` - `container` - Container for content ## Color System DaisyUI uses a semantic color system: - **Primary Colors**: `primary`, `primary-content` - **Secondary Colors**: `secondary`, `secondary-content` - **Accent Colors**: `accent`, `accent-content` - **Neutral Colors**: `neutral`, `neutral-content` - **Base Colors**: `base-100`, `base-200`, `base-300`, `base-content` - **State Colors**: `info`, `success`, `warning`, `error` ## Usage in Leptos Components Here's an example of using DaisyUI components in a Leptos component: ```rust use leptos::prelude::*; #[component] pub fn ExampleComponent() -> impl IntoView { let (count, set_count) = signal(0); view! {