UIFormSearch

Properties

Name Type
props props
state state

new UIFormSearch(props)

A form search component

Param Type
props props

Example

import {UIFormSearch} from 'writer'

render($$) {
    return $$(UIFormSearch, {
        existingItems: [{name: 'Test', value: 'test', uuid: '13c4d7f6-4ecb-4d93-905c-3f5752a04f8d', imType: 'x-im/author', shortDescription: 'My short description'}],
        onSelect: (item) => {
            console.info(item)
        },
        onCreate: (addedItem, doesItemAlreadyExist) => {
            console.info(addedItem, doesItemAlreadyExist)
        },
        createAllowed: true,
        placeholderText: 'Enter text'
    })
}

UIFormSearch.props

Properties

Name Type Default Description
placeholderText string Placeholder text in the field
[createAllowed] boolean false Set to true to allow creation of new items
[focusOnRender] boolean false Whether or not to focus on the input field after render. Default is false
onSelect function Triggers when item is selected
[onCreate] function If possible to create new items, pass this callback
existingItems Array.<Item>

UIFormSearch.Item

Properties

Name Type
name string
value string
uuid string
imType string
shortDescription string

UIFormSearch.state

Properties

Name Type Default
[items] Array.<Item> []
[isSearching] Boolean false
[currentSelectedIndex] number 0

results matching ""

    No results matching ""