Textarea
Displays a multi-line text input field.
Usage
import { Textarea } from "@uj-vilag/dap-components";
export default function TextareaExample() {
return (
<div>
<Textarea
placeholder="Enter text here"
rootClassName="max-h-72 min-h-40"
/>
</div>
);
}Props
This component renders a <textarea> element wrapped in a <div>, so all native textarea props are supported.
Prop
Type
Examples
Sizes
import { Textarea } from "@uj-vilag/dap-components";
export default function TextareaSizesExample() {
return (
<div className="flex flex-col gap-8">
<Textarea
size="large"
placeholder="Large size"
rootClassName="max-h-72"
/>
<Textarea
size="small"
placeholder="Small size"
rootClassName="max-h-72"
/>
</div>
);
}Error
import { Textarea } from "@uj-vilag/dap-components";
export default function TextareaErrorExample() {
return (
<div className="p-28 py-32">
<Textarea error placeholder="Error state" rootClassName="max-h-50" />
</div>
);
}Disabled & Readonly
import { Textarea } from "@uj-vilag/dap-components";
export default function TextareaDisabledReadonlyExample() {
return (
<div className="flex flex-col gap-8">
<Textarea
disabled
placeholder="Disabled state"
rootClassName="max-h-50"
/>
<Textarea
readOnly
placeholder="Readonly state"
rootClassName="max-h-50"
/>
</div>
);
}With Label & Feedback
Provide a detailed description of the issue.
Description must be at least 50 characters long.
import { Textarea, Label, Feedback } from "@uj-vilag/dap-components";
export default function TextareaWithLabelFeedbackExample() {
return (
<div className="p-28 flex flex-col gap-8">
<Label
labelText="Description"
requirement="required"
htmlFor="description-input"
helperText="Provide a detailed description of the issue."
>
<Textarea
id="description-input"
placeholder="Describe the issue you're experiencing..."
rootClassName="max-h-50"
aria-describedby="description-feedback description-input-helperText"
error
/>
<Feedback
message="Description must be at least 50 characters long."
id="description-feedback"
/>
</Label>
</div>
);
}