Skip to content
Brok UI

Loading…

No results

Auth

Open source

Authentication screens — sign in / sign up with split brand panels, testimonial sidebars and patterned backdrops, plus two-factor, password-recovery and email-verification cards.

Preview

9 of 12
Layout

resources/views/blocks/auth-forgot-password.blade.php Blade
{{--
    Forgot password: a card that asks for the account email and posts it to
    `action` (for Fortify: route('password.email')). layout="page" (default)
    centres the card in its own full-height section; layout="card" renders only
    the card, for a host guest layout that already frames the page.

    After a submit, pass the host's neutral status in `status` (it renders as
    a polite success alert). Validation errors come from the shared `email`
    error bag entry. Put a bot check such as <x-ui.turnstile action="…" /> in
    the `botCheck` slot; it renders just above the submit button.
--}}
@props([
    'layout' => 'page',
    'heading' => 'Forgot your password?',
    'subheading' => "Enter the email linked to your account and we'll send you a link to reset your password.",
    'headingLevel' => 3,
    'icon' => true,
    'action' => '#',
    'status' => null,
    'statusDescription' => null,
    'email' => null,
    'emailLabel' => 'Email address',
    'placeholder' => 'you@example.com',
    'autofocus' => false,
    'submitLabel' => 'Send reset link',
    'loginHref' => '#',
    'loginLabel' => 'Back to sign in',
    'formId' => null,
])

@php
    $asCard = $layout === 'card';
    $level = in_array((int) $headingLevel, [1, 2, 3], true) ? (int) $headingLevel : 3;
@endphp

@php ob_start(); @endphp
    <x-ui.card @class(['w-full', 'max-w-sm' => ! $asCard]) :attributes="$asCard ? $attributes : new \Illuminate\View\ComponentAttributeBag()">
        <x-ui.card.header @class(['text-center' => $icon])>
            @if ($icon)
                <div class="mx-auto mb-2 flex size-12 items-center justify-center rounded-full border border-border bg-muted text-muted-foreground">
                    <svg class="size-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <circle cx="7.5" cy="15.5" r="3.5" />
                        <path d="m10 13 8.5-8.5" />
                        <path d="m15.5 7 2.5 2.5" />
                        <path d="m18.5 4 2.5 2.5" />
                    </svg>
                </div>
            @endif
            @if ($level === 3)
                <x-ui.card.title class="text-2xl">{{ __($heading) }}</x-ui.card.title>
            @else
                <h{{ $level }} data-slot="card-title" class="break-words text-xl font-semibold leading-none tracking-tight">{{ __($heading) }}</h{{ $level }}>
            @endif
            @if (filled($subheading))
                <x-ui.card.description>{{ __($subheading) }}</x-ui.card.description>
            @endif
        </x-ui.card.header>

        <x-ui.card.content class="space-y-6">
            @if (filled($status))
                <x-ui.alert variant="success" role="status">
                    <x-ui.alert.title>{{ __($status) }}</x-ui.alert.title>
                    @if (filled($statusDescription))
                        <x-ui.alert.description>{{ __($statusDescription) }}</x-ui.alert.description>
                    @endif
                </x-ui.alert>
            @endif

            <form method="POST" action="{{ $action }}" class="space-y-4" @if (filled($formId)) id="{{ $formId }}" @endif>
                @csrf

                <x-ui.field name="email">
                    <x-ui.label for="forgot-email" required>{{ __($emailLabel) }}</x-ui.label>
                    <x-ui.input id="forgot-email" type="email" autocomplete="email" required :value="$email" :placeholder="filled($placeholder) ? __($placeholder) : null" :autofocus="(bool) $autofocus" />
                </x-ui.field>

                {{ $botCheck ?? '' }}

                <x-ui.button type="submit" class="w-full">{{ __($submitLabel) }}</x-ui.button>
            </form>
        </x-ui.card.content>

        @if (filled($loginHref))
            <x-ui.card.footer class="justify-center">
                <a href="{{ $loginHref }}" class="inline-flex items-center gap-2 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground">
                    <svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="m12 19-7-7 7-7" />
                        <path d="M19 12H5" />
                    </svg>
                    {{ __($loginLabel) }}
                </a>
            </x-ui.card.footer>
        @endif
    </x-ui.card>
