mithril-materialized
Version:
A materialize library for mithril.
50 lines (49 loc) • 1.8 kB
TypeScript
import { FactoryComponent, Attributes, Vnode } from 'mithril';
export declare enum CollectionMode {
BASIC = 0,
LINKS = 1,
AVATAR = 2
}
export interface ICollectionItem {
/** If available, will be used as the key, so all items need an id. */
id?: string | number;
/** Title of the collection item */
title: string | Vnode<any, any>;
/** For links, may contain a URL reference */
href?: string;
/** For Avatar mode, may contain a URL reference to an image or a material icons class name */
avatar?: string;
/** Add a class to the avatar image or icon, e.g. a color 'red'. */
className?: string;
/** For Avatar mode, may contain a two-line trusted HTML content */
content?: string;
/** If active, preselect the collection item. */
active?: boolean;
/** Add a material icon as secondary content. */
iconName?: string;
/** Onclick event handler */
onclick?: (item: ICollectionItem) => void;
/** Any other virtual element properties, including attributes and event handlers. */
[property: string]: any;
}
export interface ICollection extends Attributes {
/** Optional header */
header?: string;
/** The list of items */
items: ICollectionItem[];
/** Mode of operation */
mode?: CollectionMode;
}
export declare const SecondaryContent: FactoryComponent<ICollectionItem>;
export declare const ListItem: FactoryComponent<{
item: ICollectionItem;
mode: CollectionMode;
}>;
export declare const AnchorItem: FactoryComponent<{
item: ICollectionItem;
}>;
/**
* Creates a Collection of items, optionally containing links, headers, secondary content or avatars.
* @see https://materializecss.com/collections.html
*/
export declare const Collection: FactoryComponent<ICollection>;