Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Label

Renders an accessible label associated with controls.

Features

  • Text selection is prevented when double clicking label.
  • Supports nested controls.

Installation

Install the component from your command line.

cargo add radix-leptos-label

Anatomy

Import the component.

use leptos::*;
use radix_leptos_label::*;

#[component]
fn Anatomy() -> impl IntoView {
    view! {
        <Label />
    }
}

API Reference

Root

Contains the content for the label.

PropTypeDefault
as_childMaybeProp<bool>false
on_mouse_downMaybeCallback<MouseEvent>-

Accessibility

This component is based on the native label element, it will automatically apply the correct labelling when wrapping controls or using the for attribute. For your own custom controls to work correctly, ensure they use native elements such as button or input as a base.

See Also