@php $card = new \Illuminate\Support\HtmlString(ob_get_clean()); @endphp

@if ($asCard)
    {{ $card }}
@else
    <x-ui.section space="md" class="flex min-h-svh items-center justify-center px-4" {{ $attributes }}>
        {{ $card }}
    </x-ui.section>
@endif

Installation

terminal
php artisan ui:add blocks/auth-forgot-password

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/auth-forgot-password writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.1.2
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/auth-forgot-password.blade.php

Registry dependencies

alert button card field input label section

Package dependencies

composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: what the block is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this block in an assistant.

auth-forgot-password.md
# Brok UI block: Forgot Password (`auth-forgot-password`)

A forgot-password card with an email field, a success status, a bot-check slot, a full-width reset-link button and a back-to-sign-in link, as its own centred page or as a card in a host layout.

Brok UI is a Laravel Blade registry. `ui:add` copies this block into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.

## Install

```bash
php artisan ui:add blocks/auth-forgot-password
```

## Render it

```blade
<x-blocks.auth-forgot-password layout="page" />
```

## Props

- `layout` (page|card, default `page`) (variant) — 'page' centres the card in its own full-height section; 'card' renders only the card for a host guest layout that already frames the page. Host attributes go to the section in page layout and to the card in card layout.
- `heading` (string, default `Forgot your password?`) — Card heading, passed through __().
- `subheading` (string, default `Enter the email linked to your account and we'll send you a link to reset your password.`) — Card description, passed through __(); empty hides it.
- `heading-level` (1|2|3, default `3`) — Heading element; 3 keeps the card title, 1 or 2 renders the page heading as h1 or h2.
- `icon` (boolean, default `true`) — Shows the key icon chip above the heading.
- `action` (string, default `#`) — Form action, for example route('password.email').
- `status` (string|null, default `null`) — Success status after a submit, shown as a polite alert. Use one neutral message for every address so the page does not reveal which addresses have an account.
- `status-description` (string|null, default `null`) — Second line under the status.
- `email` (string|null, default `null`) — Initial email value; old('email') wins after a failed submit.
- `email-label` (string, default `Email address`) — Email field label.
- `placeholder` (string|null, default `[email protected]`) — Email placeholder; empty hides it.
- `autofocus` (boolean, default `false`) — Focuses the email field on load.
- `submit-label` (string, default `Send reset link`) — Submit button label.
- `login-href` (string, default `#`) — Back-to-sign-in link; empty hides the footer.
- `login-label` (string, default `Back to sign in`) — Back-to-sign-in label.
- `form-id` (string|null, default `null`) — id of the form element.

## Use when

- Letting a user who forgot their password request a reset link by entering their account email.
- Linking back to sign-in for a user who remembers their password after all.

## Avoid when

- Use auth-reset-password for the follow-up screen where the user actually sets a new password.

## Rules

