forms
Tailwind CSS
Textarea A textarea is a multi-line text input field that allows users to enter longer text.
Basic textarea example.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Basic textarea with placeholder.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
The textarea-floating
style is used to define the appearance of the textarea, while the textarea-floating-label
is the container for the label text. To handle cases where the content exceeds the initial size, we applied the field-sizing: content;
CSS rule, allowing the textarea to expand when the content exceeds the set maximum height of 5rem
(m-h-20
).
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
The textarea-filled
style is applied to the textarea, with textarea-filled-label
for the label and textarea-filled-focused
for focus animations. The textarea auto-expands beyond a 5rem
max height using field-sizing: content;
.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Success state can be show using is-valid
class.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Full Name
Top Right label
Bottom Left label
Bottom Right label
Top Right label
Your bio
Bottom Left label
Bottom Right label
Top Right label
Your bio
Bottom Left label
Bottom Right label
Error state can be show using is-invalid
class.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Full Name
Top Right label
Bottom Left label
Bottom Right label
Top Right label
Your bio
Bottom Left label
Bottom Right label
Top Right label
Your bio
Bottom Left label
Bottom Right label
label
elements hidden using the .sr-only class.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Add the disabled
boolean attribute on an textarea to remove pointer events, and prevent focusing.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Your bio
Your bio
Your bio
Add the readonly
boolean attribute on an textarea to prevent modification of the textarea value.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Basic textarea example with helper text and hints.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Full Name
Top Right label
Bottom Left label
Bottom Right label