Skip to content
Statix Design System

Forms

Input Group

A field with icons, text or buttons inside its border. Use it for search bars, domain checks, URL prefixes and password fields.

import * as InputGroup from '@statix/ui/input-group';

Playground

Controls
<InputGroup.Root variant="pill" size="lg">
	<InputGroup.Addon>
		<SearchIcon aria-hidden="true" />
	</InputGroup.Addon>
	<InputGroup.Input aria-label="Domain" placeholder="your-studio.de" />
	<InputGroup.Addon align="inline-end">
		<InputGroup.Button variant="dark" size="md">Check</InputGroup.Button>
	</InputGroup.Addon>
</InputGroup.Root>

Examples

Pill group in size lg with a search icon and a dark button. The button sits inside the border, 8px from the edge.

<script lang="ts">
	import * as InputGroup from '@statix/ui/input-group';
	import SearchIcon from '@lucide/svelte/icons/search';

	let query = $state('');
	let result = $state('');
</script>

<form
	class="flex w-full max-w-lg flex-col gap-3"
	onsubmit={(e) => {
		e.preventDefault();
		if (query.trim()) result = `${query.trim()} is available for 1.20 € per month.`;
	}}
>
	<InputGroup.Root variant="pill" size="lg">
		<InputGroup.Addon>
			<SearchIcon aria-hidden="true" />
		</InputGroup.Addon>
		<InputGroup.Input
			bind:value={query}
			aria-label="Domain"
			placeholder="your-studio.de"
			autocomplete="off"
		/>
		<InputGroup.Addon align="inline-end">
			<InputGroup.Button type="submit" variant="dark" size="md">Check</InputGroup.Button>
		</InputGroup.Addon>
	</InputGroup.Root>
	{#if result}
		<p class="px-5 text-small text-muted-foreground" aria-live="polite">{result}</p>
	{/if}
</form>

Icon on the left, a keyboard hint on the right. Same layout as the support search.

/
<script lang="ts">
	import * as InputGroup from '@statix/ui/input-group';
	import SearchIcon from '@lucide/svelte/icons/search';
</script>

<div class="w-full max-w-md">
	<InputGroup.Root variant="pill">
		<InputGroup.Addon>
			<SearchIcon aria-hidden="true" />
		</InputGroup.Addon>
		<InputGroup.Input
			type="search"
			aria-label="Search help"
			placeholder="How do I restore a backup?"
		/>
		<InputGroup.Addon align="inline-end">
			<kbd class="rounded-xs bg-muted px-1.5 py-0.5 font-mono text-label text-muted-foreground"
				>/</kbd
			>
		</InputGroup.Addon>
	</InputGroup.Root>
</div>

Text addons

Fixed text before or after the value, such as https:// or the mailbox domain.

https://
@yoga-berger.de
<script lang="ts">
	import * as InputGroup from '@statix/ui/input-group';
	import { Label } from '@statix/ui/label';
</script>

<div class="flex w-full max-w-sm flex-col gap-5">
	<div class="flex flex-col gap-2">
		<Label for="ig-website">Website</Label>
		<InputGroup.Root>
			<InputGroup.Addon>
				<InputGroup.Text>https://</InputGroup.Text>
			</InputGroup.Addon>
			<InputGroup.Input id="ig-website" value="yoga-berger.de" />
		</InputGroup.Root>
	</div>
	<div class="flex flex-col gap-2">
		<Label for="ig-mailbox">New mailbox</Label>
		<InputGroup.Root>
			<InputGroup.Input id="ig-mailbox" placeholder="kurse" />
			<InputGroup.Addon align="inline-end">
				<InputGroup.Text>@yoga-berger.de</InputGroup.Text>
			</InputGroup.Addon>
		</InputGroup.Root>
	</div>
</div>

Icon button

An icon-only InputGroupButton toggles password visibility. Give it an aria-label.

<script lang="ts">
	import * as InputGroup from '@statix/ui/input-group';
	import { Label } from '@statix/ui/label';
	import EyeIcon from '@lucide/svelte/icons/eye';
	import EyeOffIcon from '@lucide/svelte/icons/eye-off';

	let visible = $state(false);
</script>

<div class="flex w-full max-w-sm flex-col gap-2">
	<Label for="ig-password">Mailbox password</Label>
	<InputGroup.Root>
		<InputGroup.Input
			id="ig-password"
			type={visible ? 'text' : 'password'}
			autocomplete="new-password"
			value="Kursplan-2027!"
		/>
		<InputGroup.Addon align="inline-end">
			<InputGroup.Button
				size="icon-sm"
				aria-label={visible ? 'Hide password' : 'Show password'}
				aria-pressed={visible}
				onclick={() => (visible = !visible)}
			>
				{#if visible}<EyeOffIcon />{:else}<EyeIcon />{/if}
			</InputGroup.Button>
		</InputGroup.Addon>
	</InputGroup.Root>
</div>

With a textarea

Block addons sit above or below a textarea, for a character count and a send button.

0/1000
<script lang="ts">
	import * as InputGroup from '@statix/ui/input-group';
	import ArrowUpIcon from '@lucide/svelte/icons/arrow-up';

	let message = $state('');
</script>

<div class="w-full max-w-md">
	<InputGroup.Root>
		<InputGroup.Textarea
			bind:value={message}
			aria-label="Message to support"
			placeholder="Write to Jonas. He usually replies within an hour."
		/>
		<InputGroup.Addon align="block-end" class="border-t border-border">
			<InputGroup.Text class="text-small">{message.length}/1000</InputGroup.Text>
			<InputGroup.Button variant="primary" size="icon-sm" class="ml-auto" aria-label="Send message">
				<ArrowUpIcon />
			</InputGroup.Button>
		</InputGroup.Addon>
	</InputGroup.Root>
</div>

Sizes

sm (36px), md (44px, default) and lg (52px).

<script lang="ts">
	import * as InputGroup from '@statix/ui/input-group';
	import GlobeIcon from '@lucide/svelte/icons/globe';
</script>

<div class="flex w-full max-w-sm flex-col gap-3">
	{#each ['sm', 'md', 'lg'] as const as size (size)}
		<InputGroup.Root {size}>
			<InputGroup.Addon>
				<GlobeIcon aria-hidden="true" />
			</InputGroup.Addon>
			<InputGroup.Input aria-label="Domain, size {size}" placeholder="yoga-berger.de ({size})" />
		</InputGroup.Root>
	{/each}
</div>

Guidelines

Do

  • Use the pill variant with size lg for the main search on a page, such as the domain check.
  • Use a dark InputGroupButton for the action inside a search bar. Keep primary for the main action of the page.
  • Keep addon text short. Long prefixes squeeze the value.

Don't

  • Don't put more than one button inside a group.
  • Don't use an icon as the only label. The input still needs a Label or aria-label.

Accessibility

  • The root has role="group". Label the input itself with Label or aria-label.
  • Clicking an addon (outside a button) focuses the input.
  • Icon-only buttons need an aria-label. Toggle buttons should set aria-pressed.
  • The focus ring wraps the whole group when the input inside has focus.

API reference

InputGroup.Root

renders <div role="group"> and accepts its attributes

The bordered container.

PropTypeDefault
variant 'default' | 'pill'

default has 16px corners. pill is fully rounded and rounds the buttons inside too.

'default'
size 'sm' | 'md' | 'lg'

Height: 36, 44 or 52px. A textarea or block addon makes it grow.

'md'
ref bindHTMLElement | null

The rendered element.

–
class ClassValue

Merged with the default classes; yours win.

–
Data attributeMeaning
data-slot="input-group"Always present.
data-variantThe current variant. Children read it to match their corners.
data-sizeThe current size.

InputGroup.Input

renders <input> and accepts its attributes

The text field. Takes every Input prop except the border styling.

PropTypeDefault
value bindany

The current value.

–
ref bindHTMLElement | null

The rendered element.

–
class ClassValue

Merged with the default classes; yours win.

–
Data attributeMeaning
data-slot="input-group-control"Always present.

InputGroup.Textarea

renders <textarea> and accepts its attributes

A textarea in place of the input. Takes every Textarea prop.

PropTypeDefault
value bindstring

The current text.

–
ref bindHTMLElement | null

The rendered element.

–
class ClassValue

Merged with the default classes; yours win.

–
Data attributeMeaning
data-slot="input-group-control"Always present.

InputGroup.Addon

renders <div role="group"> and accepts its attributes

Holds icons, text or buttons next to the control.

PropTypeDefault
align 'inline-start' | 'inline-end' | 'block-start' | 'block-end'

Left, right, above or below the control.

'inline-start'
ref bindHTMLElement | null

The rendered element.

–
class ClassValue

Merged with the default classes; yours win.

–
Data attributeMeaning
data-slot="input-group-addon"Always present.
data-alignThe current alignment.

InputGroup.Button

renders <button> and accepts its attributes

A Button sized to fit inside the group. Takes every Button prop except href.

PropTypeDefault
size 'xs' | 'sm' | 'md' | 'icon-xs' | 'icon-sm' | 'icon-md'

xs 28px, sm 32px, md 36px (fills a md or lg group). Icon sizes are square.

'xs'
variant ButtonVariant

Any Button variant. Use dark for a search action.

'ghost'
ref bindHTMLElement | null

The rendered element.

–
class ClassValue

Merged with the default classes; yours win.

–

InputGroup.Text

renders <span> and accepts its attributes

Muted text inside an addon.

PropTypeDefault
ref bindHTMLElement | null

The rendered element.

–
class ClassValue

Merged with the default classes; yours win.

–