Skip to content

Combobox

Beta
Get Ritla UI

A searchable select that matches Arabic the way people type it: احمد finds أحمد, with the matched letters in bold.

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add combobox

    Also works with shadcn: npx shadcn@latest add @ritla/combobox

  2. Or copy by hand

    Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.

Usage

combobox.tsx
import { Combobox } from "@/components/ui/combobox";<Combobox label="Customer" options={customers} onValueChange={setCustomer} />

API reference

Combobox

PropTypeDefaultDescription
options{ value, label, description?, disabled? }[]NoneThe options; description is a second line that tells two matches apart.
value / defaultValue / onValueChangestring | nullNoneThe chosen value.
label / required / helperText / error / disabledFieldPropsNoneAs on the Input field.
noteReactNode | nullNoneThe footer note on how matching works; null hides it.
emptyText(query) => ReactNodeNoneWhat to say when nothing matches.
matchArabic / normalizeArabic(text, query) => [start, end] | nullNoneThe matching helpers, for any other search.

Accessibility

Keyboard

Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.

KeyAction
ArrowDownArrowUpOpens the list and moves between options.
EnterChooses the highlighted option.
EscapeCloses the list.

ARIA

  • The field is a combobox and the list a listbox, named by the label.
  • The bold match is visual only; the whole option is read.

Arabic and RTL notes

Mirrors

  • The field, list and footer mirror, with the city at the end of the row on the left.

Does not mirror

  • Names are data and keep their own direction: an Arabic name stays Arabic in the English layout.
Numerals
It usually holds no numbers.
Arabic typography
body-16 for the option with the match in Semibold; label-12 for the second line and the footer.
Mixed-direction text
The no-results sentence isolates the query, so its direction holds inside the sentence.