- Render the installed block with `<x-blocks.auth-forgot-password />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.

## Links

- Docs: https://brokui.dev/blocks/auth-forgot-password
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/auth-forgot-password.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

Guidance

Use when

  • Letting a user who forgot their password request a reset link by entering their account email.
  • Linking back to sign-in for a user who remembers their password after all.

Avoid when

  • Use auth-reset-password for the follow-up screen where the user actually sets a new password.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.auth-forgot-password />

The controls above the preview are props on this composition. What you picked reads:

Built from primitives

Composes <brok:*> Semantic tokens Re-themeable RTL-ready

This block composes installed <brok:*> primitives and semantic design tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by editing CSS variables; flip the preview to RTL to confirm it mirrors.

Source

The exact, editable file ui:add writes into your app. The preview above renders this same source — there are no preview-only blocks.

resources/views/blocks/auth-forgot-password.blade.php Blade
{{--
    Forgot password: a card that asks for the account email and posts it to
    `action` (for Fortify: route('password.email')). layout="page" (default)
    centres the card in its own full-height section; layout="card" renders only
    the card, for a host guest layout that already frames the page.

    After a submit, pass the host's neutral status in `status` (it renders as
    a polite success alert). Validation errors come from the shared `email`
    error bag entry. Put a bot check such as <x-ui.turnstile action="…" /> in
    the `botCheck` slot; it renders just above the submit button.
--}}
@props([
    'layout' => 'page',
    'heading' => 'Forgot your password?',
    'subheading' => "Enter the email linked to your account and we'll send you a link to reset your password.",
    'headingLevel' => 3,
    'icon' => true,
    'action' => '#',
    'status' => null,
    'statusDescription' => null,
    'email' => null,
    'emailLabel' => 'Email address',
    'placeholder' => 'you@example.com',
    'autofocus' => false,
    'submitLabel' => 'Send reset link',
    'loginHref' => '#',
    'loginLabel' => 'Back to sign in',
    'formId' => null,
])

@php
    $asCard = $layout === 'card';
    $level = in_array((int) $headingLevel, [1, 2, 3], true) ? (int) $headingLevel : 3;
@endphp

@php ob_start(); @endphp
    <x-ui.card @class(['w-full', 'max-w-sm' => ! $asCard]) :attributes="$asCard ? $attributes : new \Illuminate\View\ComponentAttributeBag()">
        <x-ui.card.header @class(['text-center' => $icon])>
            @if ($icon)
                <div class="mx-auto mb-2 flex size-12 items-center justify-center rounded-full border border-border bg-muted text-muted-foreground">
                    <svg class="size-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <circle cx="7.5" cy="15.5" r="3.5" />
                        <path d="m10 13 8.5-8.5" />
                        <path d="m15.5 7 2.5 2.5" />
                        <path d="m18.5 4 2.5 2.5" />
                    </svg>
                </div>
            @endif
            @if ($level === 3)
                <x-ui.card.title class="text-2xl">{{ __($heading) }}</x-ui.card.title>
            @else
                <h{{ $level }} data-slot="card-title" class="break-words text-xl font-semibold leading-none tracking-tight">{{ __($heading) }}</h{{ $level }}>
            @endif
            @if (filled($subheading))
                <x-ui.card.description>{{ __($subheading) }}</x-ui.card.description>
            @endif
        </x-ui.card.header>

        <x-ui.card.content class="space-y-6">
            @if (filled($status))
                <x-ui.alert variant="success" role="status">
                    <x-ui.alert.title>{{ __($status) }}</x-ui.alert.title>
                    @if (filled($statusDescription))
                        <x-ui.alert.description>{{ __($statusDescription) }}</x-ui.alert.description>
                    @endif
                </x-ui.alert>
            @endif

            <form method="POST" action="{{ $action }}" class="space-y-4" @if (filled($formId)) id="{{ $formId }}" @endif>
                @csrf

                <x-ui.field name="email">
                    <x-ui.label for="forgot-email" required>{{ __($emailLabel) }}</x-ui.label>
                    <x-ui.input id="forgot-email" type="email" autocomplete="email" required :value="$email" :placeholder="filled($placeholder) ? __($placeholder) : null" :autofocus="(bool) $autofocus" />
                </x-ui.field>

                {{ $botCheck ?? '' }}

                <x-ui.button type="submit" class="w-full">{{ __($submitLabel) }}</x-ui.button>
            </form>
        </x-ui.card.content>

        @if (filled($loginHref))
            <x-ui.card.footer class="justify-center">
                <a href="{{ $loginHref }}" class="inline-flex items-center gap-2 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground">
                    <svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="m12 19-7-7 7-7" />
                        <path d="M19 12H5" />
                    </svg>
                    {{ __($loginLabel) }}
                </a>
            </x-ui.card.footer>
        @endif
    </x-ui.card>
@php $card = new \Illuminate\Support\HtmlString(ob_get_clean()); @endphp

@if ($asCard)
    {{ $card }}
@else
    <x-ui.section space="md" class="flex min-h-svh items-center justify-center px-4" {{ $attributes }}>
        {{ $card }}
    </x-ui.section>
@endif

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.1.2
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0