Web Awesome (ViUR)

Font Awesome
Try SSR Server-side rendering (SSR) generates component HTML on the server before the page loads, improving SEO and initial load time. Use the switch to see Web Awesome components render with and without SSR.
Search this website ⌘KCtrl+K Light Dark System Docs Select Color Scheme Default Awesome Shoelace Active Brutalist Glossy Matter Mellow Playful Premium Tailspin Docs Select Theme View Project on GitHub Star Project on GitHub
Start Components Docs Help
Web Awesome Font Awesome Build Awesome
Search this site… /
Try SSR Server-side rendering (SSR) generates component HTML on the server before the page loads, improving SEO and initial load time. Use the switch to see Web Awesome components render with and without SSR.
Light Dark System Docs Select Color Scheme Default Awesome Shoelace Active Brutalist Glossy Matter Mellow Playful Premium Tailspin Docs Select Theme

Getting Started

  • Installation
  • Usage
  • Forms
  • Localization
  • Frameworks
  • Using with AI
  • Figma Design Kit ProThis requires access to Web Awesome Pro
  • Server Rendering

Resources

  • Accessibility
  • Browser Support
  • Contributing
  • Patterns ProPatterns require access to Web Awesome Pro
  • Migrating from Shoelace
  • Visual Tests
  • Changelog
  • Help & Support

Theming & Utilities

  • Overview
  • Built-in Themes
  • Color Palettes
  • Design Tokens
  • Customizing & Theming
  • CSS Utilities

ViUR Components

  • Alert
  • Combobox
  • Pagination
  • Table Wrapper

Actions

  • Button
  • Button Group
  • Copy Button
  • Dropdown
    • Dropdown Item

Forms

  • Checkbox
  • Checkbox Group
  • Color Picker
  • Input
  • Known Date
  • Number Input
  • Radio Group
    • Radio
  • Rating
  • Select
    • Option
  • Slider
  • Switch
  • Textarea
  • Time Input
  • Data Grid Planned A Web Awesome Kickstarter stretch goal!

Layout

  • Accordion
    • Accordion Item
  • Card
  • Details
  • Dialog
  • Divider
  • Drawer
  • Page
  • Scroller
  • Split Panel

Navigation

  • Breadcrumb
    • Breadcrumb Item
  • Tab Group
    • Tab
    • Tab Panel
  • Tree
    • Tree Item

Feedback

  • Badge
  • Callout
  • Progress Bar
  • Progress Ring
  • Skeleton
  • Spinner
  • Tag
  • Tooltip

Media

  • Animated Image
  • Avatar
  • Carousel
    • Carousel Item
  • Comparison
  • Icon
  • Markdown
  • QR Code
  • Zoomable Frame

Data Viz

  • Advanced Usage

Helpers

  • Animation
  • Format Bytes
  • Format Date
  • Format Number
  • Include
  • Intersection Observer
  • Mutation Observer
  • Popover
  • Popup
  • Random Content
  • Relative Time
  • Resize Observer

Details

  • Examples
  • Expanded Initially
  • Disabled
  • Customizing the Summary Icon
  • Icon Position
  • HTML in Summary
  • Right-to-Left Languages
  • Appearance
  • Grouping Details
  • Importing
  • Slots
  • Attributes & Properties
  • Methods
  • Events
  • CSS Custom Properties
  • Custom States
  • CSS Parts
  • Dependencies
On This Page...
  • Examples
  • Expanded Initially
  • Disabled
  • Customizing the Summary Icon
  • Icon Position
  • HTML in Summary
  • Right-to-Left Languages
  • Appearance
  • Grouping Details
  • Importing
  • Slots
  • Attributes & Properties
  • Methods
  • Events
  • CSS Custom Properties
  • Custom States
  • CSS Parts
  • Dependencies

Details

<wa-details>
Stable Layout Since 2.0

Details display a brief summary and expand to reveal additional content. Use them to progressively disclose information, group related FAQs, or hide advanced options.

Click the summary to expand and collapse the details component. You can put any content in here that you want to reveal on demand!
<wa-details summary="Toggle Me">
  Click the summary to expand and collapse the details component. You can put any content in here that you want to
  reveal on demand!
</wa-details>

Examples

Link to This Section

Expanded Initially

Link to This Section

Use the open attribute to expand the details initially.

