Forms

Autocomplete.

Free-text suggestions with grouped results, async recovery and native form values.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/autocomplete.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

Search with recent suggestions

An ordinary text query can use a recent suggestion or a new phrase. This example keeps four recent queries in memory; the host supplies actual search results.

Keyboard

  • Type a query, then use Arrow Down or Arrow Up to explore suggestions while input focus stays in the field.
  • Enter accepts the highlighted suggestion; Escape closes the list without replacing typed text.
  • Use the Search button or Enter with no highlighted suggestion to prepare the query.

States covered

  • Free text
  • Recent queries
  • Keyboard acceptance
  • No matching suggestions
  • Clear query

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-autocomplete-search.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Autocomplete} from '@bld8/ui/autocomplete';
import {Button} from '@bld8/ui';
export default function SearchHistoryExample(){
  const [query,setQuery]=useState(''),[recent,setRecent]=useState(['Design tokens','Keyboard shortcuts','Form validation']),[status,setStatus]=useState('');
  const options=recent.map(label=>({id:'recent-'+label,label,group:'Recent queries',description:'Used in this browser session.'}));
  return <form aria-label="Documentation query" style={{display:'grid',gap:12}} onSubmit={event=>{
    event.preventDefault();const text=query.trim();if(!text)return;
    setRecent(previous=>[text,...previous.filter(item=>item!==text)].slice(0,4));setStatus('Query prepared: '+text);
  }}>
    <Autocomplete label="Search documentation" name="query" value={query} onValueChange={setQuery} options={options} placeholder="Try Design tokens" required hint="Suggestions are optional. Enter any query; recent queries stay in memory for this example."/>
    <div><Button type="submit">Search documentation</Button></div>
    <p role="status" aria-label="Search query status">{status}</p>
  </form>;
}

Email domains without restricting the address

Build domain suggestions from the typed local part while keeping native email validation. A valid address outside the suggestions remains valid; sending an invitation belongs to the application.

Keyboard

  • Type the local part, then Arrow Down and Enter to complete a suggested address.
  • Native text selection, deletion and paste continue to work.
  • Submitting an invalid address returns focus to the native email input.

States covered

  • Dynamic suggestions
  • Native email constraint
  • Required field
  • Custom domain
  • Field error

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-autocomplete-email.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Autocomplete} from '@bld8/ui/autocomplete';
import {Button} from '@bld8/ui';
const domains=['example.com','outlook.com','gmail.com'];
export default function EmailSuggestionExample(){
  const [email,setEmail]=useState(''),[error,setError]=useState(''),[status,setStatus]=useState('');
  const local=email.split('@')[0];
  const options=local?domains.map(domain=>({id:domain,label:local+'@'+domain,description:'Suggested email domain'})).filter(option=>option.label.toLowerCase().startsWith(email.toLowerCase())):[];
  return <form aria-label="Invitation address" style={{display:'grid',gap:12}} onSubmit={event=>{event.preventDefault();setError('');setStatus('Invitation address: '+email);}}>
    <Autocomplete label="Invite email" type="email" autoComplete="email" name="inviteEmail" required value={email} onValueChange={value=>{setEmail(value);setError('');setStatus('');}} options={options} filter={null} error={error} onInvalid={()=>setError('Enter a complete email address.')} hint="Use a suggested domain or any other valid email address."/>
    <div><Button type="submit">Prepare invitation</Button></div>
    <p role="status" aria-label="Invitation address status">{status}</p>
  </form>;
}

Grouped destinations with rich suggestions

Stable IDs identify suggestions; readable labels become the actual text value. Description and alias search can find destinations, while custom places remain valid free text.

Keyboard

  • Open the field and use arrow keys to move through enabled destinations across groups.
  • Enter inserts the city label, never the suggestion ID.
  • Escape keeps the current text and Tab moves to the next control.

