JGuang

InputGroup

InputGroup · Astryx

Preview
npm install @astryxdesign/core@0.7.1 @astryxdesign/theme-neutral@0.7.1 @stylexjs/stylex@0.19.0

InputGroup

InputGroup connects an input with prefix/suffix addons in a single visual unit. Use it for URL fields, currency inputs, search fields with action buttons, or any input that needs contextual decorations.

Installation

npm install @astryxdesign/core@0.7.1 @astryxdesign/theme-neutral@0.7.1 @stylexjs/stylex@0.19.0

Requires React 19+, base CSS and a Theme provider. See Setup.

Input Group

InputGroup connects an input with prefix/suffix addons in a single visual unit. Use it for URL fields, currency inputs, search fields with action buttons, or any input that needs contextual decorations.

PropTypeDefaultDescription
children *ReactNodeInputGroupText, Button addons, and compatible input children: TextInput, NumberInput, TimeInput, DateInput, Typeahead, Selector, or MultiSelector.
label *stringAccessible label for the group.
isLabelHiddenbooleanfalseVisually hide the label.
descriptionstringHelper text between label and input group.
isDisabledbooleanfalseDisable the entire group.
isOptionalbooleanfalseShow "(optional)" indicator.
isRequiredbooleanfalseMark the field as required.
size'sm' | 'md' | 'lg''md'Default size for inputs in the group.
status{type: 'warning' | 'error' | 'success', message?: string}Status indicator applied to the group border.
labelTooltipstringTooltip text at the end of the label.
xstyleStyleXStylesStyleX styles for layout customization.
data-testidstringTest selector.

Usage guidance

  • Use text addons to show units, prefixes, or suffixes that clarify the input format (e.g., "$", "kg", "https://").
  • Use InputGroupText for static prefixes/suffixes like "$", "kg", or "https://".
  • Use Button for an action attached to the input; InputGroup connects its corners automatically.
  • Use InputGroup with compatible single-line inputs: TextInput, NumberInput, TimeInput, DateInput, Typeahead, Selector, and MultiSelector.
  • Keep each inner input's label specific; grouped inputs automatically combine the group label with their own label and inherit the group description/status context.
  • Avoid: Don't put multiple text inputs in one group; use separate fields instead.
  • Avoid: Don't use InputGroup for unrelated inputs; it's for a single input with decorations.
  • Avoid: Don't use InputGroup with TextArea, Slider, Switch, CheckboxInput, or RadioList.

Theming API

{
  "targets": [
    {
      "className": "astryx-input-group",
      "visualProps": [
        "size",
        "status"
      ]
    },
    {
      "className": "astryx-input-group-text"
    }
  ]
}

InputGroupText

Anatomy

  • Label: Text above the group.
  • Prefix addon: Content before the input (text, icon, or button).
  • Input: The main input element (TextInput, NumberInput, TimeInput, DateInput, Typeahead, Selector, or MultiSelector).
  • Suffix addon: Content after the input (text, icon, or button).
  • Status message: An error, warning, or success message below the group.

Input Group Text

A prefix or suffix text element rendered inside InputGroup. Displays text or icons.

PropTypeDefaultDescription
children *ReactNodeText or icon content.
xstyleStyleXStylesStyleX styles for customization.
classNamestringCSS class name(s).
styleReact.CSSPropertiesInline styles.

Examples

  • Input Group:
  • InputGroup — Basic: A currency field with static prefix and suffix addons around a TextInput. Use InputGroupText to clarify units or input format.