div

div is a container that groups related components together.

XML Element

div

Java Class

Div

Basics

The example uses div as a block container for headings, paragraphs, lists, and a link:

<div>
    <h1 text="HTML Tags Sample"/>
    <p text="This is a sample text that showcases the usage of different HTML tags."/>
    <unorderedList>
        <listItem>
            <span classNames="text-semibold" text="Bold text: "/>
            <span text="Use the &lt;b&gt; tag to make text "/>
            <span classNames="text-semibold" text="bold."/>
        </listItem>
    </unorderedList>
    <p text="Hyperlinks can be added using the &lt;a&gt; tag:"/>
    <anchor href="https://www.jmix.io" text="Visit jmix.io" target="BLANK"/>
</div>
Use the html component to include raw HTML.

Theme Variants

Use the themeNames attribute to style the component as a badge. Combine badge with color, emphasis, shape, or size variants.

Variant Description Supported By

badge

Applies badge styling.

Aura, Lumo

success, warning, error, contrast

Applies a semantic color.

Aura, Lumo

primary

Adds stronger visual emphasis.

Aura, Lumo

pill

Rounds the badge corners.

Aura, Lumo

small

Makes the badge smaller.

Aura, Lumo

normal

Uses the regular badge size.

Aura, Lumo

Attributes

Common attributes serve the same purpose for all components. The following attributes are specific to div:

Name Description Default

themeNames

Applies one or more variants listed in Theme Variants.

Handlers

Common handlers are configured in the same way for all components. The following handlers are specific to div:

Name Description

ClickEvent

Fires when the component is clicked. Use the click, singleClick, or doubleClick subject to select the click pattern.

Elements

A div can display text or contain nested components and layouts. If child elements are present, the text attribute is ignored.