Skip to content
Brok UI

Loading…

No results

Empty State

Open source

Empty-state sections — a general first-use prompt and a no-search-results variant.

Preview

resources/views/blocks/empty-state-create.blade.php Blade
@props([
    'heading'     => 'Create your first project',
    'lead'        => 'Start from scratch or pick a template below to hit the ground running. You can always change this later.',
    'primaryCta'  => 'New project',
    'primaryHref' => '#',
    'importCta'   => 'Import',
    'importHref'  => '#',
    'templates'   => null,
])

@php
    $templates ??= [
        ['icon' => 'layout', 'badge' => 'Popular', 'title' => 'Blank canvas', 'description' => 'Start with an empty project and build exactly what you need.', 'href' => '#'],
        ['icon' => 'monitor', 'badge' => 'Starter', 'title' => 'Landing page', 'description' => 'A pre-built landing page with hero, features, and CTA sections.', 'href' => '#'],
        ['icon' => 'chart', 'badge' => 'Starter', 'title' => 'Dashboard', 'description' => 'Analytics dashboard shell with sidebar navigation and metric cards.', 'href' => '#'],
    ];
    $icons = ['layout' => '<path d="M3 3h18v7H3zM3 14h8v7H3zM15 14h6v7h-6z"/>', 'monitor' => '<rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8M12 17v4"/>', 'chart' => '<path d="M12 20V10M18 20V4M6 20v-6"/>'];
@endphp

<x-ui.section space="lg" {{ $attributes }}>
    <x-ui.container size="sm">
        <x-ui.empty variant="plain" size="sm">
            <x-ui.empty.header class="max-w-lg">
                <x-ui.empty.media variant="outline" size="lg" data-animate="pop" class="border-2 border-dashed bg-muted text-muted-foreground">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg>
                </x-ui.empty.media>
                <x-ui.empty.title as="h2" data-animate="rise" data-animate-order="1" class="!text-2xl font-semibold tracking-tight">{{ __($heading) }}</x-ui.empty.title>
                <x-ui.empty.description data-animate="rise" data-animate-order="2">{{ __($lead) }}</x-ui.empty.description>
            </x-ui.empty.header>

            <x-ui.empty.content data-animate="rise" data-animate-order="3" class="gap-4 sm:flex-row sm:justify-center">
                <x-ui.button :href="$primaryHref" class="w-full sm:w-auto">
                    <x-slot:icon><svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg></x-slot:icon>
                    {{ __($primaryCta) }}
                </x-ui.button>
                <x-ui.button variant="ghost" :href="$importHref" class="w-full sm:w-auto">
                    <x-slot:icon><svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" /></svg></x-slot:icon>
                    {{ __($importCta) }}
                </x-ui.button>
            </x-ui.empty.content>
        </x-ui.empty>

        <div class="relative mb-8 mt-10" aria-hidden="true">
            <span class="absolute inset-0 flex items-center"><span class="w-full border-t border-border"></span></span>
            <span class="relative flex justify-center"><span class="bg-background px-4 text-xs font-medium uppercase tracking-widest text-muted-foreground">{{ __('Or start from a template') }}</span></span>
        </div>

        <div data-animate="rise" data-animate-order="4" class="grid grid-cols-1 gap-4 sm:grid-cols-3">
            @foreach ($templates as $template)
                <a href="{{ $template['href'] }}" class="group block rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2">
                    <x-ui.card class="h-full p-6 transition-colors duration-150 hover:border-primary/40 hover:bg-muted/50">
                        <div class="flex items-start justify-between gap-2">
                            <span class="flex size-10 shrink-0 items-center justify-center rounded-md bg-muted text-foreground" aria-hidden="true">
                                <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">{!! $icons[$template['icon']] ?? $icons['layout'] !!}</svg>
                            </span>
                            @if (! empty($template['badge']))<x-ui.badge variant="secondary" size="sm">{{ __($template['badge']) }}</x-ui.badge>@endif
                        </div>
                        <p class="mt-4 text-sm font-semibold leading-snug text-foreground">{{ __($template['title']) }}</p>
                        <p class="mt-2 text-xs leading-relaxed text-muted-foreground">{{ __($template['description']) }}</p>
                    </x-ui.card>
                </a>
            @endforeach
        </div>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/empty-state-create

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/empty-state-create 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.2.1
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/empty-state-create.blade.php

Registry dependencies

button card badge section container empty

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.

empty-state-create.md
# Brok UI block: Empty State Create (`empty-state-create`)

A first-run create empty state with an icon, heading, primary and import actions, and a row of starter-template cards.

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/empty-state-create
```

## Render it

```blade
<x-blocks.empty-state-create />
```

## Props

- `heading` (string, default `Create your first project`)
- `lead` (string, default `Start from scratch or pick a template below to hit the ground running. You can always change this later.`)
- `primary-cta` (string, default `New project`)
- `primary-href` (string, default `#`)
- `import-cta` (string, default `Import`)
- `import-href` (string, default `#`)
- `templates` (mixed|null, default `null`)

