You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The withSingleItemAccordionState higher-order component is used to limit one section to be expanded at any time.
importReactfrom'react';import{BpkAccordion,BpkAccordionItem,withSingleItemAccordionState}from'bpk-component-accordion';constSingleItemAccordion=withSingleItemAccordionState(BpkAccordion);exportdefault()=>(<SingleItemAccordion><BpkAccordionItemid="stops"title="Stops">
My stops content.
</BpkAccordionItem><BpkAccordionItemid="departure-times"title="Departure times"initiallyExpanded>
My departure times content.
</BpkAccordionItem><BpkAccordionItemid="journey-duration"title="Journey duration">
My journey duration content.
</BpkAccordionItem></SingleItemAccordion>)
withAccordionItemState(BpkAccordionItem)
The withAccordionItemState higher-order component is used to allow multiple items to be expanded simultaneously.
importReactfrom'react';import{BpkAccordion,BpkAccordionItem,withAccordionItemState}from'bpk-component-accordion';constStatefulAccordionItem=withAccordionItemState(BpkAccordionItem);exportdefault()=>(<BpkAccordion><StatefulAccordionItemid="stops"title="Stops">
My stops content.
</StatefulAccordionItem><StatefulAccordionItemid="departure-times"title="Departure times"initiallyExpanded>
My departure times content.
</StatefulAccordionItem><StatefulAccordionItemid="journey-duration"title="Journey duration"initiallyExpanded>
My journey duration content.
</StatefulAccordionItem></BpkAccordion>)