Textarea

Custom Textarea component.

Installation

Copy the following code into your app directory.

uv

buridan add component textarea
Usage
from components.ui.textarea import Textarea
Anatomy

Use the following composition to build a Textarea

textarea()
Examples
Basic Demo

A standard multiline text area for general text input.

from components.ui.textarea import textarea


def textarea_basic_demo():
    return textarea(placeholder="Type your message here.")
Field

Use field.root, field.label, and field.description together with a form control (such as textarea) to build a structured field with a label and helper text.

Enter your message below.

from components.ui.field import field
from components.ui.textarea import textarea


def textarea_field():
    return field.root(
        field.label(
            "Message",
            html_for="textarea-message",
        ),
        field.description(
            "Enter your message below.",
        ),
        textarea(
            id="textarea-message",
            placeholder="Type your message here.",
        ),
    )
Disabled

Use the disabled prop on textarea to disable user input. Apply data-disabled on field.root to propagate disabled styling to all field-related elements and ensure consistent visual state handling.

from components.ui.field import field
from components.ui.textarea import textarea


def textarea_disabled():
    return field.root(
        field.label(
            "Message",
            html_for="textarea-disabled",
        ),
        textarea(
            id="textarea-disabled",
            placeholder="Type your message here.",
            disabled=True,
        ),
        **{"data-disabled": True},
    )
Invalid

Apply data-disabled on Field to represent a disabled state and propagate styling, and apply data-invalid to represent validation errors.

Please enter a valid message.

from components.ui.field import field
from components.ui.textarea import textarea


def textarea_invalid():
    return field.root(
        field.label(
            "Message",
            html_for="textarea-invalid",
        ),
        textarea(
            id="textarea-invalid",
            placeholder="Type your message here.",
            **{"aria-invalid": True},
        ),
        field.description(
            "Please enter a valid message.",
        ),
        **{"data-invalid": True},
    )