Docs

Documentation versions (currently viewingVaadin 25.4 (pre-release))

Details

Details is an expandable panel for showing and hiding content from the user, to make the UI less cluttered.

Details is an expandable panel for showing and hiding content from the user, to make the UI less cluttered.

Source code
DetailsBasic.java
details-basic.tsx
details-basic.ts

Anatomy

Details consist of a summary area and a content area.

Summary

The Summary is the part that’s always visible, and typically describes the content, for example with a title. Clicking on the summary toggles the content area’s visibility.

The summary supports rich content and can contain any component. This can be used, for example, to display the status of the corresponding content.

Source code
DetailsSummary.java
details-summary.tsx
details-summary.ts
Country.ts
Country.ts

Content

This is the collapsible part of Details. It can contain any component. When the content area is collapsed, the content is invisible and inaccessible by keyboard or screen reader.

Source code
DetailsContent.java
details-content.tsx
details-content.ts

Lazy Content Flow

Content added to a collapsed Details is created and sent to the browser even if the user never expands it. When the content is expensive to build — for example, when it loads data from a backend — create it the first time the Details is opened, using an opened change listener:

Source code
Java
Details details = new Details("Order History");
details.addOpenedChangeListener(event -> {
    if (event.isOpened() && details.getContent().findAny().isEmpty()) {
        details.add(createOrderHistory());
    }
});

The content check ensures that the content is created only once. After that, it stays in place when the Details is collapsed and expanded again.

Disabling

Details can be disabled to prevent them from being expanded or collapsed. Components inside a disabled expanded Details are automatically disabled as well.

Source code
DetailsDisabled.java
details-disabled.tsx
details-disabled.ts

Best Practices

Use Details to group related content and to reduce the chance of overwhelming the user with information. However, avoid putting important information in a Details component unless it’s expanded by default. Otherwise, the user might not notice it.

Details can be used instead of Accordion if there’s a need to see content from multiple collapsible content areas, simultaneously.

The expandable and collapsible nature of Details can sometimes be difficult for users to discover. Use the filled variant and apply a tooltips to make this more discoverable.

Component Usage Recommendation

Accordion

Vertically stacked set of expandable panels, in which only one panel can be expanded at a time.

Tabs

Component for organizing and grouping content into navigable sections.

25CA6A07-DDDB-47F3-9E6D-EEAB00498336