States covered

  • Grouped results
  • Rich descriptions
  • Aliases
  • Disabled suggestion
  • Custom destination

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-autocomplete-groups.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Autocomplete,type AutocompleteOption} from '@bld8/ui/autocomplete';
const destinations:AutocompleteOption[]=[
  {id:'syd',label:'Sydney',group:'Australia',description:'New South Wales · SYD',searchTerms:['harbour','NSW']},
  {id:'mel',label:'Melbourne',group:'Australia',description:'Victoria · MEL',searchTerms:['VIC']},
  {id:'sin',label:'Singapore',group:'Asia Pacific',description:'Singapore · SIN'},
  {id:'tyo',label:'Tokyo',group:'Asia Pacific',description:'Japan · TYO · unavailable in this example',disabled:true}
];
export default function GroupedDestinationExample(){
  const [destination,setDestination]=useState('');
  return <div style={{display:'grid',gap:12}}>
    <Autocomplete label="Destination" options={destinations} value={destination} onValueChange={setDestination} placeholder="Search city, region or airport code" hint="Choose a suggested city or enter another destination." renderOption={option=><span style={{display:'flex',alignItems:'baseline',justifyContent:'space-between',gap:12}}><span>{option.label}</span><small style={{fontSize:11,fontWeight:400}}>{option.id.toUpperCase()}</small></span>}/>
    <p role="status" aria-label="Destination text">Destination text: {destination||'none'}</p>
  </div>;
}

Abortable remote suggestions with retry

The host debounces and cancels bounded asynchronous suggestions, rejects stale results and exposes retry. The included service is a local timer simulation with an explicit one-request failure switch.

Keyboard

  • Type at least two characters to request suggestions. Arrow Down and Enter accept a result.
  • Keep typing while a request is pending; earlier requests cannot replace newer suggestions.
  • Tab to Retry suggestions after a failure; the typed query stays intact.

States covered

  • Minimum query
  • Debounce
  • Loading
  • Request cancellation
  • Stale-result guard
  • Failure and retry
  • Bounded results

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-autocomplete-async.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useEffect,useRef,useState} from 'react';
import {Autocomplete,type AutocompleteOption} from '@bld8/ui/autocomplete';
import {Button} from '@bld8/ui';
const articles:AutocompleteOption[]=[
  {id:'tokens',label:'Design tokens',description:'Colour, spacing and type'},
  {id:'motion',label:'Motion guidelines',description:'Shared easing and reduced motion'},
  {id:'forms',label:'Form validation',description:'Native constraints and field errors'},
  {id:'keyboard',label:'Keyboard shortcuts',description:'Focus and keyboard navigation'}
];
// Replace this local simulation with a service call using the supplied signal.
function loadSuggestions(query:string,signal:AbortSignal,fail:boolean):Promise<AutocompleteOption[]>{
  return new Promise((resolve,reject)=>{
    const abort=()=>{clearTimeout(timer);reject(new DOMException('Request cancelled','AbortError'));};
    const timer=setTimeout(()=>{signal.removeEventListener('abort',abort);if(fail){reject(new Error('Suggestions could not be loaded.'));return;}resolve(articles.filter(item=>(item.label+' '+item.description).toLowerCase().includes(query.toLowerCase())).slice(0,8));},450);
    if(signal.aborted)abort();else signal.addEventListener('abort',abort,{once:true});
  });
}
export default function AsyncSuggestionsExample(){
  const [query,setQuery]=useState(''),[options,setOptions]=useState<AutocompleteOption[]>([]),[loading,setLoading]=useState(false),[error,setError]=useState(''),[attempt,setAttempt]=useState(0);
  const failNext=useRef(false),revision=useRef(0);
  useEffect(()=>{
    const request=++revision.current,controller=new AbortController();let active=true;
    setOptions([]);setError('');const text=query.trim();
    if(text.length<2){setLoading(false);return()=>{active=false;controller.abort();};}
    setLoading(true);
    const debounce=setTimeout(()=>{
      const shouldFail=failNext.current;failNext.current=false;
      loadSuggestions(text,controller.signal,shouldFail).then(items=>{if(active&&!controller.signal.aborted&&request===revision.current)setOptions(items);}).catch(reason=>{if(active&&!controller.signal.aborted&&request===revision.current)setError(reason instanceof Error?reason.message:'Suggestions could not be loaded.');}).finally(()=>{if(active&&!controller.signal.aborted&&request===revision.current)setLoading(false);});
    },200);
    return()=>{active=false;clearTimeout(debounce);controller.abort();};
  },[query,attempt]);
  return <div style={{display:'grid',gap:12}}>
    <Autocomplete label="Search help articles" value={query} onValueChange={value=>{if(value!==query)revision.current++;setQuery(value);}} options={options} filter={null} maxSuggestions={8} loading={loading} emptyText={query.trim().length<2?'Type at least two characters.':error?'Suggestions unavailable. You can keep your text.':'No articles found. You can keep your text.'} hint="The example simulates a host service. Requests are debounced, aborted and checked before results are accepted."/>
    <div style={{display:'flex',gap:8,flexWrap:'wrap'}}><Button variant="secondary" onClick={()=>{failNext.current=true;setAttempt(value=>value+1);}}>Fail next suggestion request</Button>{error&&<Button variant="secondary" onClick={()=>setAttempt(value=>value+1)}>Retry suggestions</Button>}</div>
    <p role={error?'alert':'status'} aria-label="Suggestion request status">{error|| (loading?'Loading suggestions…':query.trim().length<2?'Enter two or more characters.':options.length+' suggestions ready.')}</p>
    <p className="bui-hint">Current text: {query||'none'}</p>
  </div>;
}

