The arguments for the SelectInput constructor.

interface SelectInputArgs {
    allowCreate?: boolean;
    allowInput?: boolean;
    allowNull?: boolean;
    binding?: BindingBase;
    class?: string | string[];
    createFn?: ((value: string) => void);
    createLabelText?: string;
    defaultValue?: any;
    disabledOptions?: Record<string, string>;
    dom?: string | HTMLElement;
    enabled?: boolean;
    error?: boolean;
    fallbackOrder?: string[];
    height?: number;
    hidden?: boolean;
    id?: string;
    ignoreParent?: boolean;
    invalidOptions?: any[];
    isRoot?: boolean;
    link?: {
        observer: Observer | Observer[];
        path: string | string[];
    };
    multiSelect?: boolean;
    onChange?: ((value: any) => void);
    onClick?: (() => void);
    onRemove?: (() => void);
    onSelect?: ((value: string) => void);
    options?: {
        t: string;
        v: string | number | boolean;
    }[];
    optionsFn?: any;
    parent?: Element;
    placeholder?: string;
    prefix?: string;
    readOnly?: boolean;
    renderChanges?: boolean;
    style?: string;
    tabIndex?: number;
    type?: "string" | "number" | "boolean";
    value?: any;
    values?: any[];
    width?: number;
}

Hierarchy (view full)

  • ElementArgs
  • IBindableArgs
  • IPlaceholderArgs
    • SelectInputArgs

Properties

allowCreate?: boolean

If true then the input allows creating new values from the text field. Only used when allowInput is true. Defaults to false.

allowInput?: boolean

If true then a text field is shown for the user to search for values or enter new ones. Defaults to false.

allowNull?: boolean

If true then null is a valid input value. Defaults to false.

binding?: BindingBase

A binding to use with this Element.

class?: string | string[]

The class attribute of this Element's HTMLElement.

createFn?: ((value: string) => void)

A function to be executed when the user selects to create a new value. The function takes the new value as a parameter.

createLabelText?: string

The placeholder text to show when creating a new value. Used when allowInput and allowCreate are both true.

defaultValue?: any

Default value for the input.

disabledOptions?: Record<string, string>

All the option values that should be disabled. The keys of the object are the values of the options and the values are the text to show when the option is disabled.

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.

fallbackOrder?: string[]

The order that the options should be checked in to find a valid fallback option that isn't included in the disabledOptions object.

height?: number

Sets the initial height of the Element.

hidden?: boolean

Sets whether this Element is hidden. Defaults to false.

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.

invalidOptions?: any[]

An array of values against which new values are checked before they are created. If a value is in the array it will not be created.

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.

multiSelect?: boolean

If true then the input value becomes an array allowing the selection of multiple options. Defaults to false.

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.

onSelect?: ((value: string) => void)

If provided, this function will be called each time an option is selected.

options?: {
    t: string;
    v: string | number | boolean;
}[]

The dropdown options of the input. Contains an array of objects with the following format {v: Any, t: String} where v is the value and t is the text of the option.

optionsFn?: any

Used to map the options.

parent?: Element

Sets the parent Element.

placeholder?: string

Sets the placeholder label that appears on the right of the input.

prefix?: string

Text to display in the SelectInput before the selected option.

readOnly?: boolean

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

renderChanges?: boolean

If true each input will flash on changes.

style?: string

Sets an initial value for Element.dom.style.

tabIndex?: number

Sets the tabIndex of the Element.

type?: "string" | "number" | "boolean"

The type of each value. Can be one of 'string', 'number' or 'boolean'. Defaults to 'string'.

value?: any

Sets the value of the Element.

values?: any[]

Sets multiple values to the Element. It is up to the Element to determine how to display them.

width?: number

Sets the initial width of the Element.