Class Legend


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

The legend element represents a caption for the content of its parent fieldset element. It is used to provide a title or description for a group of form controls that are contained within a fieldset. The legend element should be placed as the first child of a fieldset element and is typically rendered above or to the side of the fieldset content, often with special styling to distinguish it from the form controls.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple legend Legend simple = legend("Personal Information"); // Legend with styling Legend styled = legend("Contact Details") ._class("form-legend"); // Legend with complex content Legend complex = legend( "Step 1: ", strong("Basic Information"), " ", em("(Required)") ); // Legend with ID Legend withId = legend("Form Legend") .id("form-legend"); // Legend with styling Legend styled2 = legend("Styled Legend") .style("color: #333; font-weight: bold; padding: 0 10px;"); // Legend with multiple elements Legend multiple = legend( "Section 1: ", span("User Details")._class("section-title"), " ", small("(All fields required)") ); // Legend with links Legend withLinks = legend( "Help: ", a("/help/forms", "Form Guide") );

The following convenience methods are provided for constructing instances of this bean:

See Also: