Skip to main content

Starwind UI v3.0 beta is now available! Read the migration guide

Input Group

Runtime example adjustment

InputGroupAddon is now presentational and no longer installs a click-to-focus script. Give the control its own accessible name, and use InputGroupButton when the addon itself performs an action.

Installation

Framework Availability

Astro Available React Available

Input Group is available for Astro and React.

Usage

General Notes

The essential components are InputGroup, InputGroupAddon, and either InputGroupInput or InputGroupTextarea.

InputGroupText and InputGroupButton are helper components for metadata and actions. Addons are presentational; associate a field with an external Label or an aria-label on the control.

Keep InputGroupAddon after InputGroupInput or InputGroupTextarea in the DOM. Use align to control visual placement.

Align

inline-start

Use align="inline-start" to place content at the start of the field. This is the default alignment.

inline-end

Use align="inline-end" to place content at the end of the field.

block-start

Use align="block-start" to place a header row above the control.

Full Name
script.js

block-end

Use align="block-end" to place a footer row below the control.

USD
0/280

Examples

Icon

Text

$
USD
https://
.com
@company.com
120 characters left

Button

https://

Kbd

Ctrl+K

Spinner

Saving…

Textarea

Line 1, Column 1

script.js

API Reference

Styled Component API

These props are added or materially changed by the installed Astro styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Follow the Primitive and Runtime links for lower-level behavior props.

Input Group Addon

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
align "inline-start" | "inline-end" | "block-start" | "block-end" "inline-start"
Description
Aligns the component within its available axis.
Classification
Styled variant

Input Group Button

Inherits Button props. Omits `size`.

Contains the following additional props:

Prop Type Default Toggle details
size "sm" | "icon-sm" "sm"
Description
Selects the component's visual size.
Classification
Styled variant

Changelog

v1.1.0

  • Added contract-generated Astro and React implementations while preserving the component’s existing public API and styling.

v1.0.1

  • Refactor tailwind variants functions into separate variants.ts file

v1.0.0

  • Initial release with starwind v1.16.0