Skip to main

Design System

  • Welcome
  • Colors
  • Typography
  • Spacing

CSS

  • Utilities
  • Compositions

Component Library

  • Aside
  • Audio Player
  • Authors
  • Banners
  • Block quotes
  • Brand
  • Breadcrumbs
  • Browser compatibility table
  • Button
  • Callout
  • Cards
  • Carousel
  • Code blocks
  • Compare
  • Counter
  • Details
  • Ellipsis
  • Eyebrow
  • Floating Action Button
  • Feature Card
  • Figure
  • Fixed width Image
  • Form Fields
  • Headline
  • Hero
  • Hero Image
  • Icon Button
  • Indicator
  • Labels
  • Lists
  • Numbered headers
  • Page Header
  • Pagination
  • Pill
  • Preview Pagination
  • Prose
  • Spinner
  • Stack Nav
  • Stats
  • Status List
  • Tables
  • Tabs
  • Generated table of contents
  • Toggle Switch
  • Tooltips

Details - Component

With extra summary content Open by default
View full screen
Code

Source (Nunjucks)

<details {{ data.state | safe }}>
<summary>
{{ data.summary }}
</summary>
{{ data.content | safe }}
</details>

Output

<details>
<summary>My details</summary>
<p>Some content that is hidden by default.</p>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</details>

Information

The Details pattern is designed to work with plain <details> and <summary> elements without a class attribute to keep things as simple as possible when you're using them.

The default marker has been hidden and a custom marker will render in the correct reading direction, instead.

Variants

With extra summary content

View full screen
Code

Source (Nunjucks)

<details>
<summary>
{{ data.summary }}
<p class="text-base color-core-text gap-top-base">{{ data.summaryPreview }}</p>
</summary>
{{ data.content | safe }}
</details>

Output

<details>
<summary>
My details
<p class="text-base color-core-text gap-top-base">Some teaser content</p>
</summary>
<p>Some content that is hidden by default.</p>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</details>

Open by default

View full screen
Code

Source (Nunjucks)

<details {{ data.state | safe }}>
<summary>
{{ data.summary }}
</summary>
{{ data.content | safe }}
</details>

Output

<details open>
<summary>My details</summary>
<p>Some content that is hidden by default.</p>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</details>

We want to help you build beautiful, accessible, fast, and secure websites that work cross-browser, and for all of your users. This site is our home for content to help you on that journey, written by members of the Chrome team, and external experts.

Contribute

  • File a bug
  • View source

Related content

  • developer.chrome.com
  • Chrome updates
  • Case studies
  • Podcasts
  • Shows

Connect

  • Twitter
  • YouTube
  • Google Developers
  • Chrome
  • Firebase
  • Google Cloud Platform
  • All products
  • Terms & Privacy
  • Community Guidelines

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies.