The Select component displays a input, surrounded with some extra elements for styling. It accepts the following attrs: options A map of option values to labels. onchange A callback to run when the selected value is changed. value The value of the selected option. disabled Disabled state for the input. wrapperAttrs A map of attrs to be passed to the DOM element wrapping the <select> Other attributes are passed directly to the <select> element rendered to the DOM. Hierarchy Component Select Index Constructors constructor Properties attrs element state Methods $ onbeforeremove onbeforeupdate oncreate oninit onremove onupdate view component initAttrs Constructors constructor new Select(): Select Returns Select Properties attrs attrs: ComponentAttrs The attributes passed into the component. Seehttps://mithril.js.org/components.html#passing-data-to-components element element: Element The root DOM element for the component. state state: undefined Class component state that is persisted between redraws. Updating this will not automatically trigger a redraw, unlike other frameworks. This is different to Vnode state, which is always an instance of your class component. This is undefined by default. Methods $ $(selector?): JQuery<HTMLElement> Returns a jQuery object for this component's element. If you pass in a selector string, this method will return a jQuery object, using the current element as its buffer. For example, calling component.$('li') will return a jQuery object containing all of the li elements inside the DOM element of this component. Parameters Optional selector: string a jQuery-compatible selector string Returns JQuery<HTMLElement>the jQuery object for the DOM node Final onbeforeremove onbeforeremove(vnode): void Parameters vnode: VnodeDOM<ComponentAttrs, Select> Returns void Inherit Doc onbeforeupdate onbeforeupdate(vnode): void Parameters vnode: VnodeDOM<ComponentAttrs, Select> Returns void Inherit Doc oncreate oncreate(vnode): void Parameters vnode: VnodeDOM<ComponentAttrs, Select> Returns void Inherit Doc oninit oninit(vnode): void Parameters vnode: Vnode<ComponentAttrs, Select> Returns void Inherit Doc onremove onremove(vnode): void Parameters vnode: VnodeDOM<ComponentAttrs, Select> Returns void Inherit Doc onupdate onupdate(vnode): void Parameters vnode: VnodeDOM<ComponentAttrs, Select> Returns void Inherit Doc view view(): Element Returns Element Inherit Doc Static component component<SAttrs>(attrs?, children?): Vnode<{}, {}> Convenience method to attach a component without JSX. Has the same effect as calling m(THIS_CLASS, attrs, children). Type Parameters SAttrs extends ComponentAttrs<SAttrs> = ComponentAttrs Parameters attrs: SAttrs = ... children: Children = null Returns Vnode<{}, {}> Seehttps://mithril.js.org/hyperscript.html#mselector,-attributes,-children Static initAttrs initAttrs(attrs): void Initialize the component's attrs. This can be used to assign default values for missing, optional attrs. Parameters attrs: unknown Returns void Settings Member Visibility Protected
Select
options
onchange
value
disabled
wrapperAttrs
<select>
Other attributes are passed directly to the <select> element rendered to the DOM.
The attributes passed into the component.
https://mithril.js.org/components.html#passing-data-to-components
The root DOM element for the component.
Class component state that is persisted between redraws.
Updating this will not automatically trigger a redraw, unlike other frameworks.
This is different to Vnode state, which is always an instance of your class component.
This is undefined by default.
undefined
Returns a jQuery object for this component's element. If you pass in a selector string, this method will return a jQuery object, using the current element as its buffer.
For example, calling component.$('li') will return a jQuery object containing all of the li elements inside the DOM element of this component.
component.$('li')
li
Optional
a jQuery-compatible selector string
the jQuery object for the DOM node
Static
Convenience method to attach a component without JSX. Has the same effect as calling m(THIS_CLASS, attrs, children).
m(THIS_CLASS, attrs, children)
https://mithril.js.org/hyperscript.html#mselector,-attributes,-children
Initialize the component's attrs.
This can be used to assign default values for missing, optional attrs.
Generated using TypeDoc v0.24.8
The
Selectcomponent displays a ProtectedTheme