Text Field
wrapper component comes with two themes: light (default) and dark.Example
<TextField theme="light" />;
<TextField theme="dark"/>;
Theme
prop enables the ability to change the style of the Text Field to dark or light. By default this is set to light.OnChange
prop takes a callback function.event
object is provided as an argument to the callback function which provides access to various properties on regarding the Text Field. To access this event object properties, you can useevent.currentTarget
.color
prop enables the ability to change the color of the display text within the Text Field when typed.width
is set to15
and the default height is set to3
. Unlike thepixels(px)
on a screen, these number represents the size and dimensions of the rendered 3D component on the canvas.width
orheight
. The current dimensions are optimized to fill the canvas. The maximum height allowed is5
.Position
prop allows the ability to change the X, Y, and Z properties of the Text Field. This prop accepts an Array of 3 values,[X, Y, Z]
. By default the position is set to[0,0,0]
.backgroundColor
prop enables the ability to change the background color of the text field. This effect is currently only supported when a color code is provided for thebackgroundColor
prop (e.g.backgroundColor=”#F4FAFF”
). This will be updated soon to support all color declarations (e.g.backgroundColor=”red”
).backgroundColor
will automatically darkenonFocus
to for an improved UI experience.font
prop. The default font is set toRoboto
. Unlike your typical text field, this 3D Text Field requires access to the font.ttf
file. To properly change the font, it is recommended that you upload the ..ttf
font file into afont
directory on your project’s root and pass the path to thefont
prop. (e.g.font=”fonts/Inter-Bold.ttf”
).fontSize
prop allows you to change the size of the 3D font on the Text Field. Similarly to theheight
andwidth
props, thefontSize
represents the size and dimensions of the rendered 3D text on the canvas. The default fontSize is set to1
.Example
import { Canvas } from "@react-three/fiber";
import { TextField } from "r3dy";
export default function App() {
return (
<Canvas>
<TextField />
</Canvas>
);
}