Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
bpk-component-accordion-css
Advanced tools
Backpack accordion component.
npm install bpk-component-accordion --save-dev
The withSingleItemAccordionState
higher-order component is used to limit one section to be expanded at any time.
import React from 'react';
import { BpkAccordion, BpkAccordionItem, withSingleItemAccordionState } from 'bpk-component-accordion';
const SingleItemAccordion = withSingleItemAccordionState(BpkAccordion);
export default () => (
<SingleItemAccordion>
<BpkAccordionItem id="stops" title="Stops">
My stops content.
</BpkAccordionItem>
<BpkAccordionItem id="departure-times" title="Departure times" initiallyExpanded>
My departure times content.
</BpkAccordionItem>
<BpkAccordionItem id="journey-duration" title="Journey duration">
My journey duration content.
</BpkAccordionItem>
</SingleItemAccordion>
)
The withAccordionItemState
higher-order component is used to allow multiple items to be expanded simultaneously.
import React from 'react';
import { BpkAccordion, BpkAccordionItem, withAccordionItemState } from 'bpk-component-accordion';
const StatefulAccordionItem = withAccordionItemState(BpkAccordionItem);
export default () => (
<BpkAccordion>
<StatefulAccordionItem id="stops" title="Stops">
My stops content.
</StatefulAccordionItem>
<StatefulAccordionItem id="departure-times" title="Departure times" initiallyExpanded>
My departure times content.
</StatefulAccordionItem>
<StatefulAccordionItem id="journey-duration" title="Journey duration" initiallyExpanded>
My journey duration content.
</StatefulAccordionItem>
</BpkAccordion>
)
BpkAccordionItem
supports the use of displaying icons alongside the title. To do this you will need to align your icon to the text using withAlignment
and pass through the matching sizes for the icon you wish to use. For more information see Alignment
import React from 'react';
import { BpkAccordion, BpkAccordionItem } from 'bpk-component-accordion';
import { withAlignment } from 'bpk-component-icon';
import StopsIcon from 'bpk-component-icon/sm/stops';
import { lineHeightBase, iconSizeSm, colorPanjin } from 'bpk-tokens/tokens/base.es6';
const AlignedStopsIcon = withAlignment(StopsIcon, lineHeightBase, iconSizeSm);
<BpkAccordion>
<BpkAccordionItem id="stops" title="Stops" icon={<AlignedStopsIcon fill={colorPanjin}/>}>
My stops content.
</BpkAccordionItem>
</BpkAccordion>
Property | PropType | Required | Default Value |
---|---|---|---|
children | node | true | - |
className | string | false | null |
Property | PropType | Required | Default Value |
---|---|---|---|
children | node | true | - |
id | string | true | - |
title | string | true | - |
weight | See prop details | false | WEIGHT_STYLES.regular |
expanded | bool | false | false |
icon | node | false | null |
onClick | func | false | () => null |
tagName | string | false | span |
textStyle | string | false | "base" |
Property | PropType | Required | Default Value |
---|---|---|---|
bool | false | false |
Property | PropType | Required | Default Value |
---|---|---|---|
bool | false | false |
This prop takes WEIGHT_STYLES
that has been re-exported from BpkText
. For valid options please refer to the BpkText docs.
accordionColor
,accordionHoverColor
,accordionActiveColor
,FAQs
Backpack accordion component.
The npm package bpk-component-accordion-css receives a total of 8 weekly downloads. As such, bpk-component-accordion-css popularity was classified as not popular.
We found that bpk-component-accordion-css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.