Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@cagov/ds-accordion
Advanced tools
Accordions are expandable sections of content. Each section contains a heading (H2 or H3), a plus button (+), and more body text when opened.
Accordions are expandable sections of content. Each section contains a summary element, and more body text when opened.
Accordions keep pages looking clean by hiding information that most people do not need to see.
Use accordions to hide content most readers do not need.
Headings can be a:
Write headings that are brief and descriptive.
Only use accordions when:
Do not use accordions:
Accordions hide information unless someone opens them. This requires an extra action, which means readers have to do extra work to get this information. If most people need to see the content, put it in body content so people can scan for it.
<cagov-accordion>
<details>
<summary>Title 1</summary>
<div class="accordion-body">
<p>A couple links are included inside this accordion to demonstrate that when the accordion is closed they are automatically not in the keyboard focus order but when the accordion opens they become the next available elements in the keyboard navigation sequence after the accordion's summary element.</p>
<p><a href="#nowhere1">Link 1</a></p>
<p><a href="#nowhere2">Link 2</a></p>
</div>
</details>
</cagov-accordion>
<cagov-accordion>
<details>
<summary>Title 2 multiline lorem ipsum is useful because it has a more-or-less normal distribution of letters</summary>
<div class="accordion-body">
<ul>
<li>Anim pariatur cliche reprehenderit</li>
<li>moon officia aute, non cupidatat</li>
</ul>
</div>
</details>
</cagov-accordion>
<cagov-accordion>
<details>
<summary>Title 3 lorem ipsum dolor sit amet</summary>
<div class="accordion-body">
<p>moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.</p>
<p>Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda</p>
</div>
</details>
</cagov-accordion>
Property | Value |
---|---|
Machine name | ds-accordion |
JavaScript | yes |
Sass | ./src/index.scss |
The instructions assume familiarity with npm package management tool, modern JavaScript techniques, and Sass.
npm i @cagov/ds-accordion
import
¹ or require
to include the component’s JavaScript in your page or compiler.We recommend using a build system and bundling your JavaScript for faster performance. If you do not use a build system, you can include the code from our CDN with a script tag.
<script type="module" src="https://cdn.designsystem.webstandards.ca.gov/components/ds-accordion/v2.0.4/dist/index.js"></script>
The following CSS variables are used in this component:
--primary-700
--primary-900
All CSS variables define their own fallback value, so you do not have to use additional CSS unless you want to change them. You may define your own value for the variable by adding your own style rules. Here is an example defining the global hex value for a CSS variable named “--primary-700”:
:root {
--primary-700: #165ac2;
}
The clickable element in the accordion is a standard button.
As a component in Alpha status, this component must pass the following accessibility reviews every time a new version is published:
This component relies on the browser's built in details and summary elements which provide an expanding/collapsing behavior supported solely by the browser. This default behavior is augmented by javascript in a custom element which applies a height animation to the expansion/collapse. Additional styling is used based on the :defined selector which is only true once the custom element's javascript has been understood by the browser. This removes the default caret icon and provides a plus/minus open closed indicator instead.
If you want the accordion to be open instead of closed when the page loads, add the attribute open
to the details element. It is not necessary to provide a value to the attribute: <details open>
is sufficient.
If js does not execute the animation, height restrictions, overflow hiding, default arrow hiding and plus/minus icons will not be applied. The user should see plain default summary behavior with rotating triangle.
This component uses a custom element defined in JavaScript in addition to HTML and CSS. Edge, Firefox, Safari, and Chrome support custom elements. If the JavaScript for this component is not delivered or supported the component falls back to plain HTML. It uses CSS variables to inherit design token values. Token definitions are not required because these style rules provide fallback values.
This component uses the following data attributes. We provide this information to help with integrating the component into backend publishing systems or identifying content that may require translation.
Name | Attribute name | Data type | Field type | Selector |
---|---|---|---|---|
Title | title | string | Rich text | summary |
Body | body | string | Rich text | .accordion-body |
FAQs
Accordions are expandable sections of content. Each section contains a heading (H2 or H3), a plus button (+), and more body text when opened.
The npm package @cagov/ds-accordion receives a total of 16 weekly downloads. As such, @cagov/ds-accordion popularity was classified as not popular.
We found that @cagov/ds-accordion demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.