Skip to content
Klarhimmel UI

App, invite form

App, invite form previewApp, invite form preview

Install

npx shadcn add @klarhimmel/app-team-invite
DetailsAbout, usage, props and more

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).

Import

Import

import Block from '@/components/klarhimmel/blocks/app-team-invite';
Also called
  • app/team-invite
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).
Category
Interface sections for signed-in products. New project? Set it up once: /get-started/installation.

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.

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.

PropTypeDefaultDescription
eyebrowstring'Team'Text, up to 60 characters. Optional; empty is not rendered.
titlestring'Say who is invited'Text, up to 120 characters.
descriptionstring'Say what the person gets and how lo…'Text, up to 300 characters. Optional; empty is not rendered.
emailLabelstring'Email address'Text, up to 40 characters.
emailHintstring'Say which address to use.'Text, up to 120 characters. Optional; empty is not rendered.
samplestring''Text, up to 60 characters.
roleLabelstring'Role'Text, up to 40 characters.
rolesstring[]3 itemsList of 2 to 5.
activestring'Member'Text, up to 20 characters.
actions{ send, sending }{…}Fields: send, sending.
state'idle' | 'sending' | 'sent' | 'error''idle'One of 'idle', 'sending', 'sent', 'error'.
messages{ sent, error, emailError }{…}Fields: sent, error, emailError.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.