Chat Thread
A vertical stack of chat bubbles composing a back-and-forth conversation.
Preview
<x-ui.chat-thread class="mx-auto w-full max-w-md" />
Installation
php artisan ui:add chat-thread
Registry contract
php artisan ui:add chat-thread
writes only the files below. The CLI validates each file hash before writing and asks before it replaces a local change, unless you pass --force.
-
resources/views/components/ui/chat-thread.blade.php
Use with AI
A brief for your coding agent: install command, usage, props, guidance and the rules. Copy it, or open a prompt about this component in an assistant.
# Brok UI: Chat Thread (`chat-thread`)
A vertical stack of chat bubbles composing a back-and-forth conversation.
Brok UI is a Laravel Blade component registry. Installed components are plain Blade files the app owns.
## Install
```bash
php artisan ui:add chat-thread
```
## Usage
```blade
<x-ui.chat-thread class="mx-auto w-full max-w-md" />
```
## Props
- `messages` (mixed|null, default `null`)
## Use when
- Use to group related content into scannable units for browsing, prioritization, or rearrangement.
- Composing a conversation out of chat bubbles in order.
- Rendering a transcript or a support thread from an array of messages.
## Avoid when
- Do not use card-like structures when dense row-by-row comparison would be clearer in a list or table.
- Building the composer; ai-prompt is the input surface.
- Showing a single message, where chat-bubble stands alone.
## Anti-patterns
- Turning every object into a card
## Rules
- Use the `<brok:chat-thread>` tag (or `<x-ui.chat-thread>`) in Blade; do not rewrite the component.
- Prefer the documented props and variants over utility-class overrides; when a utility must win, use the `!` important modifier.
- Use semantic design tokens (`bg-primary`, `text-muted-foreground`), never raw colour utilities.
- Keep the `data-slot` attributes; they are the styling and test hooks.
## Links
- Docs: https://brokui.dev/docs/components/chat-thread
- Registry JSON (files, props, contract): https://brokui.dev/r/open/chat-thread.json
Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.
API
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| messages | mixed | null | null |
Slots
default—
Data slots
Stable hooks for CSS overrides and browser tests.
Behavior
- messages renders one chat-bubble per entry, passing each turn's role, name and avatar through.
- Without messages the default slot lays out hand-written bubbles.
- Composes chat-bubble for each turn and provides a small fallback conversation when no messages are supplied.
- Declares registry capability flags: a11y, responsive, rtl, darkMode, localized.
Guidance
Organize browsable objects into scannable units.
Use when
- Use to group related content into scannable units for browsing, prioritization, or rearrangement.
- Composing a conversation out of chat bubbles in order.
- Rendering a transcript or a support thread from an array of messages.
Avoid when
- Do not use card-like structures when dense row-by-row comparison would be clearer in a list or table.
- Building the composer; ai-prompt is the input surface.
- Showing a single message, where chat-bubble stands alone.
Use instead
- Table for exact comparison
- List for compact scanning
Anti-patterns
- Turning every object into a card
- Anatomy
- Theming hooks
Accessibility
- Keyboard
- No component-owned keyboard interaction; native element behavior applies.
- Focus
none
- Bubbles keep their reading order in the DOM, so the thread is read in sequence.
- Each bubble inherits its own labelling from chat-bubble.
- Semantic HTML and a stable
data-slotattribute for styling and scripting hooks. - Focus-visible rings use the
ringtoken, so keyboard focus is always visible. - Disabled and invalid states are conveyed to assistive tech, not by color alone.
- Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces in the preview.
- Labels go through
__()and layout uses logical properties (ms-*,text-start), so it mirrors underdir="rtl"— flip the preview to RTL to confirm. - Dark mode uses the same semantic tokens under the
darkclass; high contrast follows forced-color system tokens.
Livewire
Livewire can update this component through forwarded wire:* attributes.
Source
The exact, editable file ui:add writes
into your app. Previews render this same code; there are no preview-only components.
@props([
'messages' => null,
])
@php
// Sensible demo conversation when no messages are supplied.
$turns = is_array($messages) && ! empty($messages) ? $messages : [
['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.')],
];
@endphp
<div
data-slot="chat-thread"
{{ $attributes->merge(['class' => 'flex flex-col gap-4 text-foreground']) }}
>
@foreach ($turns as $turn)
<x-ui.chat-bubble
:role="$turn['role'] ?? 'user'"
:name="$turn['name'] ?? null"
:avatar="$turn['avatar'] ?? null"
>{{ $turn['content'] ?? '' }}</x-ui.chat-bubble>
@endforeach
</div>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
2.0.3 - Status
- Stable
- License
-
open - Accessibility reviewed
- No review date recorded
- Last breaking change
- No date recorded
- Deprecation
- Not deprecated
- Contract
-
v6 - Foundation
-
≥ 1.0.0