Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spectrum-web-components/accordion

Package Overview
Dependencies
Maintainers
0
Versions
270
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spectrum-web-components/accordion

The `<sp-accordion>` element contains a list of items that can be expanded or collapsed to reveal additional content or information associated with each item. There can be zero expanded items, exactly one expanded item, or more than one item expanded at a

  • 1.1.0-beta.37
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1K
decreased by-46.76%
Maintainers
0
Weekly downloads
 
Created
Source

Description

The <sp-accordion> element contains a list of items that can be expanded or collapsed to reveal additional content or information associated with each item. There can be zero expanded items, exactly one expanded item, or more than one item expanded at a time, depending on the configuration. This list of items is defined by child <sp-accordion-item> elements that are targetted to the default slot of their <sp-accordion> parent.

Usage

See it on NPM! How big is this package in your project? Try it on webcomponents.dev

yarn add @spectrum-web-components/accordion

Import the side effectful registration of <sp-accordion> and <sp-accordion-item> via:

import '@spectrum-web-components/accordion/sp-accordion.js';
import '@spectrum-web-components/accordion/sp-accordion-item.js';

When looking to leverage the Accordion and AccordionItem base class as a type and/or for extension purposes, do so via:

import { Accordion, AccordionItem } from '@spectrum-web-components/accordion';

Example

<sp-accordion>
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 5">
        <div>Item 5</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 6">
        <div>Item 6</div>
    </sp-accordion-item>
</sp-accordion>

Allow Multiple

<sp-accordion allow-multiple>
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 5">
        <div>Item 5</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 6">
        <div>Item 6</div>
    </sp-accordion-item>
</sp-accordion>

Sizes

Small
<sp-accordion size="s">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Medium
<sp-accordion size="m">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Large
<sp-accordion size="l">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Extra Large
<sp-accordion size="xl">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>

Density

The density property, when applied, accepts the values of compact or spacious.

Compact

Small
<sp-accordion density="compact" size="s">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Medium
<sp-accordion density="compact" size="m">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Large
<sp-accordion density="compact" size="l">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Extra Large
<sp-accordion density="compact" size="xl">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>

Spacious

Small
<sp-accordion density="spacious" size="s">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Medium
<sp-accordion density="spacious" size="m">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Large
<sp-accordion density="spacious" size="l">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>
Extra Large
<sp-accordion density="spacious" size="xl">
    <sp-accordion-item label="Heading 1">
        <div>Item 1</div>
    </sp-accordion-item>
    <sp-accordion-item disabled label="Heading 2">
        <div>Item 2</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 3">
        <div>Item 3</div>
    </sp-accordion-item>
    <sp-accordion-item label="Heading 4">
        <div>Item 4</div>
    </sp-accordion-item>
</sp-accordion>

Keywords

FAQs

Package last updated on 22 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc