Skip to content
Klarhimmel UI
auth-magic-link previewauth-magic-link preview

Install

npx shadcn add @klarhimmel/button @klarhimmel/card @klarhimmel/input
DetailsAbout, usage, props and more

One field. We send a link that signs you in.

Source

The screen as installed by the command above. Render it inside Theme, once near the root of your app.

magic-link.tsx
import { Button } from '@/components/klarhimmel/ui/button';
import { Card } from '@/components/klarhimmel/ui/card';
import { Field, Input } from '@/components/klarhimmel/ui/input';

/** A sign-in card that sends a magic link. */
export default function AuthMagicLink() {
  return (
    <Card variant="raised" className="w-full max-w-sm p-8">
      <h3 className="text-kh-heading font-semibold">Sign in to Northlight</h3>
      <p className="mt-1 text-kh-small text-kh-muted">We will email you a link that signs you in. No password needed.</p>
      <form className="mt-6 flex flex-col gap-4" onSubmit={(e) => e.preventDefault()}>
        <Field label="Email" hint="Use the address you signed up with.">
          {(p) => <Input type="email" placeholder="you@northlight.example" autoComplete="email" {...p} />}
        </Field>
        <Button type="submit" full>Send magic link</Button>
      </form>
    </Card>
  );
}

Install

Installs

button
card
input
Uses
  • Card
  • Field
  • Input
  • Button
States
Empty and filled. The page sends the email and shows the next step. New project? Set it up once: /get-started/installation.