Skip to content

InputGroup

Introduction

The InputGroup component enables advanced input layouts by combining text fields with add-ons, buttons, icons, selects, checkboxes, radios, and loading spinners. It supports both leading and trailing add-ons, inline elements, multiple sizes, validation states, and full reactivity via Pulse signals. InputGroup is ideal for financial inputs, search bars, phone numbers, and any scenario requiring contextual elements around an input.

Import

tsx
import { InputGroup } from '@odyssee/components';

LiveCodeEditor Examples

Basic Text Addons

Code Éditable
Résultat

Multiple Addons

Code Éditable
Résultat

Button Addons

Code Éditable
Résultat

Inline Icons

Code Éditable
Résultat

Checkbox & Radio Addons

Code Éditable
Résultat

Inline Selects

Code Éditable
Résultat

Loading State

Code Éditable
Résultat

Sizes

Code Éditable
Résultat

States: Disabled, Readonly, Error

Code Éditable
Résultat

Props Table

PropTypeDefaultDescription
leadingAddonInputGroup.Addon | string | Pulse.JSX.ElementAdd-on element before the input (text, icon, button, checkbox, radio, select, or JSX).
trailingAddonInputGroup.Addon | string | Pulse.JSX.ElementAdd-on element after the input.
leadingAddonsArray of InputGroup.Addon | string | Pulse.JSX.ElementMultiple add-ons before the input.
trailingAddonsArray of InputGroup.Addon | string | Pulse.JSX.ElementMultiple add-ons after the input.
leadingIconPulse.JSX.ElementInline icon before the input (absolute positioned).
trailingIconPulse.JSX.ElementInline icon after the input.
leadingSelect{ options, value, onChange, label }Inline select before the input.
trailingSelect{ options, value, onChange, label }Inline select after the input.
loadingboolean | Signal<boolean>falseShows a loading spinner (leading or trailing).
loadingPosition"leading" | "trailing""trailing"Position of the loading spinner.
containerClassNamestringAdditional CSS classes for the input group container.
containerStyleRecord<string, any>Inline styles for the input group container.
typestring"text"Input type (text, email, number, etc.).
valuestring | Signal<string>Input value (can be reactive signal).
placeholderstring""Placeholder text for the input.
disabledbooleanfalseDisables the input.
readonlybooleanfalseMakes the input read-only.
requiredbooleanfalseMarks the input as required.
errorstringError message displayed below the input.
labelstringLabel displayed above the input.
hintstringOptional hint text below the input.
size"xs" | "sm" | "md" | "lg" | "xl""md"Size of the input and add-ons.
onChange(value: string) => voidCallback fired when the input value changes.
onFocus(event: Event) => voidCallback fired when the input gains focus.
onBlur(event: Event) => voidCallback fired when the input loses focus.
classNamestringAdditional CSS classes for the input element.
idstringauto-genUnique ID for the input group.
styleReact.CSSPropertiesInline styles for the input element.
...restanyOther props are spread to the input element.
Addon fieldsSee InputGroup.Addon belowAdd-ons support type, content, buttonProps, checked, selectOptions, selectValue, etc.

InputGroup.Addon

FieldTypeDescription
type"text" | "icon" | "button" | "checkbox" | "radio" | "select"Type of addon.
contentstring | Pulse.JSX.ElementContent for text/icon/button addons.
buttonPropsButton.PropsProps for button addon.
onClick() => voidClick handler for button addon.
checkedboolean | Signal<boolean>Checked state for checkbox/radio addon.
onChange(checked: boolean) => voidChange handler for checkbox/radio addon.
selectOptionsSelect.Option[]Options for select addon.
selectValuestring | Signal<string>Selected value for select addon.
onSelectChange(value: string) => voidChange handler for select addon.
classNamestringAdditional CSS classes for the addon.

Implementation Notes

  • Fully reactive: supports Pulse signals for input value, loading, and addon states.
  • Add-ons can be text, icon, button, checkbox, radio, select, or custom JSX.
  • Inline elements (icons, selects, spinner) are absolutely positioned for seamless UX.
  • Multiple add-ons are supported on both sides.
  • Validation states (error, required, disabled, readonly) affect styling and accessibility.
  • Sizes are consistent across input and add-ons.
  • Container and input styling are customizable via className and style props.

Accessibility

  • Uses native <input> with proper labeling via for and id.
  • Add-ons are accessible and keyboard-navigable (buttons, selects, checkboxes, radios).
  • Error and hint messages are announced via text.
  • Loading spinner uses ARIA attributes for status indication.
  • Keyboard navigation and focus management are fully supported.

Best Practices

  • Use add-ons for contextual information (currency, units, actions).
  • Prefer button add-ons for quick actions (search, clear, increment/decrement).
  • Use inline icons for visual cues (search, email, user).
  • Combine selects for country/currency pickers in phone or price inputs.
  • Use validation states to guide user input and improve UX.
  • Group related fields for clarity and accessibility.

Released under the MIT License.