Class Figure


@Bean(typeName="figure") public class Figure extends HtmlElementContainer
DTO for an HTML <figure> element.

The figure element represents self-contained content, potentially with a caption, that is typically referenced as a single unit from the main flow of the document. It is used to group related content such as images, diagrams, code snippets, or other media that can be moved away from the main flow of the document without affecting the document's meaning. The figure element can contain a figcaption element to provide a caption for the content.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple figure with image Figure simple = figure( img("/images/sunset.jpg", "Sunset"), figcaption("A beautiful sunset over the mountains.") ); // Figure with code snippet Figure codeFigure = figure( pre(code("function hello() {\n return 'Hello World';\n}")), figcaption("A simple JavaScript function.") ); // Figure with styling Figure styled = figure( img("/charts/sales.png", "Sales Chart"), figcaption("Monthly sales data for 2024.") )._class("chart-figure"); // Figure with multiple elements Figure complex = figure( img("/images/diagram.png", "Process Diagram"), p("This diagram shows the complete workflow."), figcaption("Figure 1: System Architecture Overview.") ); // Figure with ID Figure withId = figure( img("/charts/main.png", "Main Chart"), figcaption("Primary performance metrics.") ).id("main-chart"); // Figure with styling Figure styled2 = figure( img("/images/example.png", "Example"), figcaption("An example of the new feature.") ).style("border: 1px solid #ccc; padding: 10px; margin: 20px 0;"); // Figure with table Figure tableFigure = figure( table( tr( th("Name"), th("Value") ), tr( td("Item 1"), td("100") ) ), figcaption("Data summary table.") );

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

See Also: