Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Forms & Input

Input Group

Compose inputs with addons, icons, text, buttons, dropdowns, spinners — aligned with shadcn input-group docs. Make the expected input clear before someone interacts, and keep the current value, help text and validation feedback connected. Import it from @/components/kamod-ui/input-group.

Source · Design reference · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Import InputGroup, InputGroupInput or InputGroupTextarea, InputGroupAddon, InputGroupText, InputGroupButton from @/components/kamod-ui/input-group.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

Place InputGroupInput or InputGroupTextarea first in the DOM; use InputGroupAddon align=inline-start | inline-end | block-start | block-end to position visually (shadcn recommendation).

Import SetupTypeScript
import { InputGroup } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Input Group in Different Contexts, from the starting pattern to the compositions below. Begin with Demo, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Demo

Keep Search Context Close to the Query. Compose a search field with a trailing icon and result count inside InputGroup. The input holds the query, while the addon reports context about the current result set without becoming part of the typed value.

Derive the count from the actual results, keep the input labeled and distinguish no matches from a request that is still loading.

src/components/InputGroupExample.tsx14 lines
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from "@kamod-ch/ui";
import { Search } from "lucide-preact";

export const Example = () => (
  <InputGroup class="max-w-xs">
    <InputGroupInput placeholder="Search..." />
    <InputGroupAddon>
      <Search class="text-muted-foreground" />
    </InputGroupAddon>
    <InputGroupAddon align="inline-end">
      <InputGroupText>12 results</InputGroupText>
    </InputGroupAddon>
  </InputGroup>
);

Usage

Start with One Useful Addon. Start with an input and one icon addon to understand the group's shared border and spacing. The icon suggests the field's purpose, while a persistent label or accessible name supplies its actual meaning.

Keep it decorative unless it performs an action, retain an accessible name for the input, and avoid assuming that the icon makes placeholder-only labeling sufficient.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

URL

Clarify Which Part of the Address Is Editable. Place a protocol prefix before the editable URL segment and a Go action after it. Make clear how the prefix combines with the input when forming a destination, especially if users paste an already complete address.

Normalize and validate the resulting URL in application logic, and make the Go action's destination or effect predictable before activating it.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Username

Distinguish Display Decoration from Stored Data. Use an @ prefix to introduce an account handle while leaving the editable portion distinct. Decide whether that character belongs in the stored value, and apply the same rule when displaying or validating the completed handle.

Explain accepted characters and availability checks separately, and avoid treating a visual prefix as validation.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Align: Inline-Start

Add Context before the Value. Use the inline-start addon position to show an icon before the field visually. The control can remain first in the markup, so presentation does not require restructuring the input's association with its label and help text.

Keep meaningful text associated with the input and decorative symbols hidden from assistive technology; logical placement should continue to work when direction changes.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Align: Inline-End

Reserve the Trailing Edge for Relevant Assistance. Place a supporting symbol or action in an inline-end addon when it belongs after the value. If the symbol changes something, such as password visibility, use a named button rather than treating the graphic as decoration.

Give interactive addons a clear name and appropriate button type, and keep them distinct from decorative symbols that should not receive focus.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Align: Block-Start

Introduce a Larger Editing Area. Use a block-start addon for context or tools that belong above an input or textarea. This creates a separate row inside the shared field boundary, leaving the editable content below it with room to expand.

Keep the field's accessible name explicit and ensure the addon does not become a second unrelated toolbar competing with the surrounding form.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Align: Block-End

Place Supporting Actions after the Input. Place suffix information or actions in a block-end addon beneath the editable area. This works for a character count or submit control that should remain part of the same composition without occupying horizontal typing space.

Keep counters derived from the current value, make limits clear, and avoid hiding validation feedback behind a decorative footer.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Icons

Use Symbols Consistently Across Fields. Compare leading and trailing icons with the same field structure to decide which symbols add useful context. Keep decorative icons separate from interactive addon buttons so their visual placement does not imply identical behavior.

Keep decorative graphics out of the accessible name and add descriptive labels to real icon actions; the same visual slot should not unpredictably alternate between clickable and static content.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Text Addons

Explain How the Value Will Be Interpreted. Use text addons for units, protocol prefixes, domain suffixes or concise hints. These strings explain how to interpret the value, but the application must decide which parts actually belong in its stored or submitted representation.

Validate the completed representation, including any fixed prefix or suffix that the service expects. If a narrow layout abbreviates the addon, keep the full format available in the field's helper text rather than leaving users to infer it.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Buttons

Keep Field Actions Local and Explicit. Use InputGroupButton for an action directly related to the field, such as copying its value or running a search. The compact button shares the surrounding boundary while retaining its own label and activation behavior.

Set button types intentionally, give icon-only actions accessible names, and provide brief feedback when an operation such as copying succeeds or fails.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Kbd

Advertise a Working Shortcut. Place a Kbd hint in the inline-end addon when a real keyboard shortcut can focus or activate the field. The hint makes that existing behavior discoverable without registering the shortcut itself.

Register the behavior in application code, avoid browser conflicts, and keep ordinary tab navigation available regardless of the hinted combination.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Dropdown

Put Secondary Field Options Behind a Named Trigger. Compose InputGroupButton with Dropdown when the field needs a short set of related actions. The trigger belongs inside the input group, while the opened menu presents the available operations separately.

Keep selection synchronized with the field's meaning and preserve focus behavior; use Dropdown for the menu's own state and keyboard patterns.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Spinner

