Command Palette
Search for a command to run...
Autocomplete
Text input with searchable dropdown suggestionsAbout Autocomplete
A text input component that displays filtered options or fetched results in a dropdown. Supports static local options with client-side filtering, and remote server-side fetching with debouncing. Can operate in controlled or uncontrolled modes.Installation
Import the Autocomplete component from LSD:import { Autocomplete } from '@nipsys/lsd'
export default function MyComponent() {
return <Autocomplete />
}Usage
The simplest form of the component with default styling.Basic
Variants
Component variants for different visual styles and use cases.Ghost
Outlined
Underlined
Sizes
Component sizes for different contexts and visual hierarchy.Sizes
Features
Additional features and capabilities of the component.Clearable
Disabled
Error
Icon
API Reference
Autocomplete
options
Array of options for client-side filtering.
Type:
AutocompleteOption[]onOptionsFetch
Fetches options asynchronously based on search text.
Type:
(searchText: string) => Promise<AutocompleteOption[]>placeholder
Placeholder text displayed when no value is selected.
Type:
stringemptyText
Text displayed when no options match the search.
Type:
stringloadingText
Text displayed while options are being fetched.
Type:
stringclassName
Optional className for custom styling.
Type:
stringonValueChange
Callback fired when the selected value changes.
Type:
(value: string) => voidonClear
Callback fired when the clear button is clicked.
Type:
() => voiddisabled
Disables the autocomplete input.
Type:
booleanlabel
Label shown above the input field.
Type:
stringsize
Size of the autocomplete component.
Type:
SizeVarianticon
Icon element displayed at the end of the input.
Type:
React.ReactNodeerror
Displays the input in error state.
Type:
booleanvariant
Visual style variant for the input border.
Type:
BorderVariantclearable
Shows a clear button when a value is selected.
Type:
booleanvalue
Currently selected value string for controlled mode.
Type:
stringisLoading
External loading state override for async fetching.
Type:
booleanAccessibility
The component follows accessibility best practices for screen readers and keyboard navigation.Keyboard Navigation
Keyboard shortcuts and navigation
• Tab - Navigate to the autocomplete input• ArrowDown - Open dropdown and move to first option• ArrowUp - Move to previous option in dropdown• Enter - Select the highlighted option• Escape - Close dropdown without selecting
ARIA Attributes
Proper ARIA attributes for screen readers
• role="combobox" is managed by Radix Popover• aria-expanded indicates dropdown open state• aria-controls links input to dropdown content• aria-activedescendant identifies selected option
Focus States
Visible focus indicators for keyboard users
• Focus managed by Radix Popover component. First option receives focus when dropdown opens. Focus returns to input when option selected or dropdown closes. Clicking outside closes dropdown and returns focus to input.