Native form values, reset and field errors

An external native form reads actual text values and excludes disabled inputs. Uncontrolled reset respects preventDefault; the host resets controlled text and clears domain errors. Required and maximum-length constraints stay on the real input.

Keyboard

  • Submit an empty required field to focus the native input.
  • Tab visits editable and read-only fields; disabled text is skipped.
  • Reset restores the original uncontrolled text; the checkbox demonstrates a prevented reset.

States covered

  • External form
  • Native required validation
  • Host validation and ref focus
  • Uncontrolled reset
  • Controlled reset
  • Read-only submission
  • Disabled exclusion
  • Prevented reset

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-autocomplete-form.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useId,useRef,useState} from 'react';
import {Autocomplete} from '@bld8/ui/autocomplete';
import {Button} from '@bld8/ui';
const teams=[{id:'design',label:'Design'},{id:'research',label:'Research'},{id:'engineering',label:'Engineering'}];
export default function AutocompleteFormExample(){
  const formId=useId(),field=useRef<HTMLInputElement>(null);
  const [owned,setOwned]=useState('Research'),[error,setError]=useState(''),[status,setStatus]=useState(''),[preventReset,setPreventReset]=useState(false),[changes,setChanges]=useState(0);
  return <div style={{display:'grid',gap:14}}>
    <label className="bui-choice"><input type="checkbox" className="bui-checkbox" checked={preventReset} onChange={event=>setPreventReset(event.target.checked)}/>Prevent autocomplete reset</label>
    <form id={formId} aria-label="Autocomplete native form" onReset={event=>{if(preventReset){event.preventDefault();return;}setOwned('Research');setError('');setStatus('');}} onSubmit={event=>{
      event.preventDefault();const data=new FormData(event.currentTarget),team=String(data.get('team')||'');
      if(team.trim().length<3){setError('Use at least three non-space characters.');field.current?.focus();return;}
      setError('');setStatus('Values: '+team+' | '+data.get('owned')+' | '+data.get('readonly')+' | disabled '+data.getAll('disabled').length);
    }}><div style={{display:'flex',gap:8,flexWrap:'wrap'}}><Button type="submit">Read autocomplete values</Button><Button type="reset" variant="secondary">Reset autocomplete values</Button></div></form>
    <Autocomplete label="Team name" options={teams} defaultValue="Design" name="team" form={formId} inputRef={field} required maxLength={60} hint="Any team name is valid; the host requires at least three non-space characters." error={error} onInvalid={()=>setError('Enter a team name.')} onValueChange={()=>{setError('');setChanges(count=>count+1);}}/>
    <Autocomplete label="Controlled team" options={teams} value={owned} onValueChange={setOwned} name="owned" form={formId}/>
    <Autocomplete label="Read-only team" options={teams} defaultValue="Operations" name="readonly" form={formId} readOnly/>
    <Autocomplete label="Disabled team" options={teams} defaultValue="Finance" name="disabled" form={formId} disabled/>
    <p role="status" aria-label="Autocomplete form values">{status}</p>
    <p role="status" aria-label="Autocomplete change count">{changes}</p>
  </div>;
}

Quick reference

React / TypeScript
<Autocomplete label="Search documentation" options={suggestions} value={query} onValueChange={setQuery} />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

The field value is editable text, not an option ID. Use Combobox when a record must be selected. Supports grouped options, disabled suggestions, clear, external form/reset and custom option content. Async examples cancel stale requests and keep retry explicit.

Autocomplete

Autocomplete public properties
PropTypeDefault
labelRequiredstring—
optionsRequiredreadonly AutocompleteOption[]—
clearableboolean | undefinedtrue
defaultValuestring | undefined''
density"compact" | "comfortable" | undefined'comfortable'
emptyTextstring | undefined'No suggestions. You can keep typing.'
errorstring | undefined—
filter((option: AutocompleteOption, query: string) => boolean) | null | undefined

