# Auth Forms ## UAuthForm (recommended) `UAuthForm` provides a complete auth form with fields, providers, validation, and submit — no manual `UForm` + `UFormField` wiring needed. Wrap it in `UPageCard` for a polished look. ```vue [pages/login.vue] ``` ### UAuthForm key props | Prop | Purpose | | ------------------------------ | ------------------------------------------------------------------------------- | | `title`, `description`, `icon` | Header content | | `fields` | `AuthFormField[]` — each has `name`, `type`, `label`, `placeholder`, `required` | | `providers` | `ButtonProps[]` — social login buttons shown above/below the form | | `schema` | Zod/Valibot schema for validation | | `submit` | Customize submit button: `{ label: 'Sign in', block: true }` | | `separator` | Text between providers and fields (default: `'or'`) | ### UAuthForm key slots | Slot | Purpose | | ---------------- | --------------------------------------------- | | `#description` | Override description (e.g., add sign-up link) | | `#password-hint` | "Forgot password?" link on password field | | `#validation` | Custom error display (e.g., `UAlert`) | | `#footer` | Terms of service, sign-up link | | `#-field` | Override a specific field's rendering | ## Custom auth layout For layouts where `UAuthForm` is too opinionated, use `UCard` + `UForm` + `UFormField` directly. ```vue [pages/login.vue] ``` ## Tips - Prefer `UAuthForm` with `UPageCard` for standard auth pages — handles layout, providers, validation, and submit - Use `import * as z from 'zod'` and `z.email()` (Zod 4 syntax) - Type the submit handler: `function onSubmit(event: FormSubmitEvent)` — access validated data via `event.data` - Center auth forms with `flex min-h-dvh items-center justify-center` - Place "Forgot password?" link as `#password-hint` slot on `UAuthForm`, or `#hint` slot on `UFormField` - Social login buttons: use `providers` prop on `UAuthForm`, or add manually with ``