Tailwind CSS Textarea
Build Tailwind CSS textarea components with labels, placeholders, floating labels, helper text, auto-resizing, modal layouts, chat composer, and validation.
Heads up!
By default Preline UI uses Tailwind CSS Forms plugin. Don't forget to install it!
Textarea with placeholder
Use placeholder text to provide lightweight guidance inside the textarea.
Textarea with label
Pair the textarea with a visible label for clear form context.
Hidden label textarea
Hide the <label> visually with .sr-only while keeping it available to screen readers.
Default textarea
Default textarea styling with padding, rounded corners, and a border.
Stone style textarea
Apply the stone surface style for a softer, filled textarea look.
Underlined textarea
Use an underline-only field style for a lighter textarea treatment.
Floating label
A placeholder is required on each <textarea> because this pattern relies on the :placeholder-shown pseudo-class. Keep the <textarea> before the label so the sibling selector (~) can control the floating state.
Autoheight with default height
Set data-hs-default-height="*" to start from a custom height while still letting the textarea grow automatically. Keep the rows="1" attribute in place as well.
Textarea sizes
Preview textarea sizes from small to large.
Read-only textarea
Add the readonly attribute to prevent edits while keeping the textarea value visible and selectable.
Disabled textarea
Add the disabled attribute to remove interaction and keep the textarea out of the tab order.
Textarea with helper text
Add helper text below the textarea for extra instructions or context.
We'll get back to you soon.
We'll get back to you soon.
Textarea with corner hint
Place a hint in the corner for character limits, counts, or secondary guidance.
Auto-resizing textarea
Automatically expand the textarea to fit its content as the user types.
Textarea in modal
Use the textarea pattern inside modal content without changing its behavior.
Chat composer
A richer chat-style textarea layout with inline actions and a message toolbar.
Validation states
Show valid and invalid textarea states with supporting feedback using HTML form validation.
Your message should be at least 10 characters long.
Looks good!
Your message should be at least 10 characters long.
Looks good!
Destroy and reinitialize
Use the destroy method to remove textarea autoheight behavior before reinitializing it.