Chat Demo
A compact chat panel: a card with an avatar/status header, a sided-bubble conversation (via chat-thread) and a static composer.
Preview
@props([
'title' => 'Support',
'status' => 'Online',
'avatar' => null,
'messages' => null,
'placeholder' => 'Type a message…',
])
@php
// A short, self-contained conversation. Each turn: role (user|other|system),
// an optional name, and content. Rendered by the chat-thread primitive.
$messages ??= [
['role' => 'other', 'name' => __('Support'), 'content' => __('Hey! 👋 How can we help you today?')],
['role' => 'user', 'name' => __('You'), 'content' => __('Is the Q3 launch still on track?')],
['role' => 'other', 'name' => __('Support'), 'content' => __('Yes — the rollout is staged behind a flag and we are on schedule for the end of the quarter.')],
['role' => 'system', 'content' => __('Seen just now')],
];
@endphp
{{--
Chat demo — a compact, self-contained messaging panel. A card frames a header
(avatar, title and a live status dot), the conversation (delegated to the
chat-thread primitive, which renders each turn as a sided bubble) and a static
composer. Presentational only: wire the input/send action in your own app.
--}}
<x-ui.card {{ $attributes->merge(['class' => 'mx-auto w-full max-w-md overflow-hidden']) }}>
<x-ui.card.header class="border-b border-border">
<div class="flex items-center gap-4">
<x-ui.avatar size="md" :src="$avatar" :alt="$title" :fallback="$title" class="shrink-0" />
<div class="min-w-0 flex-1">
<x-ui.card.title>{{ __($title) }}</x-ui.card.title>
<p class="flex items-center gap-2 text-xs text-muted-foreground">
<span class="size-2 rounded-full bg-success" aria-hidden="true"></span>{{ __($status) }}
</p>
</div>
</div>
</x-ui.card.header>
<x-ui.card.content class="bg-muted/20 py-6">
<x-ui.chat-thread :messages="$messages" />
</x-ui.card.content>
<div class="flex items-center gap-2 border-t border-border p-4">
<label for="chat-demo-input" class="sr-only">{{ __('Message') }}</label>
<x-ui.input id="chat-demo-input" name="message" type="text" class="flex-1" placeholder="{{ __($placeholder) }}" />
<x-ui.button type="button" size="icon" :aria-label="__('Send message')">
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="size-4">
<path d="M22 2 11 13M22 2l-7 20-4-9-9-4 20-7Z" />
</svg>
</x-ui.button>
</div>
</x-ui.card>
Installation
php artisan ui:add blocks/chat-demo
Registry contract
Install confidence
php artisan ui:add blocks/chat-demo
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.0.4
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/chat-demo.blade.php |
Registry dependencies
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.
# Brok UI block: Chat Demo (`chat-demo`)
A compact chat panel: a card with an avatar/status header, a sided-bubble conversation (via chat-thread) and a static composer.
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/chat-demo
```
## Render it
```blade
<x-blocks.chat-demo />
```
## Props
- `title` (string, default `Support`)
- `status` (string, default `Online`)
- `avatar` (mixed|null, default `null`)
- `messages` (mixed|null, default `null`)
- `placeholder` (string, default `Type a message…`)
## Use when
- Showing a compact, static chat panel with an avatar/status header and a sided-bubble conversation for a marketing or docs page.
- Composing the chat-thread primitive with a static composer rather than a live, typable input.
## Avoid when
- Use chat-list for a filterable conversation inbox, or ai-tools-chat for a fuller AI chat panel with a model selector.
## Rules
- Render the installed block with `<x-blocks.chat-demo />` 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/chat-demo
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/chat-demo.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
- Showing a compact, static chat panel with an avatar/status header and a sided-bubble conversation for a marketing or docs page.
- Composing the chat-thread primitive with a static composer rather than a live, typable input.
Avoid when
- Use chat-list for a filterable conversation inbox, or ai-tools-chat for a fuller AI chat panel with a model selector.
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:
<x-blocks.chat-demo />
Built from primitives
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.
@props([
'title' => 'Support',
'status' => 'Online',
'avatar' => null,
'messages' => null,
'placeholder' => 'Type a message…',
])
@php
// A short, self-contained conversation. Each turn: role (user|other|system),
// an optional name, and content. Rendered by the chat-thread primitive.
$messages ??= [
['role' => 'other', 'name' => __('Support'), 'content' => __('Hey! 👋 How can we help you today?')],
['role' => 'user', 'name' => __('You'), 'content' => __('Is the Q3 launch still on track?')],
['role' => 'other', 'name' => __('Support'), 'content' => __('Yes — the rollout is staged behind a flag and we are on schedule for the end of the quarter.')],
['role' => 'system', 'content' => __('Seen just now')],
];
@endphp
{{--
Chat demo — a compact, self-contained messaging panel. A card frames a header
(avatar, title and a live status dot), the conversation (delegated to the
chat-thread primitive, which renders each turn as a sided bubble) and a static
composer. Presentational only: wire the input/send action in your own app.
--}}
<x-ui.card {{ $attributes->merge(['class' => 'mx-auto w-full max-w-md overflow-hidden']) }}>
<x-ui.card.header class="border-b border-border">
<div class="flex items-center gap-4">
<x-ui.avatar size="md" :src="$avatar" :alt="$title" :fallback="$title" class="shrink-0" />
<div class="min-w-0 flex-1">
<x-ui.card.title>{{ __($title) }}</x-ui.card.title>
<p class="flex items-center gap-2 text-xs text-muted-foreground">
<span class="size-2 rounded-full bg-success" aria-hidden="true"></span>{{ __($status) }}
</p>
</div>
</div>
</x-ui.card.header>
<x-ui.card.content class="bg-muted/20 py-6">
<x-ui.chat-thread :messages="$messages" />
</x-ui.card.content>
<div class="flex items-center gap-2 border-t border-border p-4">
<label for="chat-demo-input" class="sr-only">{{ __('Message') }}</label>
<x-ui.input id="chat-demo-input" name="message" type="text" class="flex-1" placeholder="{{ __($placeholder) }}" />
<x-ui.button type="button" size="icon" :aria-label="__('Send message')">
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="size-4">
<path d="M22 2 11 13M22 2l-7 20-4-9-9-4 20-7Z" />
</svg>
</x-ui.button>
</div>
</x-ui.card>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.0.4 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0