Skip to content
Playground

Input Group

Inputs and textareas with aligned icons, helper content, and actions.

Use Input Group to combine a text input or textarea with icons, text, keyboard hints, and actions inside one surface. Wrap it in Field when the control needs a visible label, description, or validation message.

https://
TSX
import { InputGroup } from "@zentara-co/zenos-ui";

Set align on an addon to position it independently of DOM order:

  • inline-start: before the input, or on its right in RTL.
  • inline-end: after the input, or on its left in RTL.
  • block-start: a full-width header above the control.
  • block-end: a full-width footer below the control.

For new compositions, put the input or textarea first in the DOM, followed by addons. CSS alignment changes visual placement while keyboard focus still reaches the input before addon buttons. Clicking non-interactive addon content focuses the control; buttons, links, and other interactive content keep their own behavior.

Omitting align preserves existing DOM-order placement. InputGroup.Control remains the same input component as InputGroup.Input. Place interactive actions inside an aligned InputGroup.Addon using InputGroup.Button.

Use InputGroup.Textarea for a multiline control with a correctly typed textarea ref, native rows, maxLength, and form props. The group grows to fit a textarea or block-aligned addons instead of retaining a fixed single-line height.

Place header and footer content in block-aligned addons. InputGroup.Text works for filenames, units, or character counts, and compact InputGroup.Button actions fit inside the addon. The example keeps value state local and sends the message through an explicit callback.

Workspace support
0/280

Share up to 280 characters.

No message sent.

Addons accept arbitrary React content, including icons, Kbd, tooltips, menus, and status indicators. Label icon-only actions and hide decorative icons from assistive technology.

InputGroup.Button supports Button’s variants, sm | md | lg sizes, loading state, and native props. It defaults to a compact sm ghost button with type="button"; set type="submit" deliberately in a form. Use a trigger’s render prop to compose a menu or tooltip with the grouped button rather than nesting buttons. Its own render prop also supports button-compatible custom controls.

Choose default, filled, or none to match nearby Inputs. Input Group uses the same corner radius, border, fill, hover treatment, typography, and size scale as Input. The root owns the border and background; nested controls stay chromeless, including when disabled or invalid. Inline addons share the control’s outer padding with a compact gap before the text. Variants describe the surface, independently of the field’s state.

Use native control props and Field.Root to express state rather than changing the group’s variant:

  • Default: editable and focusable. Focusing the input or textarea activates the group’s focused border. The default variant uses Input’s pressed background; filled and none stay transparent while focused.
  • Disabled: Field.Root disabled disables its control. Disable independent addon buttons explicitly, and keep a description explaining why the field is unavailable.
  • Invalid: Field.Root invalid supplies aria-invalid; pair it with Field.Error to associate the validation message. The group uses a 2px danger border and accent red subtlest fill.
  • Read-only: pass readOnly to the input or textarea. The value remains focusable and selectable without allowing edits.

Addons and default grouped buttons do not add a hover background. Use className if an action needs its own hover treatment, while preserving visible focus styling.

The root’s sm, md, and lg sizes set single-line heights of 36px, 40px, and 44px. Inputs inherit this scale. Textareas use size-dependent minimum heights and may grow; compact buttons use their own Button size.

Every part accepts the usual className prop. You do not need a variant prop to customize the surface, control, text, or actions. Keep focus and invalid states distinguishable and retain an accessible label.

https://

InputGroup.Control render composes another input-compatible control while keeping group styling and props. For multiline content, prefer the dedicated InputGroup.Textarea rather than passing a textarea to an input-typed ref. A consumer-owned control can also participate directly by setting data-slot="input-group-control" on its native input or textarea; provide its own label, field associations, and chromeless styling. The root uses that slot to detect focus, invalid, and disabled state.

Variants

defaultfillednone

Sizes

smmdlg
InputGroup.Root
InputGroup.Input
InputGroup.Textarea
InputGroup.Addon
InputGroup.Text
InputGroup.Button
InputGroup.Control

API

PropTypeDefaultDescription
variant InputVariant default Surface inherited by the control.
size sm | md | lg md Height inherited by controls. Buttons have their own size.
Addon.align inline-start | inline-end | block-start | block-end — Visual addon placement, with logical inline positions for RTL. Omit to retain legacy DOM-order placement. Block addons enable auto-height layout.
Control.render ReactElement | function — Composes group behavior with another input-like control.
Textarea props TextareaProps — Native textarea props and an HTMLTextAreaElement ref. Inherits size and variant; Field supplies labels, descriptions, validation, and disabled state.
Button.variant / size ButtonVariant / sm | md | lg ghost / sm Compact action styling, independent of the group's single-line height. Supports Button loading and native props; type defaults to button.
Button.render ReactElement | function — Composes a button-compatible control without an extra interactive wrapper.
Text props HTMLAttributes<HTMLSpanElement> — Non-interactive helper text, units, counts, or icons with native span props and ref.
className string — Each part accepts custom styling. Root native div props and ref remain available; Input is an alias of Control.
native props React.HTMLAttributes<HTMLDivElement> — Forwards native attributes, events, aria-*, data-*, className, style, and ref.

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

InputGroup exposes a visual group but does not replace a field label. Use Field.Label or provide the control with an accessible name. Keep input-first DOM order for aligned layouts, and label icon-only buttons with aria-label. Addons are not focusable unless they contain an interactive control.

Use native input and textarea props for required fields, read-only content, and form submission. A disabled input does not automatically disable independent addon buttons. Keyboard hints are descriptive only; register any shortcut behavior in the owning application.