UNPKG

mithril-materialized

Version:
29 lines (28 loc) 1.21 kB
import { FactoryComponent, Attributes, Vnode } from 'mithril'; export interface CollapsibleItem extends Attributes { /** Header of the collabsible item, may contain HTML or may be a Vnode */ header?: string | Vnode<any, any>; /** Body of the collabsible item, may contain HTML or may be a Vnode */ body?: string | Vnode<any, any>; /** If active, preselect the collabsible item. */ active?: boolean; /** Add an material icon in front of the header. */ iconName?: string; } export interface CollapsibleAttrs extends Attributes { /** Optional header for the entire collapsible, similar to Collection header */ header?: string | Vnode<any, any>; /** The list of accordeon/collabsible items */ items: CollapsibleItem[]; /** If true, only one item can be expanded at a time (accordion mode) */ accordion?: boolean; } export declare const CollapsibleItem: FactoryComponent<CollapsibleItem & { isActive: boolean; onToggle: () => void; }>; /** * Creates a collabsible or accordion component with pure CSS/Mithril implementation. * No MaterializeCSS JavaScript dependencies. */ export declare const Collapsible: FactoryComponent<CollapsibleAttrs>;