Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@zendeskgarden/container-accordion
Advanced tools
Containers relating to accordions in the Garden Design System
This package includes containers relating to accordions in the Garden Design System.
npm install @zendeskgarden/container-accordion
This container implements the accordion design pattern and can be used to build an accordion component. Check out storybook for live examples.
The useAccordion
hook manages toggle state and required accessibility
attributes for a group of sections.
import { useAccordion } from '@zendeskgarden/container-accordion';
const Accordion = ({ sections = [0, 1, 2], expandable = true, collapsible = true } = {}) => {
const { getHeaderProps, getTriggerProps, getPanelProps, expandedSections, disabledSections } =
useAccordion({
sections,
expandedSections: [0],
expandable,
collapsible
});
return (
<>
{sections.map((section, index) => {
const disabled = disabledSections.indexOf(index) !== -1;
const hidden = expandedSections.indexOf(index) === -1;
return (
<div key={index}>
<h2 {...getHeaderProps({ role: null, ariaLevel: null })}>
<button
{...getTriggerProps({
index,
role: null,
tabIndex: null,
disabled,
style: { width: '100%' }
})}
>
{index}
</button>
</h2>
<section
{...getPanelProps({
index,
role: null,
hidden
})}
>
{section}
</section>
</div>
);
})}
</>
);
};
return <Accordion expandable={true} collapsible={true} />;
AccordionContainer
is a render-prop wrapper for the useAccordion
hook.
import { AccordionContainer } from '@zendeskgarden/container-accordion';
const Accordion = ({ sections = [0, 1, 2], expandable = true, collapsible = true } = {}) => (
<AccordionContainer sections={sections} expandable={expandable} collapsible={collapsible}>
{({ getHeaderProps, getTriggerProps, getPanelProps, expandedSections, disabledSections }) => (
<>
{sections.map((section, index) => {
const disabled = disabledSections.indexOf(index) !== -1;
const hidden = expandedSections.indexOf(index) === -1;
return (
<div key={index}>
<h2 {...getHeaderProps({ role: null, ariaLevel: null })}>
<button
{...getTriggerProps({
index,
role: null,
tabIndex: null,
disabled,
style: { width: '100%' }
})}
>
{index}
</button>
</h2>
<section
{...getPanelProps({
index,
role: null,
hidden
})}
>
{section}
</section>
</div>
);
})}
</>
)}
</AccordionContainer>
);
return <Accordion expandable={true} collapsible={true} />;
FAQs
Containers relating to accordions in the Garden Design System
We found that @zendeskgarden/container-accordion demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.