Class Label


@Bean(typeName="label") public class Label extends HtmlElementMixed
DTO for an HTML <label> element.

The label element represents a caption for a form control. It provides a programmatic association between the label and the form control, improving accessibility and user experience. When a label is associated with a form control, clicking the label will focus or activate the control.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Label with explicit association Label label1 = label("Username:") ._for("username"); // Label wrapping form control Label label2 = label( input("checkbox").name("agree"), span("I agree to the terms and conditions") ); // Label with form association Label label3 = label("Email Address:") ._for("email") .form("contactForm"); // Label with styling Label label4 = label("Password:") ._for("password") ._class("required");

See Also: