Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Input Group examples · Dropdown

Textarea with Dropdown Input Group for React

A message textarea with a Format menu and a Send button under it.

Framework
UI library

A composer that asks for the format of what's written: under the textarea, a Format Dropdown Menu offers Plain Text, Markdown and HTML, and Send sits at the end. The row is a block-end addon with a top border.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How is the bottom row built?

One InputGroupAddon with align="block-end" and border-t, after the textarea. It holds the Format menu and the Send button, which ms-auto pushes to the end.

How is the Format button wired to the menu?

An InputGroupButton with size="sm" and a small chevron. DropdownMenuTrigger renders the InputGroupButton through render.

Where does the menu open?

Below the button, aligned to its start. align="start" on DropdownMenuContent place it.

Does picking Markdown change anything?

No. Store the format in state, show it in the trigger and use it when you render the message.

What draws the line above the row?

border-t on the addon. The group adds matching padding to bordered addons.

How is the textarea labeled?

With aria-label="Message", since there's no visible label.