Back to components
ElementForm & InputFree

Input Group React component

Joins an input with text addons, icons, a select or a button into one field with one border and one focus ring: https:// and .com around a subdomain with a live availability tick, a price with a currency picker, a search with a shortcut, an invite with a send button.

About the Input Group component

Input Group joins a text field with the things attached to it, such as a prefix like https://, a suffix like .com, a currency select or a button, into one bordered field. The whole frame lights up with one focus ring when anything inside it has focus, and dividers between the parts line up on their own.

It is built from small pieces placed inside InputGroup: InputGroupAddon for static text or an icon (plain drops its shaded background), InputGroupInput for a regular input that takes every native input prop, InputGroupSelect for a short list of options with a hidden label, and InputGroupButton for an action that can switch to a done state with doneLabel. InputGroup sets size (sm, md or lg) and error, which turns the frame red and shows the message under it as an alert.

When to use it

Use Input Group when an input needs context or an action attached to it: URL and domain fields, prices with currency, units (kg, px, %), search with a shortcut, newsletter and invite fields with their button.

Keep addons short; labels still belong outside the group (or as aria-label on the input).

Installation

Add the Input Group component to your project with the shadcn CLI. It lands in components/input-group.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/input-group

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

More Form & Input components

Masked Input
Free
Floating Label Input
Free
Knob
Free
Content Switch
Free
Listbox
Free
Variant Swatches
Free