suiss/ui · Component
Input Group
A text field with icons, text, buttons or keyboard hints attached inside its border.
Input Group is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
InputGroup is the container that draws the field's background, border and focus ring. Inside it, place one control, either InputGroupInput or InputGroupTextarea, and one or more InputGroupAddon elements. An addon can hold icons, InputGroupText, InputGroupButton or a Kbd, and is placed before, after, above or below the control with its align prop.
Use an input group when supporting content belongs inside the field, such as a search icon, a currency symbol, a clear button or a send button. For a plain field, use Input; for a field with a filterable list of options, use Combobox, which is built on this component.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Usage
Composition
Use the following composition to build a InputGroup:
Examples
Search
A search field with a clear button that appears only when there is text.
With text
Put short text such as a currency symbol and code, or a URL prefix and suffix, in InputGroupText inside an addon.
With buttons
Use InputGroupButton inside an addon for actions such as copying a link, subscribing, and showing information.
Button sizes
Use the size prop on InputGroupButton for the xs, icon-xs, icon-sm and icon sizes, shown here in one addon.
Large
Set size="lg" on InputGroup for the 54px field used in forms such as sign-in pages. Here a country code sits in a start addon and a round icon button submits the number.
With kbd
Place a Kbd in an inline-end addon for a keyboard shortcut hint.
Block addons
Set align to block-start or block-end to place an addon above or below the input. The group grows to fit.
With textarea
Use InputGroupTextarea as the control for a chat-style field, with attach and send buttons and usage text in a block-end addon.
Invalid
Set aria-invalid on the control to show the error style on the whole group.
Disabled
Disable the control and set data-disabled="true" on InputGroup to dim the group and its addons.
Accessibility
InputGroupandInputGroupAddonhave thegrouprole.- Give the control an accessible name with a label or
aria-label; placeholder text and addon text do not name it. - Give icon-only buttons an accessible name with
aria-label. - Buttons in addons are reachable with Tab after the control.
- Set
aria-invalidon the control to communicate a validation error.
API Reference
InputGroup
The container that draws the field and holds the control and addons.
| Prop | Type | Default |
|---|---|---|
size | "default" | "lg" | "default" |
Also accepts the props of React.ComponentProps<"div">.
size="lg" makes the field 54px tall with 16px side padding and 17px text.
Its rounded corners grow when it contains a textarea or a block addon. Each part sets a data-slot, such as input-group-addon, for styling; the input and textarea use input-group-control.
InputGroupAddon
Holds icons, text or buttons beside, above or below the control.
| Prop | Type | Default |
|---|---|---|
align | "inline-start" | "inline-end" | "block-start" | "block-end" | "inline-start" |
Also accepts the props of React.ComponentProps<"div">.
align places the addon before (inline-start) or after (inline-end) the control, or above (block-start) or below (block-end) it. Addons are positioned with CSS order, so you can place them before or after the control in your markup. Clicking an addon outside its buttons focuses the group's input. The addon sets data-align.
InputGroupButton
A compact button sized to fit inside the field.
| Prop | Type | Default |
|---|---|---|
size | "xs" | "sm" | "icon-xs" | "icon-sm" | "icon" | "xs" |
type | "button" | "submit" | "reset" | "button" |
Also accepts the props of React.ComponentProps<typeof Button>.
xs is a small text button, icon-xs and icon-sm are square icon buttons, and icon is a 36px round button for lg groups; sm keeps the base button size. type defaults to button, so the button does not submit a surrounding form unless you set type="submit". The button sets data-size.
InputGroupText
Static text or an icon with text, such as a unit or prefix.
Also accepts the props of React.ComponentProps<"span">.
InputGroupInput
The single-line text control of the group.
Also accepts the props of React.ComponentProps<"input">.
InputGroupTextarea
The multi-line text control of the group.
Also accepts the props of React.ComponentProps<"textarea">.
Web preview
InputGroup draws one outlined field and places an InputGroupInput or InputGroupTextarea inside it with addons around. Addons can sit on the start or end of the same line (inline-start, inline-end), or above or below the input (block-start, block-end), which turns the group into a column.
The group shows the focus border while its input is focused, and reads the disabled and invalid state from a surrounding Field. Pressing an addon focuses the input. Add children in any order; the group sorts start addons before the input and end addons after it. Put short labels such as a URL prefix or a unit in InputGroupText, and actions in InputGroupButton, a small rounded Button that defaults to the ghost variant and xs size.
Installation
- Install the following dependencies:
-
Add the pieces it builds on: Button, Icon, Input, Text, Textarea.
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/input-group.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Add the pieces it builds on: Button, Icon, Input, Text, Textarea.
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/input-group.tsx:
- Update the import paths to match your project setup.
-
Add the pieces it builds on: Button, Icon, Input, Text, Textarea.
-
Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/input-group.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
With textarea
Use a block-end addon with InputGroupTextarea for a footer row, here holding a usage label and a button.
Web preview
Button sizes
The xs, icon-xs, icon-sm and icon button sizes in one addon.
Web preview
Large
The lg group for forms such as sign-in screens, with a country code before the number and a round icon button that submits it.
Web preview
Block start
A label addon above the input with block-start.

