shadcn.io is not affiliated with official shadcn/ui
Input Group examples · Custom
Textarea with Toolbar Input Group for React
A textarea with bold, italic and underline buttons above it and a Submit button under it.
A light formatting toolbar for a plain textarea. Three ghost icon buttons sit in a block-start addon with a bottom border, and Submit sits in a block-end addon. The buttons only show the layout: formatting needs your own editor logic.
Preview
Installation
FAQ
How do the format buttons sit above the text?
They share one InputGroupAddon with align="block-start" and border-b, which becomes a header row with a divider.
How are the icon buttons named?
Each InputGroupButton has an aria-label: Bold, Italic and Underline. The icons are aria-hidden.
Do the buttons format the text?
No. A textarea holds plain text, so they'd insert Markdown around the selection, or you'd switch to a rich text editor.
How do I show which formats are on?
Use a Toggle Group for the buttons, which tracks the pressed state for you.
Related
- Textarea with Actions Input GroupA message textarea with a Submit button
- Textarea with Counter Input GroupA message textarea with a 500-character
- Multiple Action Buttons Input GroupA read-only link with an info button and
- AI Prompt Input Input GroupAn AI prompt box with a mode menu, a
- Password Actions Input GroupA password input with a show/hide button
- Input with LabelA text input with a label above it