# Label Component API A form label component for associating text with form controls. --- ## Installation ```toml # Cargo.toml [dependencies] shadcn-ui-leptos-label = "0.7" ``` ```rust use shadcn_ui_leptos_label::Label; ``` --- ## Component API ### Label | Prop | Type | Default | Description | |------|------|---------|-------------| | `for` | `MaybeProp` | `None` | ID of associated element | | `class` | `MaybeProp` | `None` | Additional CSS classes | | `id` | `MaybeProp` | `None` | Unique identifier | | `children` | `Option` | `None` | Label text | --- ## Usage Examples ### Basic Label ```rust use leptos::prelude::*; use shadcn_ui_leptos_label::Label; use shadcn_ui_leptos_input::Input; #[component] pub fn MyComponent() -> impl IntoView { view! {
} } ``` --- ## CSS Classes ```css .shadcn-label { text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 } ``` --- ## Accessibility Labels must be associated with form controls using the `for` attribute matching the input's `id`. --- ## TypeScript API ```typescript interface LabelProps { htmlFor?: string; className?: string; id?: string; children?: React.ReactNode; } export const Label: React.FC; ``` --- *Source: [packages/leptos/label/src/default.rs](https://github.com/yourusername/leptos-shadcn-ui/blob/main/packages/leptos/label/src/default.rs)*