Show Pending Work without Replacing the Field's Meaning. Put Spinner in an addon to show work associated with the field, such as searching for suggestions. Drive it from the real pending state and keep the input value visible while the operation completes.

Keep an understandable text status where needed, cancel stale application requests, and ensure an old response cannot overwrite the latest value's result.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Textarea (Code)

Separate Editing from Supporting Tools. Arrange block-start and block-end toolbars around a monospace textarea for code-like content. The field remains an editable text area; the surrounding actions and metadata give it context without implying a full code editor.

Keep toolbar buttons out of the value, preserve ordinary text editing and label the textarea explicitly; this composition is not a full code editor by itself.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Input Group using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Props, slots and variants for this component.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/input-group17.2 KB min · 4.3 KB gzipSignals: none

InputGroup

InputGroupProps

InputGroup documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildInputGroupProps

Configure children for InputGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>InputGroupProps

Configure class for InputGroup. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

InputGroupAddon

InputGroupAddonProps

InputGroupAddon documented props
Prop / typeDescription
align
"inline-start" | "inline-end" | "block-start" | "block-end"InputGroupAddonProps

Configure align for InputGroupAddon. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"inline-start"
children
ComponentChild[] | ComponentChildInputGroupAddonProps

Configure children for InputGroupAddon. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>InputGroupAddonProps

Configure class for InputGroupAddon. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLDivElement>InputGroupAddonProps

Configure onClick for InputGroupAddon. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

InputGroupButton

InputGroupButtonProps

InputGroupButton documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildInputGroupButtonProps

Configure children for InputGroupButton. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>InputGroupButtonProps

Configure class for InputGroupButton. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
size
"sm" | "icon-xs" | "icon-sm"InputGroupButtonProps

Configure size for InputGroupButton. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"sm"
type
"button" | "reset" | "submit" | SignalLike<"button" | "reset" | "submit" | undefined>InputGroupButtonProps

Configure type for InputGroupButton. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"button"
variant
anyInputGroupButtonProps

Configure variant for InputGroupButton. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"ghost"

InputGroupInput

InputGroupInputProps

InputGroupInput documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>InputGroupInputProps

Configure class for InputGroupInput. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

InputGroupText

InputGroupTextProps

InputGroupText documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildInputGroupTextProps

Configure children for InputGroupText. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>InputGroupTextProps

Configure class for InputGroupText. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

InputGroupTextarea

InputGroupTextareaProps

InputGroupTextarea documented props
Prop / typeDescription
class
string | SignalLike<string | undefined>InputGroupTextareaProps

Configure class for InputGroupTextarea. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

InputGroup Props

1 declared field
InputGroupProps
Exported Source Declaration from InputGroup.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of InputGroupProps before adapting it.

InputGroupAddon Props

1 declared field
InputGroupAddonProps
Exported Source Declaration from InputGroupAddon.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of InputGroupAddonProps before adapting it.

InputGroupButton Props

1 declared field
InputGroupButtonProps
Exported Source Declaration from InputGroupButton.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of InputGroupButtonProps before adapting it.
InputGroupInputProps
Exported Source Declaration from InputGroupInput.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of InputGroupInputProps before adapting it.

InputGroupText Props

1 declared field
InputGroupTextProps
Exported Source Declaration from InputGroupText.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of InputGroupTextProps before adapting it.
InputGroupTextareaProps
Exported Source Declaration from InputGroupTextarea.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of InputGroupTextareaProps before adapting it.

Accessibility

Build the Complete Interaction, Including the Parts Outside Input Group. The notes below distinguish the current implementation from the labels, content and behavior your application supplies. Start with the Live Preview, check the Props and Data Reference, and test the finished composition with real content rather than assuming that an unchanged visual example covers every use case.

Built-in Behavior and Defaults

InputGroup provides a group wrapper for a control and its add-ons. InputGroupInput and InputGroupTextarea retain the underlying native editing behavior. InputGroupButton defaults to type="button", so supporting actions do not submit a form accidentally.

Labels and Relationships

Label the editable control itself, not just the surrounding group. Describe units or prefixes when they change the meaning of the value. Give icon-only actions names such as Show password or Clear search, and hide purely decorative icons from assistive technology.

Keyboard and Focus

Keep the input and its buttons in a predictable reading and tab order. Password visibility changes should preserve focus and the entered value. If an add-on opens a menu, use the appropriate trigger component to manage its expanded state.

States and Integration Details

An add-on is not automatically an input label. Do not use a clickable decorative span as the only way to perform an action, and avoid duplicating the same currency or unit in both the accessible name and description unnecessarily.

Verify the Complete Interaction

Check Behavior as Well as Markup. Work through these scenarios in the application where the component will be used. Automated checks can help find structural problems; also review the reading experience with a screen reader, keyboard focus and the actual feedback from your application.

  1. Tab through the input and each supporting action; identify every icon without seeing the surrounding graphics.
  2. Activate add-ons with Enter or Space and confirm unrelated form submission does not occur.
  3. Test long prefixes, error messages and enlarged text without clipping the input's focus indicator.

Recheck the result after changing Theme Tokens, translations or class overrides. Include text enlargement, narrow layouts and reduced-motion settings where animation is present. Inspect the Component Source when a behavior differs from your expectation; a role or state attribute does not implement keyboard interaction by itself.

For background, read the WAI-ARIA Authoring Guidance and Keyboard Interface Guidance. These explain the patterns; verify browser and assistive-technology behavior for the implementation and audience you actually support.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.