InputGroup
Joins an input with prefix and suffix addons inside one frame.
import { InputGroup } from '@elluzion/iv-ui'; 01 Preview
Addons
A protocol prefix and a unit suffix around one input.
https:// .dev
Source· svelte Show Hide
<script lang="ts">
import { Input, InputGroup } from '@elluzion/iv-ui';
let host = $state('orbital');
</script>
<div class="field-row">
<InputGroup>
{#snippet prefix()}<span>https://</span>{/snippet}
<Input bind:value={host} aria-label="Host" />
{#snippet suffix()}<span>.dev</span>{/snippet}
</InputGroup>
</div>
<style>
.field-row {
width: 100%;
max-width: 340px;
}
</style>02 Usage
prefixandsuffixtake snippets; keep the content short, such as a protocol, unit, or icon.sizeapplies to the frame; keep the inner control on the same size.- Use
disabledon the group for a consistent dimmed frame, and on the control to block input.
03 Examples
Sizes
sm, md, and lg keep the addons aligned with the control.
sm
md
lg
Source· svelte Show Hide
<script lang="ts">
import { Input, InputGroup } from '@elluzion/iv-ui';
</script>
<div class="stack">
<InputGroup size="sm">
{#snippet prefix()}<span>sm</span>{/snippet}
<Input size="sm" placeholder="Small" aria-label="Small size" />
</InputGroup>
<InputGroup>
{#snippet prefix()}<span>md</span>{/snippet}
<Input placeholder="Medium" aria-label="Medium size" />
</InputGroup>
<InputGroup size="lg">
{#snippet prefix()}<span>lg</span>{/snippet}
<Input size="lg" placeholder="Large" aria-label="Large size" />
</InputGroup>
</div>
<style>
.stack {
display: flex;
flex-direction: column;
gap: var(--iv_spacing-md);
width: 100%;
max-width: 340px;
}
</style>With a button
The suffix can hold an action instead of text.
last search: —
Source· svelte Show Hide
<script lang="ts">
import { Button, Input, InputGroup } from '@elluzion/iv-ui';
let query = $state('deploy logs');
let submitted = $state('');
function submit() {
submitted = query;
}
</script>
<div class="stack">
<InputGroup>
<Input bind:value={query} aria-label="Search" placeholder="Search the archive" />
{#snippet suffix()}<Button size="sm" variant="ghost" onclick={submit}>Search</Button>{/snippet}
</InputGroup>
<p class="readout">last search: {submitted || '—'}</p>
</div>
<style>
.stack {
display: flex;
flex-direction: column;
gap: var(--iv_spacing-sm);
width: 100%;
max-width: 380px;
}
.readout {
margin: 0;
font-family: var(--iv_font-mono);
font-size: var(--iv_text-sm);
color: var(--iv_foreground-dim);
}
</style>04 API
import { InputGroup } from '@elluzion/iv-ui';Props
3 props · 0 events · 3 snippets| Prop | Type | Default | Description |
|---|---|---|---|
| size | 'sm' | 'md' | 'lg' | 'md' | Control size shared by the group and its addons. |
| disabled | boolean | false | Disables interaction and applies the disabled treatment. |
| className | string | '' | Extra classes merged onto the root element. |
Snippets
| Snippet | Type | Description |
|---|---|---|
| prefix | Snippet | Content rendered before the input, such as a protocol or icon. |
| suffix | Snippet | Content rendered after the input, such as a unit or button. |
| children | Snippet | The input control. |
05 Accessibility
- The group is a visual container only; label the inner control itself.
- Focus styling is applied to the whole frame through
:focus-within.
06 Tokens & CSS hooks
Tokens used
--iv_border --iv_border-focus --iv_border-hover --iv_control-pad-x --iv_control-pad-x-lg --iv_control-pad-x-sm --iv_cursor --iv_disabled-opacity --iv_ease-in-out --iv_font-ui --iv_foreground-dim --iv_radius-sm --iv_ring --iv_ring-width --iv_surface-elevated --iv_surface-raised --iv_text-body --iv_text-body-sm --iv_text-label --iv_transition-base
Class hooks
.iv-addon.iv-control.iv-disabled.iv-input-group.iv-input-wrapper.iv-lg.iv-native-select.iv-prefix.iv-sm.iv-suffix.iv-textarea-wrapper.iv-trigger