Skip to content

<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 ​

PropTypeDefaultDescription
uiRecord<string, unknown>{}Escape hatch: raw uikit (@pmndrs/uikit) properties, merged last.
partsPartial<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).
modelValuestringundefinedText 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.
digitsbooleantrueA row of digits on top.
symbolsbooleantrueA ?123 key for a page of symbols.
spaceLabelbooleantrueShow the layout's name on the space bar.
enterLabelstring'↵'Label of the Enter key, e.g. "Send" or "Go".
voiceboolean | XrSpeechRecognizertrueA 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.
preferSystemKeyboardbooleantrueHide 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.
distancenumberOnly for a root keyboard: reading distance in metres.
layoutnumberIndex into layouts of the active layout (v-model:layout). Uncontrolled if left out.
keySizenumberWidth and height of one letter key in dmm. Defaults to the theme's minimum target.

Events ​

EventPayloadDescription
keykey: stringA key was typed: the character, or Backspace / Enter.
update:modelValuevalue: stringThe edited text, with v-model only.
update:layoutindex: numberThe active layout changed (the layout key or a tab): its index in layouts (v-model:layout).
enterEnter was pressed.
voiceErrorerror: stringVoice input failed, e.g. "not-allowed" (no microphone permission) or "network".

MIT License