// preview in
saved for every page

Input group

One field box around an input and the text, icons or buttons that belong to it. PasswordInput and SearchInput are ready-made groups for the two you build most.

Built on Base UIPattern HTML input + buttonClient componentSource ↗
minimal · light · #3fa34d

At least 8 characters, with one number.

size
disabled

Installation

Set up Camaleo once (Installation), then import what you need. Put it in a Field to give it a label.

import { InputGroup, InputAddon, PasswordInput, SearchInput, Input } from "@camaleo/react";

Anatomy

The group draws one border and one focus ring. The input inside drops its own, and addons, icons and buttons sit at either end.

https://inputbutton
[data-slot="input-group"][data-slot="input-addon"] · [data-slot="icon"] · [data-slot="input-group-button"][data-slot="input-group-input"]

Examples

Every example is a real file you can copy. They all wear the skin, mode and brand from the bar above.

minimal · light · #3fa34d

At least 8 characters, with one number.

Password with live rules

Type a password. With the text visible, people catch the typo that a rule like "one number" would otherwise reject twice.

2 of 6 invoices

  • INV-1042 · Acme Corp
  • INV-1045 · Acme Labs

Search with clear

Type, then press the × or Esc. Clearing fires onChange and puts focus back in the input, and the count is announced with aria-live.

Press / anywhere on the page to jump here.

Keyboard shortcut

Press / outside a field. shortcut only draws the hint while the field is empty: wire the key yourself and declare it with aria-keyshortcuts.

Your shop's public address. We add https:// for you.

URL with a prefix

The fixed part sits in an InputAddon, so people type only the domain and the value you save has no "https://" to strip.

$/mo

Currency and period

A currency before and a period after say what the number means, so the label can stay short.

Copy button

Click Copy. A Button inside the group shares its border, and the new label is announced, so people know it worked.

Leading icon

An icon helps people scan a long form, but it is decoration: mark it aria-hidden and let the label do the naming.

.camaleo.app
acme.camaleo.app is taken. Try acme-design.

Invalid

In an invalid Field the whole group turns red, addon included, and the error says what to try instead.

In context

These are whole pieces of UI you can copy, in the skin you picked.

Sign in to Northwind

Use the email you were invited with.

Forgot your password?
Sign-in cardCard · Field · InputGroup · PasswordInput · Button
Northwind
App header searchSearchInput · Button

Shop settings

What customers see on your checkout page.

$/mo
Shop settingsCard · Field · InputGroup · InputAddon · Button

Guidelines

DoPut the fixed part in an addon.

People type only what changes, and can't get the prefix wrong.

Don’tMake people type the fixed part.

Half will skip "https://", the other half will type it twice.

DoOne password field with a reveal button.

People check what they typed by looking at it.

Don’tA second field to confirm the password.

It doubles the typing and still can't show a typo that both fields share.

Props

PasswordInput and SearchInput take every prop of Input, plus their own:

PropTypeDefaultDescription
size"md" | "sm""md"Height of the field. sm for toolbars and dense tables.
showLabelstring"Show password"Accessible name of the visibility button while the password is hidden (translatable).
hideLabelstring"Hide password"Accessible name of the visibility button while the password is shown (translatable).
disabledboolean——
Also accepts every prop of the underlying primitive and native attributes.
PropTypeDefaultDescription
size"md" | "sm""md"Height of the field. sm for toolbars and dense tables.
clearLabelstring"Clear search"Accessible name of the clear button (translatable).
shortcutReactNode—Keyboard hint shown while empty, e.g. "Ctrl K". Pair it with aria-keyshortcuts.

InputGroup takes size and the attributes of a <div>; InputAddon takes those of a <span>.

Styling hooks

Restyle it without forking: target the attributes, or set the tokens on a parent, a skin or the group itself.

Attributes

data-slot"input-group" · "input-group-input" · "input-addon" · "input-group-button"
data-size"sm" · "md" on the group
data-pressedon the password button while the text is visible
data-invalidon the input when its Field is invalid; the group turns red with it

Tokens it reads

Color

--cml-border--cml-border-control--cml-danger--cml-fg--cml-fg-muted--cml-fg-secondary--cml-field-bg--cml-field-border-sides--cml-field-shadow--cml-focus-offset--cml-focus-ring--cml-focus-width--cml-input-button-on-bg

Shape & size

--cml-control-height-sm--cml-control-padding-sm--cml-field-border-width--cml-field-height--cml-field-padding--cml-font-size-field--cml-gap--cml-radius-control--cml-radius-control-sm--cml-radius-field

Type & motion

--cml-duration-fast--cml-ease-standard--cml-font-field--cml-font-size-control-sm

This component only

--cml-corner-shape--cml-disabled-opacity--cml-input-addon-fg--cml-item-highlight--cml-placeholder-style
/* addons without a tinted background, only in the checkout */
.checkout [data-slot="input-group"] {
  --cml-input-addon-bg: transparent;
}

Accessibility

TabMoves focus to the input, then to the show/hide or clear button.
Enter · SpaceOn the show/hide button: shows or hides the password. On the clear button: clears the search.
EscapeIn a SearchInput: clears the text (the browser's search behavior).
Was this page helpful? · Edit this page on GitHub