This details component is expanded by default. Users can click the summary to collapse it if they want to hide the content.
<wa-details summary="Toggle Me" open>
  This details component is expanded by default. Users can click the summary to collapse it if they want to hide the
  content.
</wa-details>

Disabled

Link to This Section

Use the disabled attribute to prevent the details from expanding.

This content can't be seen because the details component is disabled. Try removing the disabled attribute to reveal what's inside!
<wa-details summary="Disabled" disabled>
  This content can't be seen because the details component is disabled. Try removing the disabled attribute to reveal
  what's inside!
</wa-details>

Customizing the Summary Icon

Link to This Section

Use the expand-icon and collapse-icon slots to change the expand and collapse icons, respectively. To disable the animation, override the rotate property on the icon part as shown below.

This example uses custom plus and minus icons for expanding and collapsing. You can use any icon you want to match the look and feel of your app.
<wa-details summary="Toggle Me" class="custom-icons">
  <wa-icon name="square-plus" slot="expand-icon" variant="regular"></wa-icon>
  <wa-icon name="square-minus" slot="collapse-icon" variant="regular"></wa-icon>

  This example uses custom plus and minus icons for expanding and collapsing. You can use any icon you want to match the
  look and feel of your app.
</wa-details>

<style>
  /* Disable the expand/collapse animation */
  wa-details.custom-icons::part(icon) {
    rotate: none;
  }
</style>

Icon Position

Link to This Section

The default position for the expand and collapse icons is at the end of the summary. Set the icon-placement attribute to start to place the icon at the start of the summary.

The expand/collapse icon is at the start of the summary. This is a common pattern that feels familiar to users who are used to tree views and file explorers. The expand/collapse icon is at the end of the summary. This is the default placement and works great for most use cases.
<div class="wa-stack">
  <wa-details summary="Start" icon-placement="start">
    The expand/collapse icon is at the start of the summary. This is a common pattern that feels familiar to users who
    are used to tree views and file explorers.
  </wa-details>
  <wa-details summary="End" icon-placement="end">
    The expand/collapse icon is at the end of the summary. This is the default placement and works great for most use
    cases.
  </wa-details>
</div>

HTML in Summary

Link to This Section

To use HTML in the summary, use the summary slot. Links and other interactive elements will still retain their behavior:

Some text a link more text You can use the summary slot to put HTML in the summary, including links and other interactive elements. Pretty neat, right?
<wa-details>
  <span slot="summary">
    Some text
    <a href="https://webawesome.com" target="_blank">a link</a>
    more text
  </span>

  You can use the summary slot to put HTML in the summary, including links and other interactive elements. Pretty neat,
  right?
</wa-details>

Right-to-Left Languages

Link to This Section

The details component, including its icon-placement, automatically adapts to right-to-left languages:

استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن
<div class="wa-stack">
  <wa-details summary="تبديلني" lang="ar" dir="rtl">
    استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن
  </wa-details>
  <wa-details summary="تبديلني" lang="ar" dir="rtl" icon-placement="start">
    استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن
  </wa-details>
</div>

Appearance

Link to This Section

Use the appearance attribute to change the element’s visual appearance.

This is the default outlined appearance. It has a subtle border that helps it stand out without being too flashy. The filled-outlined appearance combines a filled header with an outlined body. It gives the summary a bit more visual weight while keeping the content area clean. The filled appearance adds a background color to the entire component. Use this when you want the details to really pop on the page. No bells and whistles on this one. The plain appearance strips away borders and backgrounds for a minimalist look.
<div class="wa-stack">
  <wa-details summary="Outlined (default)">
    This is the default outlined appearance. It has a subtle border that helps it stand out without being too flashy.
  </wa-details>
  <wa-details summary="Filled-outlined" appearance="filled-outlined">
    The filled-outlined appearance combines a filled header with an outlined body. It gives the summary a bit more
    visual weight while keeping the content area clean.
  </wa-details>
  <wa-details summary="Filled" appearance="filled">
    The filled appearance adds a background color to the entire component. Use this when you want the details to really
    pop on the page.
  </wa-details>
  <wa-details summary="Plain" appearance="plain">
    No bells and whistles on this one. The plain appearance strips away borders and backgrounds for a minimalist look.
  </wa-details>
</div>

Grouping Details

Link to This Section

Use the name attribute to create accordion-like behavior where only one details element with the same name can be open at a time. This matches the behavior of native <details> elements.