null preserves externally filtered suggestions, for example remote search results.

—
hintstring | undefined—
inputRefRef<HTMLInputElement> | undefined—
loadingboolean | undefined

The host supplies loading state, request cancellation, errors and retry actions.

false
loadingTextstring | undefined'Loading suggestions…'
maxSuggestionsnumber | undefined

Bounds rendered suggestions to 1–100. Defaults to 50. This is not virtualization.

50
onValueChange((value: string) => void) | undefined—
renderOption((option: AutocompleteOption) => ReactNode) | undefined

Keep custom suggestion content presentational; the accessible label remains option.label.

—
valuestring | undefined

Free text, including values absent from the suggestions.

—
Forwarded React / HTML props 305
Autocomplete native public properties
PropTypeDefault
aboutstring | undefined—
acceptstring | undefined—
accessKeystring | undefined—
altstring | undefined—
aria-activedescendantstring | undefined

Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.

—
aria-atomicBooleanish | undefined

Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.

—
aria-autocomplete"none" | "list" | "inline" | "both" | undefined

Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made.

—
aria-braillelabelstring | undefined

Defines a string value that labels the current element, which is intended to be converted into Braille.

—
aria-brailleroledescriptionstring | undefined

Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.

—
aria-busyBooleanish | undefined—
aria-checkedboolean | "true" | "false" | "mixed" | undefined

Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.

—
aria-colcountnumber | undefined

Defines the total number of columns in a table, grid, or treegrid.

—
aria-colindexnumber | undefined

Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.

—
aria-colindextextstring | undefined

Defines a human readable text alternative of aria-colindex.

—
aria-colspannumber | undefined

Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.

—
aria-controlsstring | undefined

Identifies the element (or elements) whose contents or presence are controlled by the current element.

—
aria-currentboolean | "true" | "false" | "page" | "step" | "location" | "date" | "time" | undefined

Indicates the element that represents the current item within a container or set of related elements.

—
aria-describedbystring | undefined

Identifies the element (or elements) that describes the object.

—
aria-descriptionstring | undefined

Defines a string value that describes or annotates the current element.

—
aria-detailsstring | undefined

Identifies the element that provides a detailed, extended description for the object.

—
aria-disabledBooleanish | undefined

Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.

—
aria-dropeffect"none" | "link" | "copy" | "execute" | "move" | "popup" | undefined

Indicates what functions can be performed when a dragged object is released on the drop target.

—
aria-errormessagestring | undefined

Identifies the element that provides an error message for the object.

—
aria-expandedBooleanish | undefined

Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.

—
aria-flowtostring | undefined

Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.

—
aria-grabbedBooleanish | undefined

Indicates an element's "grabbed" state in a drag-and-drop operation.

—
aria-haspopupboolean | "true" | "false" | "dialog" | "grid" | "listbox" | "menu" | "tree" | undefined

Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.

—
aria-hiddenBooleanish | undefined

Indicates whether the element is exposed to an accessibility API.

—
aria-invalidboolean | "true" | "false" | "grammar" | "spelling" | undefined

Indicates the entered value does not conform to the format expected by the application.

—
aria-keyshortcutsstring | undefined

Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.

—
aria-labelstring | undefined

Defines a string value that labels the current element.

—
aria-labelledbystring | undefined

Identifies the element (or elements) that labels the current element.

—
aria-levelnumber | undefined

Defines the hierarchical level of an element within a structure.

—
aria-live"off" | "assertive" | "polite" | undefined

Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.

—
aria-modalBooleanish | undefined

Indicates whether an element is modal when displayed.

—
aria-multilineBooleanish | undefined

Indicates whether a text box accepts multiple lines of input or only a single line.

—
aria-multiselectableBooleanish | undefined

Indicates that the user may select more than one item from the current selectable descendants.

—
aria-orientation"horizontal" | "vertical" | undefined

Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.

—
aria-ownsstring | undefined

Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.

—
aria-placeholderstring | undefined

Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.

—
aria-posinsetnumber | undefined

Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.

—
aria-pressedboolean | "true" | "false" | "mixed" | undefined

Indicates the current "pressed" state of toggle buttons.

—
aria-readonlyBooleanish | undefined

Indicates that the element is not editable, but is otherwise operable.

—
aria-relevant"text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined

Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.

