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-default.blade.php Blade
@props([
    'title' => 'No projects yet',
    'description' => 'Get started by creating your first project. It only takes a minute.',
    'primaryCta' => 'New project',
    'primaryHref' => '#',
    'secondaryCta' => 'Import existing',
    'secondaryHref' => null,
])

<x-ui.section space="lg" {{ $attributes }}>
    <x-ui.container size="sm">
        <x-ui.empty variant="plain" size="sm">
            <x-ui.empty.header>
                <x-ui.empty.media variant="icon" size="lg" data-animate="pop">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
                        <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z" />
                        <path d="M12 11v4M10 13h4" />
                    </svg>
                </x-ui.empty.media>
                <x-ui.empty.title as="h2" data-animate="rise" data-animate-order="1">{{ __($title) }}</x-ui.empty.title>
                <x-ui.empty.description data-animate="rise" data-animate-order="2">{{ __($description) }}</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">
                @if ($primaryCta)
                    <x-ui.button :href="$primaryHref" class="w-full sm:w-auto">{{ __($primaryCta) }}</x-ui.button>
                @endif
                @if ($secondaryCta && $secondaryHref)
                    <x-ui.button :href="$secondaryHref" variant="outline" class="w-full sm:w-auto">{{ __($secondaryCta) }}</x-ui.button>
                @endif
            </x-ui.empty.content>
        </x-ui.empty>
    </x-ui.container>
</x-ui.section>

Installation

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

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/empty-state-default 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-default.blade.php

Registry dependencies

button 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-default.md
# Brok UI block: Empty State (`empty-state-default`)

A centered empty-state with icon, message, and primary/secondary actions for first-run experiences.

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-default
```

## Render it

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

## Props

- `title` (string, default `No projects yet`)
- `description` (string, default `Get started by creating your first project. It only takes a minute.`)
- `primary-cta` (string, default `New project`)
- `primary-href` (string, default `#`)
- `secondary-cta` (string, default `Import existing`)
- `secondary-href` (mixed|null, default `null`)

## Use when

- Filling an empty list or dashboard with a centred icon, message and primary/secondary actions to start the first item.
- Giving a first-time user a clear next step (e.g. 'New project') rather than a blank screen.

## Avoid when

- Use empty-state-no-results for a no-search-results state, or empty-state-create for a create flow with starter templates.

## Rules

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

  • Filling an empty list or dashboard with a centred icon, message and primary/secondary actions to start the first item.
  • Giving a first-time user a clear next step (e.g. 'New project') rather than a blank screen.

Avoid when

  • Use empty-state-no-results for a no-search-results state, or empty-state-create for a create flow with starter templates.

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-default />

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-default.blade.php Blade
@props([
    'title' => 'No projects yet',
    'description' => 'Get started by creating your first project. It only takes a minute.',
    'primaryCta' => 'New project',
    'primaryHref' => '#',
    'secondaryCta' => 'Import existing',
    'secondaryHref' => null,
])

<x-ui.section space="lg" {{ $attributes }}>
    <x-ui.container size="sm">
        <x-ui.empty variant="plain" size="sm">
            <x-ui.empty.header>
                <x-ui.empty.media variant="icon" size="lg" data-animate="pop">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
                        <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z" />
                        <path d="M12 11v4M10 13h4" />
                    </svg>
                </x-ui.empty.media>
                <x-ui.empty.title as="h2" data-animate="rise" data-animate-order="1">{{ __($title) }}</x-ui.empty.title>
                <x-ui.empty.description data-animate="rise" data-animate-order="2">{{ __($description) }}</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">
                @if ($primaryCta)
                    <x-ui.button :href="$primaryHref" class="w-full sm:w-auto">{{ __($primaryCta) }}</x-ui.button>
                @endif
                @if ($secondaryCta && $secondaryHref)
                    <x-ui.button :href="$secondaryHref" variant="outline" class="w-full sm:w-auto">{{ __($secondaryCta) }}</x-ui.button>
                @endif
            </x-ui.empty.content>
        </x-ui.empty>
    </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