Skip to main content

Starwind UI v3.0 is now available! Migration guide

Input Group

Installation

Usage

---
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
} from "@/components/starwind/input-group";
import Search from "@tabler/icons/outline/search.svg";
---
<InputGroup>
<InputGroupInput aria-label="Search" placeholder="Search..." />
<InputGroupAddon>
<Search />
</InputGroupAddon>
</InputGroup>

Composition

Combine an input or textarea with the supporting parts you need:

InputGroup
├── InputGroupInput or InputGroupTextarea
└── InputGroupAddon
├── InputGroupButton
└── InputGroupText

Control and Addon Order

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.

Alignment

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 styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Expand a prop to see named type definitions and framework-specific imports. 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

View version history v1.1.2 5 releases

v1.1.2

  • Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly.

v1.1.1

  • Aligned Astro and React attribute forwarding with the current generated adapter output.

v1.1.0

  • Added contract-generated Astro and React implementations while preserving the component’s existing public API and styling.
  • 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.

v1.0.1

  • Refactor tailwind variants functions into separate variants.ts file

v1.0.0

  • Initial release with starwind v1.16.0