apphouse
Version:
Component library for React that uses observable state management and theme-able components.
55 lines (54 loc) • 1.67 kB
TypeScript
import { PanelStyles } from '../components/panel/Panel';
import React, { CSSProperties } from 'react';
import { BoxSizeStyles } from '../styles/defaults/themes.interface';
import { ApphouseComponent } from '../components/component.interfaces';
export interface AccordionStyles {
container: CSSProperties;
panel: PanelStyles;
}
export interface AccordionItem {
id: number;
title: string;
content: React.ReactNode;
}
/**
* Represents the props for the Accordion component.
*/
export interface AccordionProps extends ApphouseComponent<AccordionStyles> {
/**
* An array of Accordions.
*/
items: AccordionItem[];
/**
* The visual size of the Accordion component.
* @default 'm'
*/
size?: keyof BoxSizeStyles;
/**
* The index of the Accordion item to be opened by default.
* @default -1 (no Accordion item is open by default)
*/
openIndex?: number;
/**
* A callback function that is called when an Accordion is expanded.
* @param id the id of the Accordion that was expanded
* @returns
*/
onExpand?: (id: number) => void;
/**
* If true, the Accordion will have no borders.
*/
borderless?: boolean;
/**
* If true, the Accordion will have no chevron icon.
* @default false (the Accordion will have chevron icon)
*/
hideIcon?: boolean;
}
/**
* The Accordion component displays a list of frequently asked questions.
* @component
* @param {AccordionProps} props - The props for the Accordion component.
* @returns {React.FC} A React functional component.
*/
export declare const Accordion: React.FC<AccordionProps>;