Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Rich Text Toolbar Input Group for Svelte

A textarea with Bold, Italic, Underline, Link, and List buttons in a toolbar that sits above it.

UI library: Ark UI

Five ghost icon buttons sit in a row above a textarea: Bold, Italic, Underline, Link, and List. They show the layout of a formatting bar. Pressing them does not change the text.

Use it as the shell of a composer, then wire the buttons to your editor. If a format should stay on, start from a Toggle Group. In Svelte, Ark UI does not format the textarea.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Input Group anatomy: root, addon, input, text, button

Usage

<InputGroup class="w-full max-w-sm bg-background"><InputGroupTextarea aria-label="Content" class="min-h-[150px]" placeholder="Write your content..." /><InputGroupAddon align="block-start" class="border-b"><InputGroupButton aria-label="Bold" size="icon-xs" variant="ghost"><BoldIcon aria-hidden="true" /></InputGroupButton><InputGroupButton aria-label="Italic" size="icon-xs" variant="ghost"><ItalicIcon aria-hidden="true" /></InputGroupButton><InputGroupButton aria-label="Underline" size="icon-xs" variant="ghost"><UnderlineIcon aria-hidden="true" /></InputGroupButton><InputGroupButton aria-label="Link" size="icon-xs" variant="ghost"><LinkIcon aria-hidden="true" /></InputGroupButton><InputGroupButton aria-label="List" size="icon-xs" variant="ghost"><ListIcon aria-hidden="true" /></InputGroupButton></InputGroupAddon></InputGroup>

FAQ

How is the toolbar placed above the text?

An InputGroupAddon with align="block-start" and border-b, written after the textarea.

How are the buttons named?

Each InputGroupButton has an aria-label; the icons are aria-hidden.

Do the buttons format the text?

No. A textarea holds plain text: insert Markdown around the selection, or use a rich text editor in the frame.

How do I show active formats?

Use a Toggle Group with multiple selection for the format buttons, which tracks which are on.

Should the row be a toolbar for screen readers?

With five or more buttons, role="toolbar" and arrow-key movement between them make it quicker to use. The demo keeps them as plain buttons in the tab order.

How is the textarea labeled?

aria-label="Content".

API Reference

Input Group

Sets aria-label="Content", placeholder="Write your content...", align="block-start", aria-label="Bold", size="icon-xs" and variant="ghost". The rest is on the Input Group page.