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

1 of 12
Layout

resources/views/blocks/auth-sign-in.blade.php Blade
{{--
    Sign in: a card with email and password fields that posts to `action`
    (for Fortify: route('login')). 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.

    Every link is a prop; pass false or '' to hide it (the forgot
    password link, the sign-up footer). Every visible text is a prop and goes
    through __(). Validation errors come from the shared `email` and
    `password` error bag entries and are tied to their fields. The `providers`
    slot replaces the default social button; social=false hides the divider
    and the buttons. `brand` (a label) or the `brand` slot shows the product
    lockup: above the card with layout="page", at the top of the card header
    with layout="card". The output has no inline style, script or event handler,
    so it runs under a strict Content-Security-Policy.
--}}
@props([
    'layout' => 'page',
    // Product name for a brand lockup (the brand item); null shows none. The
    // `brand` slot replaces the lockup, for example a brand with a logo.
    'brand' => null,
    'brandHref' => null,
    'heading' => 'Welcome back',
    'subheading' => 'Sign in to your account to continue.',
    'headingLevel' => 3,
    'action' => '#',
    'formId' => null,
    'email' => null,
    'emailLabel' => 'Email address',
    'emailPlaceholder' => 'you@example.com',
    'emailAutocomplete' => 'email',
    'autofocus' => false,
    'passwordLabel' => 'Password',
    'forgotHref' => '#',
    'forgotLabel' => 'Forgot password?',
    'remember' => true,
    'rememberLabel' => 'Remember me',
    'submitLabel' => 'Sign in',
    'social' => true,
    'socialDividerLabel' => 'Or continue with',
    'socialLabel' => 'Sign in with Google',
    'registerHref' => '#',
    'registerPrompt' => "Don't have an account?",
    'registerLabel' => 'Sign up',
])

@php
    $asCard = $layout === 'card';
    $level = in_array((int) $headingLevel, [1, 2, 3], true) ? (int) $headingLevel : 3;
    $showsLink = static fn (mixed $href): bool => $href !== false && filled($href);
    $emailAutocomplete = filled($emailAutocomplete) ? (string) $emailAutocomplete : 'email';
    // A `brand` slot arrives in $brand as a ComponentSlot; a string is a label.
    $brandSlot = $brand instanceof \Illuminate\View\ComponentSlot ? $brand : null;
    $hasBrand = $brandSlot !== null ? $brandSlot->hasActualContent() : filled($brand);
    $brandLockup = null;
@endphp

@if ($hasBrand)
    @php ob_start(); @endphp
    <div data-slot="auth-sign-in-brand" class="flex justify-center">
        @if ($brandSlot !== null)
            {{ $brandSlot }}
        @else
            <x-ui.brand :label="(string) $brand" :href="filled($brandHref) ? $brandHref : null" />
        @endif
    </div>
    @php $brandLockup = new \Illuminate\Support\HtmlString(ob_get_clean()); @endphp
@endif

@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">
            @if ($asCard && $brandLockup !== null)
                {{ $brandLockup }}
            @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-2xl 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>
            <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="login-email" required>{{ __($emailLabel) }}</x-ui.label>
                    <x-ui.input id="login-email" type="email" :autocomplete="$emailAutocomplete" required :value="$email" :placeholder="filled($emailPlaceholder) ? __($emailPlaceholder) : null" :autofocus="(bool) $autofocus" />
                </x-ui.field>

                <x-ui.field name="password">
                    @if ($showsLink($forgotHref))
                        <div class="flex items-center justify-between">
                            <x-ui.label for="login-password" required>{{ __($passwordLabel) }}</x-ui.label>
                            <a href="{{ $forgotHref }}" class="text-sm font-medium text-link hover:underline">{{ __($forgotLabel) }}</a>
                        </div>
                    @else
                        <x-ui.label for="login-password" required>{{ __($passwordLabel) }}</x-ui.label>
                    @endif
                    <x-ui.input id="login-password" type="password" autocomplete="current-password" required />
                </x-ui.field>

                @if ($remember)
                    <label class="flex items-center gap-2 text-sm text-muted-foreground">
                        <x-ui.checkbox name="remember" />
                        {{ __($rememberLabel) }}
                    </label>
                @endif

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

            @if ($social)
                <div class="my-6 flex items-center gap-4">
                    <x-ui.separator class="flex-1" />
                    <span class="text-xs uppercase tracking-wide text-muted-foreground">{{ __($socialDividerLabel) }}</span>
                    <x-ui.separator class="flex-1" />
                </div>

                @isset($providers)
                    <div data-slot="auth-sign-in-providers" class="flex flex-col gap-2">{{ $providers }}</div>
                @else
                    <x-ui.social-button provider="google" type="button" block :label="__($socialLabel)" />
                @endisset
            @endif
        </x-ui.card.content>

        @if ($showsLink($registerHref))
            <x-ui.card.footer class="justify-center">
                <p class="text-sm text-muted-foreground">
                    {{ __($registerPrompt) }}
                    <a href="{{ $registerHref }}" class="font-medium text-link hover:underline">{{ __($registerLabel) }}</a>
                </p>
            </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', 'flex-col gap-6' => $brandLockup !== null]) {{ $attributes }}>
        {{ $brandLockup }}
        {{ $card }}
    </x-ui.section>
