# Recipient Input

> Address chips for To, Cc and Bcc.

Component · Forms · Halo kit · [Live page](https://ui.twentyfirst.media/halo/components/RecipientInput/)

Address chips for To, Cc and Bcc. Type and press Enter, comma or Tab; pick from `suggestions` (or `suggest`, asked while typing) with the arrow keys; paste several addresses at once (`a@x.com, Bo Lee <bo@y.com>`). Invalid addresses stay as red chips with a message, Backspace in the empty field removes the last chip. The value is a list of `{ address, name? }`; `parseRecipients` and `isEmailAddress` are exported too.

## Example

```tsx
import * as React from "react";
import { RecipientInput } from "@twentyfirstmedia/halo";
import type { MailRecipient } from "@twentyfirstmedia/halo";
import { PEOPLE } from "./_mail";

export default function Preview() {
  const [to, setTo] = React.useState<MailRecipient[]>([PEOPLE[0]!, { address: "noah.berg@" }]);
  return (
    <div className="tf-panel" style={{ gap: 16, minHeight: 300 }}>
      <RecipientInput
        label="To"
        value={to}
        onChange={setTo}
        suggestions={PEOPLE}
        placeholder="Name or address"
        hint="Paste several addresses at once, separated by commas."
      />
    </div>
  );
}
```

## Props

### RecipientInput

| Prop | Type | Notes |
| --- | --- | --- |
| `label` | `string` | Required |
| `hideLabel?` | `boolean` |  |
| `id?` | `string` |  |
| `value?` | `MailRecipient[]` | The addresses (controlled) / initially / on change. |
| `defaultValue?` | `MailRecipient[]` |  |
| `onChange?` | `(value: MailRecipient[]) => void` |  |
| `suggestions?` | `MailRecipient[]` | Known addresses, filtered while typing. |
| `suggest?` | `(typed: string) => MailRecipient[] \| Promise<MailRecipient[]>` | Or ask your server while typing (debounced). |
| `validate?` | `(address: string) => boolean` | Your own address check (default: a plain e-mail pattern). |
| `placeholder?` | `string` |  |
| `hint?` | `string` |  |
| `error?` | `string` |  |
| `disabled?` | `boolean` |  |
| `autoFocus?` | `boolean` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