This is the first section of the accordion. When you open another section, this one will close automatically. Give it a try! This is the second section. Notice how the first section closed when you opened this one? That's the accordion behavior in action, powered by the shared name attribute. And here's the third section. You can have as many sections as you need — just make sure they all share the same name and only one will be open at a time.
<div class="wa-stack">
  <wa-details name="group-1" summary="Section 1" open>
    This is the first section of the accordion. When you open another section, this one will close automatically. Give
    it a try!
  </wa-details>

  <wa-details name="group-1" summary="Section 2">
    This is the second section. Notice how the first section closed when you opened this one? That's the accordion
    behavior in action, powered by the shared name attribute.
  </wa-details>

  <wa-details name="group-1" summary="Section 3">
    And here's the third section. You can have as many sections as you need — just make sure they all share the same
    name and only one will be open at a time.
  </wa-details>
</div>

Importing

Link to This Section

If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick a component manually, use one of the following snippets.

CDN npm Self-Hosted React

Import this component directly from the CDN:

import 'https://ka-f.webawesome.com/webawesome@0.17.0/components/details/details.js';

After installing Web Awesome via npm, import this component:

import '@awesome.me/webawesome/dist/components/details/details.js';

If you're self-hosting Web Awesome, import this component from your server:

import './webawesome/dist/components/details/details.js';

To import this component for React 18 or below, use the following code:

import WaDetails from '@awesome.me/webawesome/dist/react/details/index.js';

Slots

Link to This Section

Learn more about using slots.

Name Description
(default) The details' main content.
collapse-icon Optional collapse icon to use instead of the default. Works best with <wa-icon>.
expand-icon Optional expand icon to use instead of the default. Works best with <wa-icon>.
summary The details' summary. Alternatively, you can use the summary attribute.

Attributes & Properties

Link to This Section

Learn more about attributes and properties.

Name Description Reflects
appearance
appearance
The element's visual appearance.
Type 'filled' | 'outlined' | 'filled-outlined' | 'plain'
Default 'outlined'
disabled
disabled
Disables the details so it can't be toggled.
Type boolean
Default false
iconPlacement
icon-placement
The location of the expand/collapse icon.
Type 'start' | 'end'
Default 'end'
name
name
Groups related details elements. When one opens, others with the same name will close.
Type string
open
open
Indicates whether or not the details is open. You can toggle this attribute to show and hide the details, or you can use the show() and hide() methods and this attribute will reflect the details' open state.
Type boolean
Default false
summary
summary
The summary to show in the header. If you need to display HTML, use the summary slot instead.
Type string

Methods

Link to This Section

Learn more about methods.

Name Description Arguments
hide() Hides the details
show() Shows the details.

Events

Link to This Section

Learn more about events.

Name Description
wa-after-hide Emitted after the details closes and all animations are complete.
wa-after-show Emitted after the details opens and all animations are complete.
wa-hide Emitted when the details closes.
wa-show Emitted when the details opens.

CSS Custom Properties

Link to This Section

Learn more about CSS custom properties.

Name Description
--hide-duration
The hide duration to use when applying built-in animation classes.
Default var(--wa-transition-normal)
--show-duration
The show duration to use when applying built-in animation classes.
Default var(--wa-transition-normal)
--spacing
The amount of space around and between the details' content. Expects a single value.

Custom States

Link to This Section

Learn more about custom states.

Name Description CSS selector
animating Applied when the details is animating expand/collapse. :state(animating)

CSS Parts

Link to This Section

Learn more about CSS parts.

Name Description CSS selector
base The inner <details> element used to render the component. Styles you apply to the component are automatically applied to this part, so you usually don't need to deal with it unless you need to set the display property. ::part(base)
content The details content. ::part(content)
header The header that wraps both the summary and the expand/collapse icon. ::part(header)
icon The container that wraps the expand/collapse icons. ::part(icon)
summary The container that wraps the summary. ::part(summary)

Dependencies

Link to This Section

This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.

  • <wa-icon>
Need a hand? Report a bug Ask for help
Go Make Something Awesome
Version 0.17.0 © Fonticons, Inc.
  • Terms
  • Privacy
  • Refunds
  • Core License
  • Pro License

Quick Links

  • Components
  • CSS Utilities
  • Theming
  • Using with AI
  • Changelog
  • Help & Support

Recent Searches

    D'oh! No results for “”

    Suggest on GitHub Ask on Discord
    Navigate Select
    Close Esc