# Input with Prefix & Suffix

> A text field with attached prefix and suffix labels, like a currency sign and code.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: input group, addon, prefix, suffix, currency, price
- Live preview: https://copy-css.com/snippets/input-addon
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<label class="addon">
  <span>$</span>
  <input type="text" inputmode="decimal" placeholder="0.00" aria-label="Amount">
  <span>USD</span>
</label>
```

## CSS

```css
.addon {
  display: flex;
  width: 100%;
  max-width: 260px;
  overflow: hidden;
  border: 1px solid #d4d4d8;
  border-radius: 10px;
  background: #fff;
  font: 15px system-ui, sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.addon:focus-within {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.addon span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #f4f4f5;
  color: #71717a;
}

.addon span:first-child {
  border-right: 1px solid #e4e4e7;
}

.addon span:last-child {
  border-left: 1px solid #e4e4e7;
  font-size: 13px;
  font-weight: 600;
}

.addon input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #18181b;
  font: inherit;
}
```

## Notes

- This CSS Input with Prefix & Suffix is 45 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses transitions, box shadows and Flexbox.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
