Affix Input
Input fields with text prefixes or suffixes. Use inline affixes for simple symbols (like currency) or separated affixes with dividers for longer text (like URL protocols or email domains).
Inline Prefix
Use an inline prefix for short symbols like currency that appear directly in the input without a divider.
import { TextInput } from '@/components'
<TextInput label="Price" prefix="$" placeholder="0.00" />Separated Prefix
Use a separated prefix with a divider for longer text like URL protocols. Set prefixDivider to show the divider.
<TextInput
label="Website"
prefix="https://"
prefixDivider
placeholder="example.com"
/>Separated Suffix
Suffixes are separated by default when provided. Use this for email domains, file extensions, or other trailing text.
<TextInput
label="Email"
suffix="@gmail.com"
placeholder="username"
/>Inline Suffix
For inline suffixes without a divider, set suffixDivider={false}.
<TextInput
label="Weight"
suffix="kg"
suffixDivider={false}
placeholder="0"
/>Sizes
Affix inputs support all three sizes: small (36px), medium (40px, default), and large (44px).
Small (36px)
Medium (40px) - Default
Large (44px)
States
Affix inputs support all standard input states including default, filled, error, and disabled.
Default
Enter your website URL
Filled
Enter your website URL
Error
Please enter a valid URL
Disabled
Enter your website URL
Compound Components
For maximum flexibility, use the compound component API with Input.Prefix, Input.Suffix, and Input.Divider.
Inline prefix (compound)
Separated prefix (compound)
Separated suffix (compound)
Inline Prefix (Compound)
import { Input } from '@/components'
<Input.Root>
<Input.Label>Price</Input.Label>
<Input.Field className="pl-0">
<Input.Prefix>$</Input.Prefix>
<Input.NativeInput placeholder="0.00" />
</Input.Field>
</Input.Root>Separated Prefix (Compound)
<Input.Root>
<Input.Label>Website</Input.Label>
<Input.Field className="pl-0">
<Input.Prefix showDivider>https://</Input.Prefix>
<Input.NativeInput placeholder="example.com" />
</Input.Field>
</Input.Root>Separated Suffix (Compound)
<Input.Root>
<Input.Label>Email</Input.Label>
<Input.Field className="pr-0">
<Input.NativeInput placeholder="username" />
<Input.Suffix showDivider>@gmail.com</Input.Suffix>
</Input.Field>
</Input.Root>All Variants Overview
Inline Prefix
Small
Medium
Large
Separated Prefix
Small
Medium
Large
Separated Suffix
Small
Medium
Large
API Reference
TextInput Affix Props
| Prop | Type | Default | Description |
|---|---|---|---|
| prefix | string | - | Text to display before the input |
| suffix | string | - | Text to display after the input |
| prefixDivider | boolean | false | Show divider after prefix |
| suffixDivider | boolean | true when suffix is set | Show divider before suffix |
All other TextInput props (label, hint, error, size, etc.) are also supported.
Compound Components
| Component | Props | Description |
|---|---|---|
Input.Prefix | showDivider?: boolean | Text prefix container. Set showDivider to add a vertical divider after. |
Input.Suffix | showDivider?: boolean | Text suffix container. Set showDivider to add a vertical divider before. |
Input.Divider | - | Standalone vertical divider for custom layouts. |
When using compound components, add className="pl-0" to Input.Field for prefixes or className="pr-0" for suffixes to remove the default padding.