—
aria-requiredBooleanish | undefined

Indicates that user input is required on the element before a form may be submitted.

—
aria-roledescriptionstring | undefined

Defines a human-readable, author-localized description for the role of an element.

—
aria-rowcountnumber | undefined

Defines the total number of rows in a table, grid, or treegrid.

—
aria-rowindexnumber | undefined

Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.

—
aria-rowindextextstring | undefined

Defines a human readable text alternative of aria-rowindex.

—
aria-rowspannumber | undefined

Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.

—
aria-selectedBooleanish | undefined

Indicates the current "selected" state of various widgets.

—
aria-setsizenumber | undefined

Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.

—
aria-sort"none" | "ascending" | "descending" | "other" | undefined

Indicates if items in a table or grid are sorted in ascending or descending order.

—
aria-valuemaxnumber | undefined

Defines the maximum allowed value for a range widget.

—
aria-valueminnumber | undefined

Defines the minimum allowed value for a range widget.

—
aria-valuenownumber | undefined

Defines the current value for a range widget.

—
aria-valuetextstring | undefined

Defines the human readable text alternative of aria-valuenow for a range widget.

—
autoCapitalize"off" | "none" | "on" | "sentences" | "words" | "characters" | (string & {}) | undefined—
autoCompleteHTMLInputAutoCompleteAttribute | undefined'off'
autoCorrectstring | undefined—
autoFocusboolean | undefined—
autoSavestring | undefined—
captureboolean | "user" | "environment" | undefined—
checkedboolean | undefined—
classNamestring | undefined—
colorstring | undefined—
contentstring | undefined—
contentEditableBooleanish | "inherit" | "plaintext-only" | undefined—
contextMenustring | undefined—
dangerouslySetInnerHTML{ __html: string | TrustedHTML; } | undefined—
datatypestring | undefined—
defaultCheckedboolean | undefined—
dirstring | undefined—
disabledboolean | undefined—
draggableBooleanish | undefined—
enterKeyHint"enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined—
exportpartsstring | undefined—
formstring | undefined—
formActionstring | ((formData: FormData) => void | Promise<void>) | undefined—
formEncTypestring | undefined—
formMethodstring | undefined—
formNoValidateboolean | undefined—
formTargetstring | undefined—
heightstring | number | undefined—
hiddenboolean | undefined—
idstring | undefined—
inertboolean | undefined—
inlistany—
inputMode"none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined

Hints at the type of data that might be entered by the user while editing the element or its contents

—
isstring | undefined

Specify that a standard HTML element should behave like a defined custom built-in element

