Socket
Socket
Sign inDemoInstall

@spark-web/accordion

Package Overview
Dependencies
85
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @spark-web/accordion

--- title: Accordion storybookPath: data-display-accordion--single isExperimentalPackage: true ---


Version published
Weekly downloads
44
increased by41.94%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

title: Accordion storybookPath: data-display-accordion--single isExperimentalPackage: true

Accordions are a set of vertically stacked headings which can be toggled to reveal some associated section of content.

Example

<Accordion type="single" collapsible>
  <AccordionItem value="item-1" label="What is this?" level="4">
    <Text>This is an example accordion</Text>
  </AccordionItem>
  <AccordionItem value="item-2" label="Should I click this?" level="4">
    <Text>Yes</Text>
  </AccordionItem>
  <AccordionItem value="item-3" label="What is in it for me?" level="4">
    <Text>A nice accordion</Text>
  </AccordionItem>
</Accordion>

Props

Accordion

The root of the accordion block containing all parts of the accordion.

PropTypeDefaultDescription
type'single' | 'multiple'Determines whether one or multiple accordion items can be opened at the same time.
value?stringThe controlled value of the item to expand when type is "single". Must be used in conjunction with onValueChange.
defaultValue?stringThe value of the item to expand when initially rendered and type is "single". Use when you do not need to control the state of the items.
onValueChange?(v: string) => voidEvent handler called when the expanded state of an item changes and type is "single".
value?string[][]The controlled value of the item to expand when type is "multiple". Must be used in conjunction with onValueChange.
defaultValue?string[][]The value of the item to expand when initially rendered when type is "multiple". Use when you do not need to control the state of the items.
onValueChange?(v: string[]) => voidEvent handler called when the expanded state of an item changes and type is "multiple".
collapsible?booleanfalseWhen type is "single", allows closing content when clicking trigger for an open item.
disabled?booleanfalseWhen true, prevents the user from interacting with the accordion and all its items.
data?DataAttributeMapSets data attributes on the component.

Additional div props are passed to the primitive radix accordion root component and are not listed.

AccordionItem

An accordion item section containing heading and collapsible content.

PropTypeDefaultDescription
childrenReact.ReactNodeChildren element to be rendered in the collapsible content of the accordion item.
valuestringA unique value for the accordion item.
headingElement?'h2' | 'h3' | 'h4''h3'The html element to render the accordion item heading as.
level?'1' | '2' | '3' | '4''3'The size of the heading. '1' is largest and '4' is smallest.
labelstringThe heading of the accordion item.

FAQs

Last updated on 29 Aug 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc