vn/ui / Docs / Components

Vietnamese Search

Match Vietnamese text with or without accents.

Preview

  • Đà Nẵng
  • Đà Lạt

The Code tab uses the common @/* alias. Import the copied file from the directory in vnui.json if your app uses a different path.

Installation

Initialize vn/ui in your app, then add this component.

npx @naminc/vnui@latest add vietnamese-search

Usage and variants

Search uses Unicode decomposition, case folding and the đ/d mapping. Highlights preserve the original accents. Fuzzy matching accepts an ordered subsequence.

<VietnameseSearch items={["Đà Nẵng", "Hồ Chí Minh"]} fuzzy />

API

PropTypeBehavior
value, defaultValuestringControlled value or initial uncontrolled value.
onValueChange(value) => voidReceives the next value; connect it to form state or React Hook Form Controller.
label, name, disabled, classNamestring, string, boolean, stringVisible label, form name, disabled state and CSS class.
itemsreadonly string[]Strings to search.
fuzzybooleanAllow ordered subsequences.

Use value and onValueChange for controlled fields, including React Hook Form Controller. Use defaultValue for standalone fields. label, name, disabled and className customize the field.

Accessibility

Fields have visible labels and keyboard focus. Searchable selectors support typing, arrow keys, Enter and Escape; date controls use browser keyboard behavior.

No matches is announced as a status. Matching characters are highlighted while the original Vietnamese accents remain visible.