—
itemIDstring | undefined—
itemPropstring | undefined—
itemRefstring | undefined—
itemScopeboolean | undefined—
itemTypestring | undefined—
keyKey | null | undefined—
langstring | undefined—
liststring | undefined—
maxstring | number | undefined—
maxLengthnumber | undefined—
minstring | number | undefined—
minLengthnumber | undefined—
multipleboolean | undefined—
namestring | undefined—
noncestring | undefined—
onAbortReactEventHandler<HTMLInputElement> | undefined—
onAbortCaptureReactEventHandler<HTMLInputElement> | undefined—
onAnimationEndAnimationEventHandler<HTMLInputElement> | undefined—
onAnimationEndCaptureAnimationEventHandler<HTMLInputElement> | undefined—
onAnimationIterationAnimationEventHandler<HTMLInputElement> | undefined—
onAnimationIterationCaptureAnimationEventHandler<HTMLInputElement> | undefined—
onAnimationStartAnimationEventHandler<HTMLInputElement> | undefined—
onAnimationStartCaptureAnimationEventHandler<HTMLInputElement> | undefined—
onAuxClickMouseEventHandler<HTMLInputElement> | undefined—
onAuxClickCaptureMouseEventHandler<HTMLInputElement> | undefined—
onBeforeInputInputEventHandler<HTMLInputElement> | undefined—
onBeforeInputCaptureInputEventHandler<HTMLInputElement> | undefined—
onBeforeToggleToggleEventHandler<HTMLInputElement> | undefined—
onBlurFocusEventHandler<HTMLInputElement> | undefined—
onBlurCaptureFocusEventHandler<HTMLInputElement> | undefined—
onCanPlayReactEventHandler<HTMLInputElement> | undefined—
onCanPlayCaptureReactEventHandler<HTMLInputElement> | undefined—
onCanPlayThroughReactEventHandler<HTMLInputElement> | undefined—
onCanPlayThroughCaptureReactEventHandler<HTMLInputElement> | undefined—
onChangeCaptureChangeEventHandler<HTMLInputElement, Element> | undefined—
onClickMouseEventHandler<HTMLInputElement> | undefined—
onClickCaptureMouseEventHandler<HTMLInputElement> | undefined—
onCompositionEndCompositionEventHandler<HTMLInputElement> | undefined—
onCompositionEndCaptureCompositionEventHandler<HTMLInputElement> | undefined—
onCompositionStartCompositionEventHandler<HTMLInputElement> | undefined—
onCompositionStartCaptureCompositionEventHandler<HTMLInputElement> | undefined—
onCompositionUpdateCompositionEventHandler<HTMLInputElement> | undefined—
onCompositionUpdateCaptureCompositionEventHandler<HTMLInputElement> | undefined—
onContextMenuMouseEventHandler<HTMLInputElement> | undefined—
onContextMenuCaptureMouseEventHandler<HTMLInputElement> | undefined—
onCopyClipboardEventHandler<HTMLInputElement> | undefined—
onCopyCaptureClipboardEventHandler<HTMLInputElement> | undefined—
onCutClipboardEventHandler<HTMLInputElement> | undefined—
onCutCaptureClipboardEventHandler<HTMLInputElement> | undefined—
onDoubleClickMouseEventHandler<HTMLInputElement> | undefined—
onDoubleClickCaptureMouseEventHandler<HTMLInputElement> | undefined—
onDragDragEventHandler<HTMLInputElement> | undefined—
onDragCaptureDragEventHandler<HTMLInputElement> | undefined—
onDragEndDragEventHandler<HTMLInputElement> | undefined—
onDragEndCaptureDragEventHandler<HTMLInputElement> | undefined—
onDragEnterDragEventHandler<HTMLInputElement> | undefined—
onDragEnterCaptureDragEventHandler<HTMLInputElement> | undefined—
onDragExitDragEventHandler<HTMLInputElement> | undefined—
onDragExitCaptureDragEventHandler<HTMLInputElement> | undefined—
onDragLeaveDragEventHandler<HTMLInputElement> | undefined—
onDragLeaveCaptureDragEventHandler<HTMLInputElement> | undefined—
onDragOverDragEventHandler<HTMLInputElement> | undefined—
onDragOverCaptureDragEventHandler<HTMLInputElement> | undefined—
onDragStartDragEventHandler<HTMLInputElement> | undefined—
onDragStartCaptureDragEventHandler<HTMLInputElement> | undefined—
onDropDragEventHandler<HTMLInputElement> | undefined—
onDropCaptureDragEventHandler<HTMLInputElement> | undefined—
onDurationChangeReactEventHandler<HTMLInputElement> | undefined—
onDurationChangeCaptureReactEventHandler<HTMLInputElement> | undefined—
onEmptiedReactEventHandler<HTMLInputElement> | undefined—
onEmptiedCaptureReactEventHandler<HTMLInputElement> | undefined—
onEncryptedReactEventHandler<HTMLInputElement> | undefined—
onEncryptedCaptureReactEventHandler<HTMLInputElement> | undefined—
onEndedReactEventHandler<HTMLInputElement> | undefined—
onEndedCaptureReactEventHandler<HTMLInputElement> | undefined—
onErrorReactEventHandler<HTMLInputElement> | undefined—
onErrorCaptureReactEventHandler<HTMLInputElement> | undefined—
onFocusFocusEventHandler<HTMLInputElement> | undefined—
onFocusCaptureFocusEventHandler<HTMLInputElement> | undefined—
onGotPointerCapturePointerEventHandler<HTMLInputElement> | undefined—
onGotPointerCaptureCapturePointerEventHandler<HTMLInputElement> | undefined—
onInputInputEventHandler<HTMLInputElement> | undefined—
onInputCaptureInputEventHandler<HTMLInputElement> | undefined—
onInvalidReactEventHandler<HTMLInputElement> | undefined—
onInvalidCaptureReactEventHandler<HTMLInputElement> | undefined—
onKeyDownKeyboardEventHandler<HTMLInputElement> | undefined—
onKeyDownCaptureKeyboardEventHandler<HTMLInputElement> | undefined—
onKeyPressKeyboardEventHandler<HTMLInputElement> | undefined—
onKeyPressCaptureKeyboardEventHandler<HTMLInputElement> | undefined—
onKeyUpKeyboardEventHandler<HTMLInputElement> | undefined—
onKeyUpCaptureKeyboardEventHandler<HTMLInputElement> | undefined—
onLoadReactEventHandler<HTMLInputElement> | undefined—
onLoadCaptureReactEventHandler<HTMLInputElement> | undefined—
onLoadedDataReactEventHandler<HTMLInputElement> | undefined—
onLoadedDataCaptureReactEventHandler<HTMLInputElement> | undefined—
onLoadedMetadataReactEventHandler<HTMLInputElement> | undefined—
onLoadedMetadataCaptureReactEventHandler<HTMLInputElement> | undefined—
onLoadStartReactEventHandler<HTMLInputElement> | undefined—
onLoadStartCaptureReactEventHandler<HTMLInputElement> | undefined—
onLostPointerCapturePointerEventHandler<HTMLInputElement> | undefined—
onLostPointerCaptureCapturePointerEventHandler<HTMLInputElement> | undefined—
onMouseDownMouseEventHandler<HTMLInputElement> | undefined—
onMouseDownCaptureMouseEventHandler<HTMLInputElement> | undefined—
onMouseEnterMouseEventHandler<HTMLInputElement> | undefined—
onMouseLeaveMouseEventHandler<HTMLInputElement> | undefined—
onMouseMoveMouseEventHandler<HTMLInputElement> | undefined—
onMouseMoveCaptureMouseEventHandler<HTMLInputElement> | undefined—
onMouseOutMouseEventHandler<HTMLInputElement> | undefined—
onMouseOutCaptureMouseEventHandler<HTMLInputElement> | undefined—
onMouseOverMouseEventHandler<HTMLInputElement> | undefined—
onMouseOverCaptureMouseEventHandler<HTMLInputElement> | undefined—
onMouseUpMouseEventHandler<HTMLInputElement> | undefined—
onMouseUpCaptureMouseEventHandler<HTMLInputElement> | undefined—
onPasteClipboardEventHandler<HTMLInputElement> | undefined—
onPasteCaptureClipboardEventHandler<HTMLInputElement> | undefined—
onPauseReactEventHandler<HTMLInputElement> | undefined—
onPauseCaptureReactEventHandler<HTMLInputElement> | undefined—
onPlayReactEventHandler<HTMLInputElement> | undefined—
onPlayCaptureReactEventHandler<HTMLInputElement> | undefined—
onPlayingReactEventHandler<HTMLInputElement> | undefined—
onPlayingCaptureReactEventHandler<HTMLInputElement> | undefined—
onPointerCancelPointerEventHandler<HTMLInputElement> | undefined—
onPointerCancelCapturePointerEventHandler<HTMLInputElement> | undefined—
onPointerDownPointerEventHandler<HTMLInputElement> | undefined—
onPointerDownCapturePointerEventHandler<HTMLInputElement> | undefined—
onPointerEnterPointerEventHandler<HTMLInputElement> | undefined—
onPointerLeavePointerEventHandler<HTMLInputElement> | undefined—
onPointerMovePointerEventHandler<HTMLInputElement> | undefined—
onPointerMoveCapturePointerEventHandler<HTMLInputElement> | undefined—
onPointerOutPointerEventHandler<HTMLInputElement> | undefined—
onPointerOutCapturePointerEventHandler<HTMLInputElement> | undefined—
onPointerOverPointerEventHandler<HTMLInputElement> | undefined—
onPointerOverCapturePointerEventHandler<HTMLInputElement> | undefined—
onPointerUpPointerEventHandler<HTMLInputElement> | undefined—
onPointerUpCapturePointerEventHandler<HTMLInputElement> | undefined—
onProgressReactEventHandler<HTMLInputElement> | undefined—
onProgressCaptureReactEventHandler<HTMLInputElement> | undefined—
onRateChangeReactEventHandler<HTMLInputElement> | undefined—
onRateChangeCaptureReactEventHandler<HTMLInputElement> | undefined—
onResetReactEventHandler<HTMLInputElement> | undefined—
onResetCaptureReactEventHandler<HTMLInputElement> | undefined—
onScrollUIEventHandler<HTMLInputElement> | undefined—
onScrollCaptureUIEventHandler<HTMLInputElement> | undefined—
onScrollEndUIEventHandler<HTMLInputElement> | undefined—
onScrollEndCaptureUIEventHandler<HTMLInputElement> | undefined—
onSeekedReactEventHandler<HTMLInputElement> | undefined—
onSeekedCaptureReactEventHandler<HTMLInputElement> | undefined—
onSeekingReactEventHandler<HTMLInputElement> | undefined—
onSeekingCaptureReactEventHandler<HTMLInputElement> | undefined—
onSelectReactEventHandler<HTMLInputElement> | undefined—
onSelectCaptureReactEventHandler<HTMLInputElement> | undefined—
onStalledReactEventHandler<HTMLInputElement> | undefined—
onStalledCaptureReactEventHandler<HTMLInputElement> | undefined—
onSubmitSubmitEventHandler<HTMLInputElement> | undefined—
onSubmitCaptureSubmitEventHandler<HTMLInputElement> | undefined—
onSuspendReactEventHandler<HTMLInputElement> | undefined—
onSuspendCaptureReactEventHandler<HTMLInputElement> | undefined—
onTimeUpdateReactEventHandler<HTMLInputElement> | undefined—
onTimeUpdateCaptureReactEventHandler<HTMLInputElement> | undefined—
onToggleToggleEventHandler<HTMLInputElement> | undefined—
onTouchCancelTouchEventHandler<HTMLInputElement> | undefined—
onTouchCancelCaptureTouchEventHandler<HTMLInputElement> | undefined—
onTouchEndTouchEventHandler<HTMLInputElement> | undefined—
onTouchEndCaptureTouchEventHandler<HTMLInputElement> | undefined—
onTouchMoveTouchEventHandler<HTMLInputElement> | undefined—
onTouchMoveCaptureTouchEventHandler<HTMLInputElement> | undefined—
onTouchStartTouchEventHandler<HTMLInputElement> | undefined—
onTouchStartCaptureTouchEventHandler<HTMLInputElement> | undefined—
onTransitionCancelTransitionEventHandler<HTMLInputElement> | undefined—
onTransitionCancelCaptureTransitionEventHandler<HTMLInputElement> | undefined—
onTransitionEndTransitionEventHandler<HTMLInputElement> | undefined—
onTransitionEndCaptureTransitionEventHandler<HTMLInputElement> | undefined—
onTransitionRunTransitionEventHandler<HTMLInputElement> | undefined—
onTransitionRunCaptureTransitionEventHandler<HTMLInputElement> | undefined—
onTransitionStartTransitionEventHandler<HTMLInputElement> | undefined—
onTransitionStartCaptureTransitionEventHandler<HTMLInputElement> | undefined—
onVolumeChangeReactEventHandler<HTMLInputElement> | undefined—
onVolumeChangeCaptureReactEventHandler<HTMLInputElement> | undefined—
onWaitingReactEventHandler<HTMLInputElement> | undefined—
onWaitingCaptureReactEventHandler<HTMLInputElement> | undefined—
onWheelWheelEventHandler<HTMLInputElement> | undefined—
onWheelCaptureWheelEventHandler<HTMLInputElement> | undefined—
partstring | undefined—
patternstring | undefined—
placeholderstring | undefined—
popover"" | "auto" | "manual" | "hint" | undefined—
popoverTargetstring | undefined—
popoverTargetAction"toggle" | "show" | "hide" | undefined—
prefixstring | undefined—
propertystring | undefined—
radioGroupstring | undefined—
readOnlyboolean | undefined—
refRef<HTMLInputElement> | undefined

Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).

—
relstring | undefined—
requiredboolean | undefined—
resourcestring | undefined—
resultsnumber | undefined—
revstring | undefined—
roleAriaRole | undefined—
securitystring | undefined—
slotstring | undefined—
spellCheckBooleanish | undefined—
srcstring | undefined—
stepstring | number | undefined—
styleCSSProperties | undefined—
suppressContentEditableWarningboolean | undefined—
suppressHydrationWarningboolean | undefined—
tabIndexnumber | undefined—
titlestring | undefined—
translate"yes" | "no" | undefined—
typeHTMLInputTypeAttribute | undefined—
typeofstring | undefined—
unselectable"off" | "on" | undefined—
vocabstring | undefined—
widthstring | number | undefined—

AutocompleteOption

AutocompleteOption public properties
PropTypeDefault
idRequiredstring—
labelRequiredstring—
descriptionstring | undefined—
disabledboolean | undefined—
groupstring | undefined—
searchTermsreadonly string[] | undefined—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.