# Invite form

- **[App UI](/app/)**
- **[Team](/app/team/)**
- **Invite form**

Invite someone: an email field with a hint, a role select and a send button, with four states (idle, sending, sent, error with the field marked and described).

## Notes

- **When to use it**: A small form to invite one person by email and role. Use `app-team-pending` after it to show invites not yet accepted and `app-team-members` for those who have joined; this block only collects the address.
- **Writing for it**: - The emailLabel and roleLabel are required, 40 characters each. Use the hint (120) for a rule people get wrong, such as work email only.
- roles takes 2 to 5 names of at most 20 characters. active must be one of them, since it sets what the select starts on.
- messages.emailError (120) is shown under the field and should show the format, as in name@example.com. The sent message should say where the invite shows up next.
- **Watch out for**: The form checks only the shape of the address with a simple pattern, and it never posts anywhere. sample is the starting value and is usually left empty, so a filled sample appears as if the person had typed it.

## Pairs well with

- **[App, pending invites](/blocks/app/team-pending)**
- **[App, member list](/blocks/app/team-members)**
- **[App, profile settings](/blocks/app/settings-profile)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppTeamInvite from '@/components/klarhimmel/blocks/app-team-invite';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppTeamInvite props={{
          "eyebrow": "Team",
          "title": "Say who is invited",
          "description": "Say what the person gets and how long the link lasts.",
          "emailLabel": "Email address",
          "emailHint": "Say which address to use.",
          "sample": "",
          "roleLabel": "Role",
          "roles": [
            "Admin",
            "Member",
            "Viewer"
          ],
          "active": "Member",
          "actions": {
            "send": "Send invite",
            "sending": "Sending…"
          },
          "state": "idle",
          "messages": {
            "sent": "Say the invite went out and where it shows up.",
            "error": "Say the invite was not sent and what to check, then retry.",
            "emailError": "Say what a valid email address looks like."
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

- **eyebrow**: Text, up to 60 characters. Optional; empty is not rendered.
- **title**: Text, up to 120 characters.
- **description**: Text, up to 300 characters. Optional; empty is not rendered.
- **emailLabel**: Text, up to 40 characters.
- **emailHint**: Text, up to 120 characters. Optional; empty is not rendered.
- **sample**: Text, up to 60 characters.
- **roleLabel**: Text, up to 40 characters.
- **roles**: List of 2 to 5.
- **active**: Text, up to 20 characters.
- **actions**: Fields: send, sending.
- **state**: One of 'idle', 'sending', 'sent', 'error'.
- **messages**: Fields: sent, error, emailError.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

## Install

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-team-invite
  ```

Uses

- Banner
- Button
- Input
- NativeSelect

- **About**: Invite someone: an email field with a hint, a role select and a send button, with four states (idle, sending, sent, error with the field marked and described).
- **States**: Idle, sending, sent and error (the email field is marked and described). Set with the state prop. New project? Set it up once: /get-started/installation.
