Components
Input Group
Attaches icons, text or actions to the start or end of an input.
Installation
$ npx veil-ui@latest add input-groupUsage
import { InputGroup, InputGroupAddon } from "@/components/ui/input-group";
import { Input } from "@/components/ui/input";
import { AtSign } from "lucide-react";
<InputGroup>
<InputGroupAddon>
<AtSign />
</InputGroupAddon>
<Input placeholder="you@example.com" aria-label="Email" />
</InputGroup>;Examples
With icon
With text
veil.dev/
⌘E
Prefixes and suffixes inherit the muted foreground colour so the editable text stays the focal point.
With action
API reference
InputGroup
| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | React.ComponentProps<"div"> | — | All native div attributes. The wrapper owns the border, focus ring and invalid state. |
InputGroupAddon
| Prop | Type | Default | Description |
|---|---|---|---|
| align | "inline-start" | "inline-end" | "inline-start" | Which side of the input the addon sits on. |
| ...props | React.ComponentProps<"div"> | — | All native div attributes. |
Accessibility
- The wrapper mirrors focus with
focus-within, so the ring surrounds the whole group. - An inner
aria-invalidinput turns the group border destructive. - Addons are plain content; decorative icons should be hidden or followed by a real label on the input.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add input-group --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { cn } from "@/lib/utils";
const props = defineProps<{ class?: string }>();
</script>
<template>
<div
data-slot="input-group"
:class="
cn(
'flex h-9 w-full items-center rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow,border-color]',
'focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50',
'has-[input[aria-invalid=true]]:border-destructive has-[input[aria-invalid=true]]:ring-destructive/20',
'[&>input]:h-full [&>input]:min-w-0 [&>input]:flex-1 [&>input]:rounded-none [&>input]:border-0 [&>input]:bg-transparent [&>input]:shadow-none',
'[&>input]:focus-visible:border-0 [&>input]:focus-visible:ring-0',
'[&>input]:disabled:opacity-50',
'dark:bg-input/30',
props.class,
)
"
>
<slot />
</div>
</template>