Accessibility
- The container has the
grouprole. - Addons are not separate accessibility elements; their text is not announced with the input, so give the input an
accessibilityLabelthat includes needed context. - Icon-only buttons need an
accessibilityLabel.
API Reference
InputGroup
Field container that lays out the input and addons.
| Prop | Type | Default |
|---|---|---|
size | "default" | "lg" | "default" |
disabled | boolean | false |
invalid | boolean | - |
Also accepts the props of ViewProps.
Set invalid to show the destructive border and tint, or disabled to disable the group and its input, or let a Field provide them. Focus turns the border outline to ring with a solid ring. lg makes the group 54 tall with 16 point padding and 17 point text.
InputGroupAddon
Slot for text, icons or buttons beside or around the input.
| Prop | Type | Default |
|---|---|---|
align | "inline-start" | "inline-end" | "block-start" | "block-end" | "inline-start" |
Also accepts the props of React.ComponentProps<typeof Pressable>.
inline-start and inline-end place the addon on the same line as the input; block-start and block-end place it above or below and turn the group into a column.
InputGroupButton
Compact button inside an addon.
| Prop | Type | Default |
|---|---|---|
size | "xs" | "sm" | "icon-xs" | "icon-sm" | "icon" | "xs" |
Also accepts the props of React.ComponentProps<typeof Button>.
icon is a 36 point round button for lg groups.
InputGroupText
Text inside an addon.
Also accepts the props of React.ComponentProps<typeof Text>.
InputGroupInput
Single-line input without its own border.
Also accepts the props of React.ComponentProps<typeof Input>.
InputGroupTextarea
Multi-line input without its own border.
Also accepts the props of React.ComponentProps<typeof Textarea>.
InputGroupAddonAlign
Values: .inlineStart, .inlineEnd, .blockStart, .blockEnd.
InputGroupSize
Values: .default, .lg.
InputGroup
Field container that lays out the input and addons.
| Parameter | Type | Default |
|---|---|---|
size | Size: .default | .lg | .default |
content | () -> Content | - |
InputGroupAddon
Slot for text, icons or buttons beside or around the input.
| Parameter | Type | Default |
|---|---|---|
align | InputGroupAddonAlign: .inlineStart | .inlineEnd | .blockStart | .blockEnd | .inlineStart |
content | () -> Content | - |
InputGroupButtonSize
Values: .xs, .sm, .iconXs, .iconSm, .icon.
InputGroupButton
Compact button inside an addon.
| Parameter | Type | Default |
|---|---|---|
variant | VariantButtonStyle.Variant | .ghost |
size | Size: .xs | .sm | .iconXs | .iconSm | .icon | .xs |
action | () -> Void | - |
label | () -> Label | - |
_Â title | LocalizedStringKey | - |
Overloads: init(variant:size:action:label:), init(_:variant:size:action:).
InputGroupText
Text inside an addon.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
_Â text | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(content:), init(_:), init(verbatim:).
InputGroupInput
Single-line input without its own border.
| Parameter | Type | Default |
|---|---|---|
_Â title | LocalizedStringKey | - |
text | Binding<String> | - |
InputGroupTextarea
Multi-line input without its own border.
| Parameter | Type | Default |
|---|---|---|
_Â title | LocalizedStringKey | - |
text | Binding<String> | - |
lineLimit | ClosedRange<Int> | 2...8 |
InputGroupAddonAlign
Values: InlineStart, InlineEnd, BlockStart, BlockEnd.
InputGroupSize
Values: Default, Lg.
InputGroupButtonSize
Values: Xs, Sm, IconXs, IconSm, Icon.
InputGroup
Field container that lays out the input and addons.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
size | InputGroupSize: Default | Lg | InputGroupSize.Default |
enabled | Boolean | LocalFieldState.current.enabled |
invalid | Boolean | LocalFieldState.current.invalid |
content | @Composable () -> Unit | - |
InputGroupAddon
Slot for text, icons or buttons beside or around the input.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
align | InputGroupAddonAlign: InlineStart | InlineEnd | BlockStart | BlockEnd | InputGroupAddonAlign.InlineStart |
content | @Composable RowScope.() -> Unit | - |
InputGroupText
Text inside an addon.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable RowScope.() -> Unit | - |
text | String | - |
Overloads: InputGroupText(content), InputGroupText(text).
InputGroupButton
Compact button inside an addon.
| Parameter | Type | Default |
|---|---|---|
onClick | () -> Unit | - |
modifier | Modifier | Modifier |
size | InputGroupButtonSize: Xs | Sm | IconXs | IconSm | Icon | InputGroupButtonSize.Xs |
variant | ButtonVariant | ButtonVariant.Ghost |
enabled | Boolean | true |
content | @Composable RowScope.() -> Unit | - |
text | String | - |
Overloads: InputGroupButton(onClick, content), InputGroupButton(text, onClick).
InputGroupInput
Single-line input without its own border.
| Parameter | Type | Default |
|---|---|---|
value | String | - |
onValueChange | (String) -> Unit | - |
modifier | Modifier | Modifier |
placeholder | String? | null |
readOnly | Boolean | false |
keyboardOptions | KeyboardOptions | KeyboardOptions.Default |
keyboardActions | KeyboardActions | KeyboardActions.Default |
visualTransformation | VisualTransformation | VisualTransformation.None |
InputGroupTextarea
Multi-line input without its own border.
| Parameter | Type | Default |
|---|---|---|
value | String | - |
onValueChange | (String) -> Unit | - |
modifier | Modifier | Modifier |
placeholder | String? | null |
readOnly | Boolean | false |
minLines | Int | 3 |
maxLines | Int | Int.MAX_VALUE |
keyboardOptions | KeyboardOptions | KeyboardOptions.Default |
keyboardActions | KeyboardActions | KeyboardActions.Default |
