<XrKeyboard>
An on-screen keyboard with built-in and custom layouts, digits, a symbols page, shift and caps lock, and a microphone key for voice input. It types into the last focused <XrTextField>, or edits its own v-model. On Meta Quest, where the headset's own keyboard opens for a focused field, it hides itself (preferSystemKeyboard). See Text and voice input.
Usage
vue
<XrKeyboard v-model:layout="language" :layouts="['en', 'ru', 'de']" enter-label="Send" />API
Props
| Prop | Type | Default | Description |
|---|---|---|---|
ui | Record<string, unknown> | {} | Escape hatch: raw uikit (@pmndrs/uikit) properties, merged last. |
parts | Partial<Record<KeyPart, Record<string, unknown>>> | Raw uikit properties per inner part, merged after the defaults: key (every key), accent (Enter and active Shift or mic, after key), label (key text). | |
modelValue | string | undefined | Text the keyboard edits by itself (v-model). Leave it out to type into the last focused XrTextField. |
layouts | (XrKeyboardLayout | "en" | "ru" | "uk" | "de" | "fr" | "es")[] | ['en', 'ru'] | Built-in layout names (en, ru, uk, de, fr, es) and/or your own layouts. |
digits | boolean | true | A row of digits on top. |
symbols | boolean | true | A ?123 key for a page of symbols. |
spaceLabel | boolean | true | Show the layout's name on the space bar. |
enterLabel | string | '↵' | Label of the Enter key, e.g. "Send" or "Go". |
voice | boolean | XrSpeechRecognizer | true | A microphone key for voice input in the active layout's language. true: the browser's Web Speech API (the key is hidden where there is none). Pass a recognizer for your own speech to text, e.g. recordingRecognizer(transcribe). false hides the key. |
preferSystemKeyboard | boolean | true | Hide while the XR session has a system keyboard (Meta Quest Browser), which opens by itself when a text field is focused. Only applies without v-model: a keyboard bound to a string is the only way to edit it. |
distance | number | Only for a root keyboard: reading distance in metres. | |
layout | number | Index into layouts of the active layout (v-model:layout). Uncontrolled if left out. | |
keySize | number | Width and height of one letter key in dmm. Defaults to the theme's minimum target. |
Events
| Event | Payload | Description |
|---|---|---|
key | key: string | A key was typed: the character, or Backspace / Enter. |
update:modelValue | value: string | The edited text, with v-model only. |
update:layout | index: number | The active layout changed (the layout key or a tab): its index in layouts (v-model:layout). |
enter | Enter was pressed. | |
voiceError | error: string | Voice input failed, e.g. "not-allowed" (no microphone permission) or "network". |