@endif

Installation

terminal
php artisan ui:add blocks/auth-sign-in

Registry contract

Install confidence

php artisan ui:add blocks/auth-sign-in 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.3.0
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/auth-sign-in.blade.php

Registry dependencies

button card checkbox field input label section separator social-button brand

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-sign-in.md
# Brok UI block: Login (`auth-sign-in`)

A centered login card with email/password fields, remember-me, social sign-in, and sign-up link.

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-sign-in
```

## Render it

```blade
<x-blocks.auth-sign-in 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.
- `brand` (string|null, default `null`) — Product name shown as a brand lockup (the brand item): above the card with layout="page", at the top of the card header with layout="card". The brand slot replaces the lockup (for example a logo).
- `brand-href` (string|null, default `null`) — Makes the brand lockup a link.
- `heading` (string, default `Welcome back`) — Card heading, passed through __().
- `subheading` (string, default `Sign in to your account to continue.`) — 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.
- `action` (string, default `#`) — Form action, for example route('login').
- `form-id` (string|null, default `null`) — id of the form element.
- `email` (string|null, default `null`) — Initial email value; old('email') wins after a failed submit.
- `email-label` (string, default `Email address`) — Email field label.
- `email-placeholder` (string|null, default `[email protected]`) — Email placeholder; empty hides it.
- `email-autocomplete` (string, default `email`) — autocomplete token of the email field, for example 'username' when the email is the account name.
- `autofocus` (boolean, default `false`) — Focuses the email field on load.
- `password-label` (string, default `Password`) — Password field label.
- `forgot-href` (string|false, default `#`) — Forgot-password link; false or '' hides it.
- `forgot-label` (string, default `Forgot password?`) — Forgot-password link text.
- `remember` (boolean, default `true`) — Shows the remember-me checkbox (posts remember).
- `remember-label` (string, default `Remember me`) — Remember-me label.
- `submit-label` (string, default `Sign in`) — Submit button label.
- `social` (boolean, default `true`) — Shows the divider and the social sign-in button (or the providers slot).
- `social-divider-label` (string, default `Or continue with`) — Divider text above the social buttons.
- `social-label` (string, default `Sign in with Google`) — Label of the default Google button.
- `register-href` (string|false, default `#`) — Sign-up link; false or '' hides the footer.
- `register-prompt` (string, default `Don't have an account?`) — Text before the sign-up link.
- `register-label` (string, default `Sign up`) — Sign-up link text.

## Use when

- Signing a returning user in with a centred email/password card, a remember-me checkbox and social sign-in buttons.
- Linking out to registration and a forgot-password flow from the same card.

## Avoid when

- Use auth-passwordless for passwordless sign-in, or auth-split/auth-testimonial for a two-column layout with a brand or testimonial panel.

## Rules

- Render the installed block with `<x-blocks.auth-sign-in />` 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-sign-in
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/auth-sign-in.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

  • Signing a returning user in with a centred email/password card, a remember-me checkbox and social sign-in buttons.
  • Linking out to registration and a forgot-password flow from the same card.

