UNPKG

mithril-materialized

Version:
38 lines (37 loc) 1.46 kB
import { Attributes, Component } from 'mithril'; import { IInputOption } from './option'; export interface IRadioButtons<T extends string | number> extends Attributes { /** Element ID */ id?: string; /** Optional title or label */ label?: string; /** The options that you have */ options: IInputOption<T>[]; /** Event handler that is called when an option is changed */ onchange: (id: T) => void; /** Selected id (in oninit lifecycle) */ initialValue?: T; /** Selected id (in oninit and onupdate lifecycle) */ checkedId?: T; /** Optional description */ description?: string; /** If true, start on a new row */ newRow?: boolean; /** If true, add a mandatory '*' after the label */ isMandatory?: boolean; /** Optional CSS that is added to the input checkbox, e.g. if you add col s4, the items will be put inline */ checkboxClass?: string; /** Disable the button */ disabled?: boolean; } export interface IRadioButton<T extends string | number> extends Attributes { id: T; checked?: boolean; onchange: (id: T) => void; label: string; groupId: string; disabled?: boolean; } export declare const RadioButton: <T extends string | number>() => Component<IRadioButton<T>>; /** Component to show a list of radio buttons, from which you can choose one. */ export declare const RadioButtons: <T extends string | number>() => Component<IRadioButtons<T>>;