Details Group
<sl-details-group> | SlDetailsGroup
A wrapper around the details component to simulate a group or “accordion” where only one is shown at a time
<sl-details-group> <sl-details summary="First" open> <sl-icon slot="prefix" name="plus"></sl-icon> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <sl-icon slot="summary-icon" name="megaphone"></sl-icon> </sl-details> <sl-details summary="Second"> <sl-icon slot="prefix" name="envelope"></sl-icon> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <sl-badge slot="suffix" variant="primary" pill>12</sl-badge> <sl-icon slot="summary-icon" name="photo"></sl-icon> </sl-details> <sl-details class="change_icon" summary="Third"> <sl-icon slot="prefix" name="puzzle"></sl-icon> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <sl-icon slot="suffix" name="sun"></sl-icon> <sl-icon slot="expand-icon" name="plus"></sl-icon> <sl-icon slot="collapse-icon" name="minus"></sl-icon> </sl-details> </sl-details-group> <style> sl-details.change_icon::part(summary-icon) { /* Disable the expand/collapse animation */ rotate: none; } </style>
Importing
If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.
To import this component from the CDN using a script tag:
<script type="module" src="https://cdn.jsdelivr.net/npm/@viur/shoelace@1.0.8-v2.18.0/cdn/components/details-group/details-group.js"></script>
To import this component from the CDN using a JavaScript import:
import 'https://cdn.jsdelivr.net/npm/@viur/shoelace@1.0.8-v2.18.0/cdn/components/details-group/details-group.js';
To import this component using a bundler:
import '@viur/shoelace/dist/components/details-group/details-group.js';
To import this component as a React component:
import SlDetailsGroup from '@viur/shoelace/dist/react/details-group';
Slots
Name | Description |
---|---|
(default) | The default slot. |
Learn more about using slots.
Custom Properties
Name | Description | Default |
---|---|---|
--details-gap |
The gap between the detail boxes. |
Learn more about customizing CSS custom properties.