## Use when

- Guiding a first-time user to create their first project via a primary action plus a row of starter-template cards.
- Offering an import action beside the primary create action for users migrating existing content.

## Avoid when

- Use empty-state-default for a simpler empty state without starter templates, or empty-state-no-results for a no-results state.

## Rules

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

  • Guiding a first-time user to create their first project via a primary action plus a row of starter-template cards.
  • Offering an import action beside the primary create action for users migrating existing content.

Avoid when

  • Use empty-state-default for a simpler empty state without starter templates, or empty-state-no-results for a no-results state.

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.empty-state-create />

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/empty-state-create.blade.php Blade
@props([
    'heading'     => 'Create your first project',
    'lead'        => 'Start from scratch or pick a template below to hit the ground running. You can always change this later.',
    'primaryCta'  => 'New project',
    'primaryHref' => '#',
    'importCta'   => 'Import',
    'importHref'  => '#',
    'templates'   => null,
])

@php
    $templates ??= [
        ['icon' => 'layout', 'badge' => 'Popular', 'title' => 'Blank canvas', 'description' => 'Start with an empty project and build exactly what you need.', 'href' => '#'],
        ['icon' => 'monitor', 'badge' => 'Starter', 'title' => 'Landing page', 'description' => 'A pre-built landing page with hero, features, and CTA sections.', 'href' => '#'],
        ['icon' => 'chart', 'badge' => 'Starter', 'title' => 'Dashboard', 'description' => 'Analytics dashboard shell with sidebar navigation and metric cards.', 'href' => '#'],
    ];
    $icons = ['layout' => '<path d="M3 3h18v7H3zM3 14h8v7H3zM15 14h6v7h-6z"/>', 'monitor' => '<rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8M12 17v4"/>', 'chart' => '<path d="M12 20V10M18 20V4M6 20v-6"/>'];
@endphp

<x-ui.section space="lg" {{ $attributes }}>
    <x-ui.container size="sm">
        <x-ui.empty variant="plain" size="sm">
            <x-ui.empty.header class="max-w-lg">
                <x-ui.empty.media variant="outline" size="lg" data-animate="pop" class="border-2 border-dashed bg-muted text-muted-foreground">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg>
                </x-ui.empty.media>
                <x-ui.empty.title as="h2" data-animate="rise" data-animate-order="1" class="!text-2xl font-semibold tracking-tight">{{ __($heading) }}</x-ui.empty.title>
                <x-ui.empty.description data-animate="rise" data-animate-order="2">{{ __($lead) }}</x-ui.empty.description>
            </x-ui.empty.header>

            <x-ui.empty.content data-animate="rise" data-animate-order="3" class="gap-4 sm:flex-row sm:justify-center">
                <x-ui.button :href="$primaryHref" class="w-full sm:w-auto">
                    <x-slot:icon><svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14" /></svg></x-slot:icon>
                    {{ __($primaryCta) }}
                </x-ui.button>
                <x-ui.button variant="ghost" :href="$importHref" class="w-full sm:w-auto">
                    <x-slot:icon><svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" /></svg></x-slot:icon>
                    {{ __($importCta) }}
                </x-ui.button>
            </x-ui.empty.content>
        </x-ui.empty>

        <div class="relative mb-8 mt-10" aria-hidden="true">
            <span class="absolute inset-0 flex items-center"><span class="w-full border-t border-border"></span></span>
            <span class="relative flex justify-center"><span class="bg-background px-4 text-xs font-medium uppercase tracking-widest text-muted-foreground">{{ __('Or start from a template') }}</span></span>
        </div>

        <div data-animate="rise" data-animate-order="4" class="grid grid-cols-1 gap-4 sm:grid-cols-3">
            @foreach ($templates as $template)
                <a href="{{ $template['href'] }}" class="group block rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2">
                    <x-ui.card class="h-full p-6 transition-colors duration-150 hover:border-primary/40 hover:bg-muted/50">
                        <div class="flex items-start justify-between gap-2">
                            <span class="flex size-10 shrink-0 items-center justify-center rounded-md bg-muted text-foreground" aria-hidden="true">
                                <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">{!! $icons[$template['icon']] ?? $icons['layout'] !!}</svg>
                            </span>
                            @if (! empty($template['badge']))<x-ui.badge variant="secondary" size="sm">{{ __($template['badge']) }}</x-ui.badge>@endif
                        </div>
                        <p class="mt-4 text-sm font-semibold leading-snug text-foreground">{{ __($template['title']) }}</p>
                        <p class="mt-2 text-xs leading-relaxed text-muted-foreground">{{ __($template['description']) }}</p>
                    </x-ui.card>
                </a>
            @endforeach
        </div>
    </x-ui.container>
</x-ui.section>

Ownership & lifecycle

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