Components inputs

Autocomplete

Searchable combobox input with keyboard navigation (arrow keys + Enter), a filtered dropdown, and optional free‑text entry. It can use static options or load options dynamically from queries. Suitable when users must search or filter from many options (10 +). For fewer than 10 fixed options, use a Dropdown instead.

已更新 Mar 6, 2026

Autocomplete

Searchable combobox input with keyboard navigation (arrow keys + Enter), a filtered dropdown, and optional free‑text entry. It can use static options or load options dynamically from queries. Suitable when users must search or filter from many options (10 +). For fewer than 10 fixed options, use a Dropdown instead.

Use Cases

  • Country/state selection from lookup table (200 + items)
  • Customer or contact search from database
  • Product search within a category
  • User/employee lookup by name
  • Category selection from large taxonomy
  • Any entity lookup where the user needs to search and select

Properties

name

Field name for form submission. Type: string. Required.

label

Label displayed above the input. Type: string.

placeholder

Placeholder text when empty. Type: string. Default: Search...

optionsQuery

Load autocomplete options dynamically from a list query (e.g., Customers, Products, Countries). Takes precedence over static options array. Type: object.

Tip: Use optionsQuery for entity lookups (Customers, Products, Countries) where options come from a database. Do not use for tiny fixed lists – use static options instead.

Sub‑properties:

  • query – Name of list query defined in root.props.queries. Type: string. Required.
  • valueField – Field from query records to use as option value. Type: string. Required.
  • labelField – Field from query records to use as option display label. Type: string. Required.

options

Static array of options (fallback if optionsQuery not defined). Each option has a value and label. Type: array.

required

Whether selection is required. Type: boolean. Default: false.

allowFreeText

When true, accepts values not in options list. When false, only predefined values are valid. Type: boolean. Default: false.

binding

Query‑centric data binding to store selected value. SEPARATE from optionsQuery – binding stores the SELECTED VALUE, optionsQuery loads the OPTION LIST. Type: object.

Sub‑properties:

  • query – Name of query to bind to. Type: string. Required.
  • field – Field name to store selected value. Type: string. Required.
  • isReadOnly – Indicates if the bound field is read‑only. Type: boolean. Default: false.

customCss

Custom CSS styles. Type: string.

Best Practices

  • Use Autocomplete when there are 10 + options – Dropdown is better for fewer.
  • Use optionsQuery for lookup tables (Customers, Products, Countries) – loads from database dynamically.
  • Use static options array ONLY for small fixed lists that don’t come from a database.
  • CRITICAL: binding (value storage) is INDEPENDENT from optionsQuery (option list loading).
  • Write a descriptive placeholder: ‘Search customers…’ not just ‘Search’.
  • Set allowFreeText: true when users might need to enter values not in the list.
  • Set allowFreeText: false when only predefined values are valid (e.g., countries).

Common Mistakes

Using Autocomplete with only 3-5 options

Why it's a problem: For few options, a Dropdown is simpler and more intuitive.

Fix: Use Dropdown for under 10 options. Use Autocomplete for 10 + options where search is valuable.

Hardcoding 200 + options in static array instead of using optionsQuery

Why it's a problem: Bloats the page data and options can’t update when database changes.

Fix: Create a list query for the lookup table and use optionsQuery to reference it.

标签

autocomplete form country/state selection customer or product search

相关组件

准备好构建了吗?

使用 Qödiak 免费开始创建您的应用。

免费开始

相关文章

AnimatedGradient

Smooth animated gradient background for modern, premium aesthetics. Supports linear and radial gradients with configurable colors, animation speed, and intensity. GPU‑accelerated for smooth 60fps performance.

Button

Interactive button component that supports link navigation, page data source operations (record navigation, new record, mode switching), form submission, and custom JavaScript execution. Save/Delete actions must use a custom‑script with navigation. Two visual variants are available, and the button can be enabled or disabled dynamically based on data context.

Calendar

A full‑featured calendar component built with react‑big‑calendar. It can display events in month, week, day, or agenda views and includes navigation and view‑switching capabilities, making it suitable for any site that needs scheduling, event management, or date visualization.

Card

Feature card component with an icon, title, description, and entrance animations. Ideal for showcasing features, services, or benefits in grid layouts with animation support.

Checkbox

A checkbox group component that lets users select multiple options from a predefined list. It renders a set of checkboxes with individual labels and can be arranged vertically or horizontally.

CountdownTimer

Real-time countdown timer component that displays the time remaining until a target date/time. It updates every second, offers customizable formatting, and shows a completion message when the countdown ends. Suitable for any site type.