Skip to main content

Input Group

Attach a prefix label, suffix label, or action button directly to an input field. Uses <fieldset class="group"> from @primus/ui-core.

Preview ยท Input Group

Codeโ€‹

<!-- URL prefix -->
<fieldset class="group">
<legend>https://</legend>
<input type="text" placeholder="acme.yourdomain.com" />
</fieldset>

<!-- Currency prefix + suffix -->
<fieldset class="group">
<legend>$</legend>
<input type="number" placeholder="0.00" />
<legend>USD</legend>
</fieldset>

<!-- Input + action button -->
<fieldset class="group">
<input type="search" placeholder="Search tenants..." />
<button class="small">Search</button>
</fieldset>

<!-- Read-only value with copy button -->
<fieldset class="group">
<input type="text" value="sk_live_abc123xyz789" readonly
style="font-family:monospace;font-size:0.8rem" />
<button class="outline small"
onclick="navigator.clipboard.writeText(this.previousElementSibling.value)">
Copy
</button>
</fieldset>

Propsโ€‹

<fieldset class="group"> (@primus/ui-core)โ€‹

Child elementRenders as
<legend>Prefix or suffix label (attached flush to input)
<input>The main input field
<button>Attached action button

PrimusInputGroup (React/Angular)โ€‹

PropTypeDefaultDescription
prefixstring | ReactNodeโ€”Left-attached label
suffixstring | ReactNodeโ€”Right-attached label or button
errorstringโ€”Error message shown below
Version history

See the Changelog for version history and breaking changes.