AutoCompleteInput
Installation
import {AutoCompleteInput} from 'uxp/components';Examples
let [val, setVal] = useState('')
let inputRef = useRef(null)
let data = [
{name: 'India'},
{name: 'Japan'},
{name: 'China'},
{name: 'Singapore'},
{name: 'Italy'},
]
function renderAutoComplete() {
let options = data.filter(d => d.name.includes(val))
return <>
{options.map((o, i) => {
return <div onClick={() => {
// to replace the value
setVal(o.name);
// if you want to apped at the cursor
inputRef.current?.appendAtCursor(o.name)
// close picker when select an item
inputRef.current?.close()
}>
{o.name}
</div>
})}
</>
}
return <div>
<AutoCompleteInput
value={val}
onChange={setVal}
autoFill={<div >
{renderAutoComplete()}
</div>}
ref={inputRef}
/>
</div>Properties
Name
Type
Description
value
type
onChange
type
options
type
autoFill
type
className
type
isValid
type
placeholder
type
optionClassName
in styles (.scss file)
type
tabIndex
type
Last updated