# Typeahead > Add typeahead to a list or menu so typing a label focuses its item, with prefix matching, repeated-character cycling and accent handling. Create a typeahead handler to focus items by typing their labels. In this list, S focuses _Spanish_ and W immediately after it focuses _Swedish_. After a 500 ms pause, the next character starts a new prefix. ```html ``` ```ts import { createTypeahead, keyRove } from '@mixedrays/keyrove'; const typeahead = createTypeahead(); document .querySelector('#languages') .addEventListener('keydown', (e) => keyRove(e) || typeahead(e)); ``` Call `keyRove` first so navigation bindings take precedence. It returns `null` for an unhandled key, letting `typeahead` process it. For example, a `KeyJ` navigation binding moves focus instead of adding J to the prefix. ## Why a factory The returned handler stores the prefix and the time of the last character. Create it once per listener, outside the keydown callback. It checks the time on each press, so there is no timer to clean up. Set `resetMs` to change the pause that clears the prefix: ```ts const typeahead = createTypeahead({ resetMs: 800 }); ``` ## Cycling repeated characters Prefix matching is the default: pressing S twice looks for a label starting with `ss`, and every prefix matches from the top of the list. A menu can instead cycle through the items sharing one initial character, the way a native `