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-no-results.blade.php Blade
@props([
    'query'       => 'wireless headphones',
    'title'       => 'No results found',
    'description' => 'We couldn\'t find anything matching your search. Try a different term or clear your filters.',
    'clearHref'   => '#',
    'browseHref'  => '#',
    'suggestions' => null,
])

@php
    $suggestions ??= ['documents', 'settings', 'billing', 'users'];
@endphp

<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" aria-hidden="true">
                        <circle cx="11" cy="11" r="7" /><path d="M21 21l-4.35-4.35" />
                    </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">
                    @if ($query)
                        {{ __('We couldn\'t find anything matching') }} <span class="font-medium text-foreground">&ldquo;{{ $query }}&rdquo;</span>.
                    @else
                        {{ __($description) }}
                    @endif
                </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="$clearHref" class="w-full sm:w-auto">{{ __('Clear filters') }}</x-ui.button>
                <x-ui.button :href="$browseHref" variant="ghost" class="w-full sm:w-auto">{{ __('Browse all') }}</x-ui.button>
            </x-ui.empty.content>

            @if (! empty($suggestions))
                <x-ui.empty.content data-animate="rise" data-animate-order="4" class="mt-4">
                    <p class="text-xs font-medium uppercase tracking-widest text-muted-foreground">{{ __('Suggestions') }}</p>
                    <div class="flex flex-wrap justify-center gap-2">
                        @foreach ($suggestions as $suggestion)
                            <x-ui.badge as="a" href="#" variant="secondary">
                                <x-slot:leading>
                                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                                        <circle cx="11" cy="11" r="7" /><path d="M21 21l-4.35-4.35" />
                                    </svg>
                                </x-slot:leading>
                                {{ __($suggestion) }}
                            </x-ui.badge>
                        @endforeach
                    </div>
                </x-ui.empty.content>
            @endif
        </x-ui.empty>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/empty-state-no-results

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

button section container empty badge

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-no-results.md
# Brok UI block: Empty Search (`empty-state-no-results`)

An application no-search-results empty state with an icon tile, message referencing the query, clear and browse actions, and suggestion chips.

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-no-results
```

## Render it

```blade
<x-blocks.empty-state-no-results />
```

## Props

- `query` (string, default `wireless headphones`)
- `title` (string, default `No results found`)
- `description` (string, default `We couldn\'t find anything matching your search. Try a different term or clear your filters.`)
- `clear-href` (string, default `#`)
- `browse-href` (string, default `#`)
- `suggestions` (mixed|null, default `null`)

## Use when

- Telling a visitor their search returned nothing, naming the query and offering clear and browse actions.
- Suggesting alternative search terms as chips beneath the message.

## Avoid when

- Use empty-state-default for a generic first-run empty state, or empty-state-create for a create-first-project flow.

## Rules

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

  • Telling a visitor their search returned nothing, naming the query and offering clear and browse actions.
  • Suggesting alternative search terms as chips beneath the message.

Avoid when

  • Use empty-state-default for a generic first-run empty state, or empty-state-create for a create-first-project flow.

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-no-results />

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-no-results.blade.php Blade
@props([
    'query'       => 'wireless headphones',
    'title'       => 'No results found',
    'description' => 'We couldn\'t find anything matching your search. Try a different term or clear your filters.',
    'clearHref'   => '#',
    'browseHref'  => '#',
    'suggestions' => null,
])

@php
    $suggestions ??= ['documents', 'settings', 'billing', 'users'];
@endphp

<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" aria-hidden="true">
                        <circle cx="11" cy="11" r="7" /><path d="M21 21l-4.35-4.35" />
                    </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">
                    @if ($query)
                        {{ __('We couldn\'t find anything matching') }} <span class="font-medium text-foreground">&ldquo;{{ $query }}&rdquo;</span>.
                    @else
                        {{ __($description) }}
                    @endif
                </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="$clearHref" class="w-full sm:w-auto">{{ __('Clear filters') }}</x-ui.button>
                <x-ui.button :href="$browseHref" variant="ghost" class="w-full sm:w-auto">{{ __('Browse all') }}</x-ui.button>
            </x-ui.empty.content>

            @if (! empty($suggestions))
                <x-ui.empty.content data-animate="rise" data-animate-order="4" class="mt-4">
                    <p class="text-xs font-medium uppercase tracking-widest text-muted-foreground">{{ __('Suggestions') }}</p>
                    <div class="flex flex-wrap justify-center gap-2">
                        @foreach ($suggestions as $suggestion)
                            <x-ui.badge as="a" href="#" variant="secondary">
                                <x-slot:leading>
                                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                                        <circle cx="11" cy="11" r="7" /><path d="M21 21l-4.35-4.35" />
                                    </svg>
                                </x-slot:leading>
                                {{ __($suggestion) }}
                            </x-ui.badge>
                        @endforeach
                    </div>
                </x-ui.empty.content>
            @endif
        </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