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

@pnx-mixtape/accordion

Package Overview
Dependencies
Maintainers
0
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnx-mixtape/accordion

accordion component

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49
increased by122.73%
Maintainers
0
Weekly downloads
 
Created
Source

@pnx-mixtape/accordion

Documentation and examples: Accordion

Installation

npm install @pnx-mixtape/accordion --save-dev

How to use

CSS

  • PostCSS workflow: @import '@pnx-mixtape/accordion';
  • Native CSS: @import url('dist/accordion.css');
  • Link tag: <link href="dist/accordion.css" rel="stylesheet" type="text/css">

Web Components

Web Components are self defined, simply import the desired feature. These do not use the Shadow DOM. External CSS applies.

  • DetailsBase import: import '@pnx-mixtape/accordion/DetailsBase'; and be sure to include <mx-details> around the <details /> tag.
  • DetailsMobile import: import '@pnx-mixtape/accordion/DetailsBase'; and be sure to include <mx-detailsmobile> around the <details /> tag.
  • DetailsDiv import: import '@pnx-mixtape/accordion/DetailsBase'; and be sure to include <mx-detailsdiv class="accordion"> instead of the <details /> tag.
<mx-details>
  <details class="accordion">
    <summary class="accordion__toggle">Title</summary>
    <div class="accordion__content">
      <p>Body content</p>
    </div>
  </details>
</mx-details>

See twig files for all HTML examples.

Vanilla JS (to be deprecated)

Javascript is used to handle opening and closing the accordion when the user prints the screen. This sets the open attribute onbeforeprint and closes it onafterprint window events. The content's ID is also set via js.

  • ES6 import: import { Accordion, AccordionDiv } from '@pnx-mixtape/accordion';
  • ES6 submodule import: import AccordionDiv from '@pnx-mixtape/accordion/accordion-div';
  • Script tag: <script src="dist/accordion.js" type="text/javascript"></script>
<details class="accordion" data-accordion>
  <summary class="accordion__toggle">Title</summary>
  <div class="accordion__content">
    <p>Body content</p>
  </div>
</details>

FAQs

Package last updated on 30 Jun 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