Skip to main content

<input>

Enables user text input.

Props

PropTypeDescriptionDefault
widthNumberWidth of the image. See notes for more info. Optional.
colorStringColor of the canvas while image is loading.white
positionArrayPosition of the image.[0,0,0]
rotationArrayRotation of the image.[0,0,0]
onPointerDownFunctionCalled when avatar presses the pointer down over this object.
hitDistanceNumberMaximum distance to interact with this node.infinity
bgColorStringBackground color of the input.0xffffff
bgRadiusNumberBorder radius of the input.0.05
paddingNumberPadding of the input.0.1
fontSizeNumberFont size of the input.0.2
placeholderStringPlaceholder text to display when the input is empty.
valueStringValue of the input.
onChangeFunctionCalled when the input value changes. Provides the new value.
onEnterFunctionCalled when the user presses the enter key. Provides the new value.

Notes

  • There is currently no keyboard support for on VR devices.

Example

export default function App() {
const [value, setValue] = useState(null);

return (
<app>
<input
placeholder="Enter code"
bgColor="black"
color="white"
width={1.5}
value={value}
onChange={setValue}
onEnter={() => console.log("this is the value", value)}
/>
</app>
);
}