Input Group
NewAdd icons, text, and buttons inside an input or textarea.
Preview
Installation
npx sigma-ui@latest add input-groupUsage
<script setup lang="ts">
import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/ui/input-group';
</script>
<template>
<InputGroup>
<InputGroupAddon>https://</InputGroupAddon>
<InputGroupInput placeholder="sigma-ui.dev" />
</InputGroup>
</template>InputGroup draws the border and the focus outline. The control inside it is borderless.
InputGroupAddonplaces content atinline-start,inline-end,block-start, orblock-end. Clicking the addon focuses the control.InputGroupButtonis a button sized to sit inside the field.InputGroupTextis static text or an icon.InputGroupInputandInputGroupTextareaare the controls. They accept the same attributes asInputandTextarea.
Examples
Textarea
align="block-end" stacks the addon under the textarea.
Invalid
Set aria-invalid on the control. The group border turns destructive.
API Reference
InputGroup
Slots
| Slot | Scope |
|---|---|
defaultAddons and one | - |
InputGroupAddon
Props
| Prop | Type | Default |
|---|---|---|
alignWhere the addon sits relative to the control. | "inline-start" | "inline-end" | "block-start" | "block-end" | null | "inline-start" |
Slots
| Slot | Scope |
|---|---|
defaultIcon, text, | - |
InputGroupButton
Props
| Prop | Type | Default |
|---|---|---|
variantVisual style of the button. Defaults to | "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | "ghost" |
sizeSize of the button inside the field. | "xs" | "sm" | "icon-xs" | "icon-sm" | null | "xs" |
Slots
| Slot | Scope |
|---|---|
defaultButton label or icon. | - |
InputGroupInput
This component has no props, events, or slots.
InputGroupText
Slots
| Slot | Scope |
|---|---|
defaultText or an icon shown inside an addon. | - |
InputGroupTextarea
This component has no props, events, or slots.
Accessibility
The group renders role="group". Addon content that is decorative, such as an icon, should be hidden from assistive technology with aria-hidden. Give the control a <label>, or set aria-label.
| Key | Description |
|---|---|
| Tab | Moves focus to the control, then to any buttons in the addons. |