mithril-materialized
Version:
A materialize library for mithril.
47 lines (46 loc) • 1.98 kB
TypeScript
import { Attributes, Component } from 'mithril';
import { IInputOption } from './option';
export interface ISelectOptions<T extends string | number> extends Attributes, Partial<M.FormSelectOptions> {
/** Options to select from */
options: IInputOption<T>[];
/** Called when the value is changed, either contains a single or all selected (checked) ids */
onchange: (checkedIds: T[]) => void;
/**
* Selected id or ids (in case of multiple options). Processed in the oninit and onupdate lifecycle.
* When the checkedId property changes (using a shallow compare), the selections are updated accordingly.
*/
checkedId?: T | T[];
/** Selected id or ids (in case of multiple options). Only processed in the oninit lifecycle. */
initialValue?: T | T[];
/** Select a single option or multiple options */
multiple?: boolean;
/** Optional label. */
label?: string;
/** Optional ID. */
id?: string;
/** Unique key for use of the element in an array. */
key?: string | number;
/** Add a a placeholder to the input field. */
placeholder?: string;
/** Add a description underneath the input field. */
helperText?: string;
/** Uses Materialize icons as a prefix or postfix. */
iconName?: string;
/** Sets the input field to disabled. */
disabled?: boolean;
/** Optional style information. */
style?: string;
/** If true, break to a new row */
newRow?: boolean;
/**
* If true, add a mandatory * after the label (if any),
* and add the required and aria-required attributes to the input element.
*/
isMandatory?: boolean;
/** Add the required and aria-required attributes to the input element */
required?: boolean;
/** Enable the clear icon */
showClearButton?: boolean;
}
/** Component to select from a list of values in a dropdowns */
export declare const Select: <T extends string | number>() => Component<ISelectOptions<T>>;