Docs

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.

Open in a
new tab
<Details summary="Contact information" opened>
  <VerticalLayout>
    <span>Sophia Williams</span>
    <span>sophia.williams@company.com</span>
    <span>(501) 555-9128</span>
  </VerticalLayout>
</Details>

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.

Open in a
new tab
<Details opened>
  {/* @ts-expect-error Summary not yet available as a React component */}
  <vaadin-details-summary slot="summary">
    <HorizontalLayout style={{ justifyContent: 'space-between', width: '100%' }}>
      <span>Contact information</span>

      <HorizontalLayout
        style={{ color: 'var(--lumo-error-text-color)', marginLeft: 'var(--lumo-space-s)' }}
      >
        <Icon
          icon="vaadin:exclamation-circle"
          style={{
            width: 'var(--lumo-icon-size-s)',
            height: 'var(--lumo-icon-size-s)',
            marginRight: 'var(--lumo-space-xs)',
          }}
        />
        <span>2 errors</span>
      </HorizontalLayout>
    </HorizontalLayout>
    {/* @ts-expect-error Summary not yet available as a React component */}
  </vaadin-details-summary>

  <FormLayout responsiveSteps={responsiveSteps}>
    <TextField label="Address" value="4027 Amber Lake Canyon" {...{ colspan: 2 }} />

    <TextField label="ZIP code" required />

    <TextField label="City" required />

    <ComboBox label="Country" itemLabelPath="name" itemValuePath="id" items={items} />
  </FormLayout>
</Details>

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.

Open in a
new tab
<Details summary="Analytics" opened>
  <VerticalLayout>
    <a href="#" style={anchorStyle}>
      Dashboard
    </a>
    <a href="#" style={anchorStyle}>
      Reports
    </a>
    <a href="#" style={anchorStyle}>
      Data sources
    </a>
  </VerticalLayout>
</Details>

<Details summary="Customers" opened>
  <VerticalLayout>
    <a href="#" style={anchorStyle}>
      Accounts
    </a>
    <a href="#" style={anchorStyle}>
      Contacts
    </a>
  </VerticalLayout>
</Details>

<Details summary="Finances" opened>
  <VerticalLayout>
    <a href="#" style={anchorStyle}>
      Invoices
    </a>
    <a href="#" style={anchorStyle}>
      Transactions
    </a>
    <a href="#" style={anchorStyle}>
      Statements
    </a>
  </VerticalLayout>
</Details>

Theme Variants

Details has three theme variants: filled, small, and reverse. These variants can be combined with each other. For example, all three theme variants can be applied to the same Details component.

Filled

The filled theme variant makes the component’s boundaries visible, which helps tie its content together visually and distinguishes it from the surrounding UI.

Open in a
new tab
<Details summary="Members (8)" opened theme="filled">
  <ul>
    <li>Blake Martin</li>
    <li>Caroline Clark</li>
    <li>Avery Torres</li>
    <li>Khloe Scott</li>
    <li>Camila Fisher</li>
    <li>Gavin Lewis</li>
    <li>Isabella Powell</li>
    <li>Zoe Wilson</li>
  </ul>
</Details>

Small

Use the small theme variant for compact UIs.

Open in a
new tab
<Details summary="Members (8)" opened theme="small">
  <ul>
    <li>Blake Martin</li>
    <li>Caroline Clark</li>
    <li>Avery Torres</li>
    <li>Khloe Scott</li>
    <li>Camila Fisher</li>
    <li>Gavin Lewis</li>
    <li>Isabella Powell</li>
    <li>Zoe Wilson</li>
  </ul>
</Details>

Reverse

The reverse theme variant places the toggle icon after the summary contents, which can be useful for visually aligning the summary with other content.

Open in a
new tab
<Details summary="Members (8)" opened theme="reverse">
  <ul>
    <li>Blake Martin</li>
    <li>Caroline Clark</li>
    <li>Avery Torres</li>
    <li>Khloe Scott</li>
    <li>Camila Fisher</li>
    <li>Gavin Lewis</li>
    <li>Isabella Powell</li>
    <li>Zoe Wilson</li>
  </ul>
</Details>

Disabling

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

Open in a
new tab
<Details summary="Members (8)" {...{ disabled: true }}>
  <ul>
    <li>Blake Martin</li>
    <li>Caroline Clark</li>
    <li>Avery Torres</li>
    <li>Khloe Scott</li>
    <li>Camila Fisher</li>
    <li>Gavin Lewis</li>
    <li>Isabella Powell</li>
    <li>Zoe Wilson</li>
  </ul>
</Details>

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.