Skip to content
العربية
App patterns

AuthLayout

Sign-in, sign-up and verification pages: brand, title, form and links in a narrow column, with a picture panel from 1024 px. The recipes use the existing fields.

import { AuthLayout } from "@percentsa/ui";

Examples

Sign in

Welcome back. Sign in to see your projects.

Forgot password?
No account yet? Create one
Code
export function SignInExample() {
  const t = useT();
  return (
    <AuthLayout
      className={IN_CARD}
      title={t("Sign in", "تسجيل الدخول")}
      description={t("Welcome back. Sign in to see your projects.", "مرحبًا بعودتك. سجّل الدخول لترى مشاريعك.")}
      footer={
        <>
          {t("No account yet? ", "ليس لديك حساب؟ ")}
          <Link href="#sign-up">{t("Create one", "أنشئ حسابًا")}</Link>
        </>
      }
      aside={
        <div className="flex h-full flex-col justify-between gap-12 p-12">
          <Mark className="h-8" />
          <Blockquote cite={t("Sara, product lead", "سارة، قائدة المنتج")}>
            {t("We shipped the new portal in eight weeks.", "أطلقنا البوابة الجديدة في ثمانية أسابيع.")}
          </Blockquote>
        </div>
      }
    >
      <form onSubmit={noSubmit} className="grid gap-5">
        <Field label={t("Email", "البريد الإلكتروني")}>
          <Input type="email" name="email" autoComplete="email" dir="ltr" />
        </Field>
        <Field label={t("Password", "كلمة المرور")}>
          <PasswordInput name="password" />
        </Field>
        <div className="flex flex-wrap items-center justify-between gap-3">
          <Checkbox name="remember" label={t("Remember me", "تذكرني")} />
          <Link href="#forgot" className="text-sm">
            {t("Forgot password?", "نسيت كلمة المرور؟")}
          </Link>
        </div>
        <Button type="submit" size="lg">
          {t("Sign in", "تسجيل الدخول")}
        </Button>
      </form>
    </AuthLayout>
  );
}

Create your account

At least 12 characters.

Already have an account? Sign in
Code
export function SignUpExample() {
  const t = useT();
  return (
    <AuthLayout
      className={IN_CARD}
      title={t("Create your account", "أنشئ حسابك")}
      footer={
        <>
          {t("Already have an account? ", "لديك حساب بالفعل؟ ")}
          <Link href="#sign-in">{t("Sign in", "سجّل الدخول")}</Link>
        </>
      }
    >
      <form onSubmit={noSubmit} className="grid gap-5">
        <Field label={t("Full name", "الاسم الكامل")}>
          <Input name="name" autoComplete="name" />
        </Field>
        <Field label={t("Work email", "البريد الإلكتروني للعمل")}>
          <Input type="email" name="email" autoComplete="email" dir="ltr" />
        </Field>
        <Field label={t("Password", "كلمة المرور")} hint={t("At least 12 characters.", "12 حرفًا على الأقل.")}>
          <PasswordInput name="password" autoComplete="new-password" minLength={12} />
        </Field>
        <Checkbox name="terms" label={t("I agree to the terms and the privacy policy", "أوافق على الشروط وسياسة الخصوصية")} />
        <Button type="submit" size="lg">
          {t("Create account", "إنشاء الحساب")}
        </Button>
      </form>
    </AuthLayout>
  );
}

Reset your password

Enter your email. We will send you a link to set a new password.

Code
export function ForgotPasswordExample() {
  const t = useT();
  return (
    <AuthLayout
      className={IN_CARD}
      title={t("Reset your password", "إعادة تعيين كلمة المرور")}
      description={t("Enter your email. We will send you a link to set a new password.", "أدخل بريدك الإلكتروني وسنرسل إليك رابطًا لتعيين كلمة مرور جديدة.")}
      footer={
        <Link href="#sign-in" className="inline-flex items-center gap-2">
          <ArrowLeft aria-hidden className="size-4 rtl:-scale-x-100" />
          {t("Back to sign in", "العودة إلى تسجيل الدخول")}
        </Link>
      }
    >
      <form onSubmit={noSubmit} className="grid gap-5">
        <Field label={t("Email", "البريد الإلكتروني")}>
          <Input type="email" name="email" autoComplete="email" dir="ltr" />
        </Field>
        <Button type="submit" size="lg">
          {t("Send link", "إرسال الرابط")}
        </Button>
      </form>
    </AuthLayout>
  );
}

Check your phone

Enter the 6-digit code we sent to +966 5• ••• 1234

No code?
Code
export function OtpVerifyExample() {
  const t = useT();
  const [code, setCode] = useState("");
  return (
    <AuthLayout
      className={IN_CARD}
      title={t("Check your phone", "تحقق من جوالك")}
      description={
        <>
          {t("Enter the 6-digit code we sent to ", "أدخل الرمز المكوّن من 6 أرقام الذي أرسلناه إلى ")}
          <span dir="ltr">+966 5• ••• 1234</span>
        </>
      }
      footer={
        <>
          {t("No code? ", "لم يصلك الرمز؟ ")}
          <Button variant="link" size="lg">
            {t("Send it again", "أعد الإرسال")}
          </Button>
        </>
      }
    >
      <form onSubmit={noSubmit} className="grid gap-5">
        <OtpInput value={code} onValueChange={setCode} />
        <Button type="submit" size="lg" disabled={code.length < 6}>
          {t("Verify", "تحقق")}
        </Button>
      </form>
    </AuthLayout>
  );
}