Avoid when

  • Use auth-passwordless for passwordless sign-in, or auth-split/auth-testimonial for a two-column layout with a brand or testimonial panel.

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-sign-in />

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-sign-in.blade.php Blade
{{--
    Sign in: a card with email and password fields that posts to `action`
    (for Fortify: route('login')). 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.

    Every link is a prop; pass false or '' to hide it (the forgot
    password link, the sign-up footer). Every visible text is a prop and goes
    through __(). Validation errors come from the shared `email` and
    `password` error bag entries and are tied to their fields. The `providers`
    slot replaces the default social button; social=false hides the divider
    and the buttons. `brand` (a label) or the `brand` slot shows the product
    lockup: above the card with layout="page", at the top of the card header
    with layout="card". The output has no inline style, script or event handler,
    so it runs under a strict Content-Security-Policy.
--}}
@props([
    'layout' => 'page',
    // Product name for a brand lockup (the brand item); null shows none. The
    // `brand` slot replaces the lockup, for example a brand with a logo.
    'brand' => null,
    'brandHref' => null,
    'heading' => 'Welcome back',
    'subheading' => 'Sign in to your account to continue.',
    'headingLevel' => 3,
    'action' => '#',
    'formId' => null,
    'email' => null,
    'emailLabel' => 'Email address',
    'emailPlaceholder' => 'you@example.com',
    'emailAutocomplete' => 'email',
    'autofocus' => false,
    'passwordLabel' => 'Password',
    'forgotHref' => '#',
    'forgotLabel' => 'Forgot password?',
    'remember' => true,
    'rememberLabel' => 'Remember me',
    'submitLabel' => 'Sign in',
    'social' => true,
    'socialDividerLabel' => 'Or continue with',
    'socialLabel' => 'Sign in with Google',
    'registerHref' => '#',
    'registerPrompt' => "Don't have an account?",
    'registerLabel' => 'Sign up',
])

@php
    $asCard = $layout === 'card';
    $level = in_array((int) $headingLevel, [1, 2, 3], true) ? (int) $headingLevel : 3;
    $showsLink = static fn (mixed $href): bool => $href !== false && filled($href);
    $emailAutocomplete = filled($emailAutocomplete) ? (string) $emailAutocomplete : 'email';
    // A `brand` slot arrives in $brand as a ComponentSlot; a string is a label.
    $brandSlot = $brand instanceof \Illuminate\View\ComponentSlot ? $brand : null;
    $hasBrand = $brandSlot !== null ? $brandSlot->hasActualContent() : filled($brand);
    $brandLockup = null;
@endphp

@if ($hasBrand)
    @php ob_start(); @endphp
    <div data-slot="auth-sign-in-brand" class="flex justify-center">
        @if ($brandSlot !== null)
            {{ $brandSlot }}
        @else
            <x-ui.brand :label="(string) $brand" :href="filled($brandHref) ? $brandHref : null" />
        @endif
    </div>
    @php $brandLockup = new \Illuminate\Support\HtmlString(ob_get_clean()); @endphp
@endif

@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">
            @if ($asCard && $brandLockup !== null)
                {{ $brandLockup }}
            @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-2xl 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>
            <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="login-email" required>{{ __($emailLabel) }}</x-ui.label>
                    <x-ui.input id="login-email" type="email" :autocomplete="$emailAutocomplete" required :value="$email" :placeholder="filled($emailPlaceholder) ? __($emailPlaceholder) : null" :autofocus="(bool) $autofocus" />
                </x-ui.field>

                <x-ui.field name="password">
                    @if ($showsLink($forgotHref))
                        <div class="flex items-center justify-between">
                            <x-ui.label for="login-password" required>{{ __($passwordLabel) }}</x-ui.label>
                            <a href="{{ $forgotHref }}" class="text-sm font-medium text-link hover:underline">{{ __($forgotLabel) }}</a>
                        </div>
                    @else
                        <x-ui.label for="login-password" required>{{ __($passwordLabel) }}</x-ui.label>
                    @endif
                    <x-ui.input id="login-password" type="password" autocomplete="current-password" required />
                </x-ui.field>

                @if ($remember)
                    <label class="flex items-center gap-2 text-sm text-muted-foreground">
                        <x-ui.checkbox name="remember" />
                        {{ __($rememberLabel) }}
                    </label>
                @endif

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

            @if ($social)
                <div class="my-6 flex items-center gap-4">
                    <x-ui.separator class="flex-1" />
                    <span class="text-xs uppercase tracking-wide text-muted-foreground">{{ __($socialDividerLabel) }}</span>
                    <x-ui.separator class="flex-1" />
                </div>

                @isset($providers)
                    <div data-slot="auth-sign-in-providers" class="flex flex-col gap-2">{{ $providers }}</div>
                @else
                    <x-ui.social-button provider="google" type="button" block :label="__($socialLabel)" />
                @endisset
            @endif
        </x-ui.card.content>

        @if ($showsLink($registerHref))
            <x-ui.card.footer class="justify-center">
                <p class="text-sm text-muted-foreground">
                    {{ __($registerPrompt) }}
                    <a href="{{ $registerHref }}" class="font-medium text-link hover:underline">{{ __($registerLabel) }}</a>
                </p>
            </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', 'flex-col gap-6' => $brandLockup !== null]) {{ $attributes }}>
        {{ $brandLockup }}
        {{ $card }}
    </x-ui.section>
@endif

Ownership & lifecycle

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