Skip to main content

Textarea

The TkTextarea component enables multi-line text input with customizable size, validation, and styling options.

import { TkTextarea } from '@takeoff-ui/react'

Basic​

A simple TkInput display.

View Code
<TkTextarea
label="Textarea"
hint="Hint text"
placeholder="Placeholder text"
/>

Size​

The "size" prop can be used with one of the sizes "small", "base", and "large". The default value is "base".

View Code
<TkTextarea
label="Small Textarea"
size="small"
/>
<TkTextarea
label="Base Textarea"
size="base"
/>
<TkTextarea
label="Large Textarea"
size="large"
/>

State​

This example illustrates the disabled, readonly, and invalid states of the input field. Each state demonstrates how the input behaves and visually changes in different interaction scenarios.

View Code
<TkTextarea
label="Error"
placeholder="Error"
invalid={true}
error="Bu alan zorunludur"
/>
<TkTextarea
label="Readonly"
placeholder="Readonly"
readonly
/>
<TkTextarea
label="Disabled"
placeholder="Disabled"
disabled
/>

API​

Props​

NameTypeDefaultDescription
booleanfalseIf true, the user cannot interact with the input.
stringnullThis is the error message that will be displayed.
stringnullProvided a hint or additional information about the input.
booleanfalseIndicates whether the input is in an invalid state
stringnullDefines the label for the element.
numbernullLimits the number of characters.
stringnullThe name of the control, which is submitted with the form data.
stringnullPlaceholder text displayed when the input is empty.
booleanfalseIf true, the user cannot modify the value.
number3Represents the rows value of the component
booleanfalseDisplays a red asterisk (*) next to the label for visual emphasis.
"base", "large", "small"'base'Sets size for the component.
number, string''The value of the input.

Events​

NameDescription
tk-blurEmitted when the input loses focus.
tk-changeEmitted when the value has changed.
tk-focusEmitted when the input has focus.
tk-inputEmitted when a keyboard input occurred.

Methods​

NameDescription
setFocusSets focus on the specified tk-input. Use this method instead of the global input.focus().