The arguments for the Button constructor.

interface ButtonArgs {
    binding?: BindingBase;
    class?: string | string[];
    dom?: string | HTMLElement;
    enabled?: boolean;
    error?: boolean;
    height?: number;
    hidden?: boolean;
    icon?: string;
    id?: string;
    ignoreParent?: boolean;
    isRoot?: boolean;
    link?: {
        observer: Observer | Observer[];
        path: string | string[];
    };
    onChange?: ((value: any) => void);
    onClick?: (() => void);
    onRemove?: (() => void);
    parent?: Element;
    readOnly?: boolean;
    size?: "small";
    style?: string;
    tabIndex?: number;
    text?: string;
    unsafe?: boolean;
    width?: number;
}

Hierarchy (view full)

Properties

binding?: BindingBase

A binding to use with this Element.

class?: string | string[]

The class attribute of this Element's HTMLElement.

dom?: string | HTMLElement

The HTMLElement to create this Element with. If not provided this Element will create one.

enabled?: boolean

Sets whether it is possible to interact with this Element and its children.

error?: boolean

Sets whether the Element is in an error state.

height?: number

Sets the initial height of the Element.

hidden?: boolean

Sets whether this Element is hidden. Defaults to false.

icon?: string

The CSS code for an icon for the button. e.g. 'E401' (notice we omit the '\' character). Defaults to ''.

id?: string

The id attribute of this Element's HTMLElement.

ignoreParent?: boolean

If true, this Element will ignore its parent's enabled value when determining whether this element is enabled. Defaults to false.

isRoot?: boolean

Sets whether this Element is at the root of the hierarchy.

link?: {
    observer: Observer | Observer[];
    path: string | string[];
}

Links the observer attribute at the path location in the given observer to this Element.

onChange?: ((value: any) => void)

If provided and the Element is changeable, this function will be called each time the element value is changed.

onClick?: (() => void)

If provided and the Element is clickable, this function will be called each time the element is clicked.

onRemove?: (() => void)

If provided and the Element is removable, this function will be called each time the element is removed.

parent?: Element

Sets the parent Element.

readOnly?: boolean

Whether this Element is read only or not. Defaults to false.

size

Sets the 'size' type of the button. Can be 'small' or null. Defaults to null.

style?: string

Sets an initial value for Element.dom.style.

tabIndex?: number

Sets the tabIndex of the Element.

text?: string

Sets the text of the button. Defaults to ''.

unsafe?: boolean

If true, the innerHTML property will be used to set the text. Otherwise, textContent will be used instead. Defaults to false.

width?: number

Sets the initial width of the Element.