UNPKG

@spark-web/accordion

Version:

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

29 lines (28 loc) 1.83 kB
import type { AccordionItemProps as RadixAccordionItemProps, AccordionMultipleProps, AccordionSingleProps } from '@radix-ui/react-accordion'; import type { ForegroundTone } from '@spark-web/text'; import type { ResponsiveProp, SparkTheme } from '@spark-web/theme'; import type { DataAttributeMap } from '@spark-web/utils/internal'; import type { RefAttributes } from 'react'; export declare type AccordionItemProps = Pick<RadixAccordionItemProps, 'children' | 'value'> & { /** Sets data attributes on the component. */ data?: DataAttributeMap; /** The html element to render the accordion item heading as. */ headingElement?: 'h2' | 'h3' | 'h4'; /** The heading of the accordion item. */ label: string; /** The size of the heading. '1' is largest and '4' is smallest. */ level?: '1' | '2' | '3' | '4'; /** background colour of the component. */ background?: keyof SparkTheme['color']['background']; /** The tone of the header text and chevron icon. */ headerTone?: ForegroundTone; /** The heading of the accordion item if opened. */ openStateLabel?: string; /** Padding of accordion item. */ padding?: ResponsiveProp<keyof SparkTheme['spacing']>; /** The space between the accordion label and chevron icon. */ justifyContent?: 'spaceBetween' | 'start'; }; export declare function AccordionItem({ headingElement, background, children, data, label, level, value, headerTone, openStateLabel, padding, justifyContent, }: AccordionItemProps): JSX.Element; export declare type AccordionProps = (Omit<AccordionSingleProps, 'asChild'> & RefAttributes<HTMLDivElement>) | (Omit<AccordionMultipleProps, 'asChild'> & RefAttributes<HTMLDivElement>); export declare function Accordion({ children, ...rest }: AccordionProps): import("@emotion/react/jsx-runtime").JSX.Element;