Skip to content
Brok UI

Loading…

No results

AI Tools

Open source

AI tool surfaces — text writer, image generator, code generator, an assistant chat, a full-height inbox rail, and a model playground, each with live output panels.

Preview

4 of 7

resources/views/blocks/ai-tools-chat.blade.php Blade
@props([
    'title' => 'Assistant',
])

{{--
    AI Chat 01 — a self-contained chat panel composed from generic primitives:
    a model picker header, a scrollable conversation (a typed-out streaming reply +
    a reaction bar + a typing-style dots loader), suggestion pills, and the prompt
    composer. Wrapped in <x-ui.card> so it themes itself and reads as one surface.
--}}
<section data-slot="block-ai-chat" {{ $attributes->merge(['class' => 'mx-auto w-full max-w-2xl']) }}>
    <x-ui.card class="flex h-[640px] flex-col overflow-hidden">
        {{-- Header --}}
        <header class="flex items-center justify-between gap-4 border-b border-border px-4 py-4">
            <div class="flex items-center gap-2">
                <span class="ui-ai-spark grid size-8 shrink-0 place-items-center rounded-md" aria-hidden="true">
                    <svg class="size-4" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l1.9 5.1L19 9l-5.1 1.9L12 16l-1.9-5.1L5 9l5.1-1.9L12 2z" /></svg>
                </span>
                <div>
                    <h2 class="text-sm font-semibold text-foreground">{{ __($title) }}</h2>
                    <p class="flex items-center gap-2 text-xs text-muted-foreground">
                        <span class="size-2 rounded-full bg-success" aria-hidden="true"></span>{{ __('Online') }}
                    </p>
                </div>
            </div>
            <x-ui.select-advanced name="model" value="opus-4-8" :label="__('Opus 4.8')" :placeholder="__('Select a model')" class="w-44">
                <x-ui.select-advanced.option value="opus-4-8" :label="__('Opus 4.8')" :description="__('Most capable')" :meta="__('Smart')" />
                <x-ui.select-advanced.option value="sonnet-4-8" :label="__('Sonnet 4.8')" :description="__('Balanced speed and depth')" :meta="__('Fast')" />
                <x-ui.select-advanced.option value="haiku-4-8" :label="__('Haiku 4.8')" :description="__('Fastest, lightweight')" :meta="__('Instant')" />
            </x-ui.select-advanced>
        </header>

        {{-- Conversation --}}
        <div class="flex-1 space-y-4 overflow-y-auto px-4 py-6" aria-label="{{ __('Conversation') }}">
            <x-ui.chat-bubble role="user" name="You">Can you summarise the Q3 launch plan?</x-ui.chat-bubble>

            <div class="space-y-2">
                <x-ui.chat-bubble role="other" name="Assistant">
                    <x-ui.typewriter
                        :words="['Sure — Q3 ships the billing revamp first, then the new onboarding flow behind a feature flag, with a staged rollout and a one-click revert path.']"
                        :loop="false"
                    />
                </x-ui.chat-bubble>
                <div class="ps-2">
                    <x-ui.reaction-bar text="Sure — Q3 ships the billing revamp first, then the new onboarding flow behind a feature flag, with a staged rollout and a one-click revert path." />
                </div>
            </div>

            <x-ui.dots-loader variant="bounce" :label="__('Assistant is typing')" />
        </div>

        {{-- Suggestions + composer --}}
        <footer class="space-y-4 border-t border-border px-4 py-4">
            <x-ui.suggestion-chips :items="['Draft the announcement', 'List the risks', 'Show the timeline']" />
            <x-ui.ai.prompt model="Opus 4.8" />
        </footer>
    </x-ui.card>
</section>

Installation

terminal
php artisan ui:add blocks/ai-tools-chat

Registry contract

Install confidence

php artisan ui:add blocks/ai-tools-chat 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
2.0.3
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/ai-tools-chat.blade.php

Registry dependencies

card chat-bubble typewriter dots-loader reaction-bar suggestion-chips ai-prompt select-advanced

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.

ai-tools-chat.md
# Brok UI block: AI Chat (`ai-tools-chat`)

A complete chat panel: a header with model selector, a scrollable conversation with a streaming reply and feedback row, prompt-suggestion pills, and a composer pinned to the bottom.

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/ai-tools-chat
```

## Render it

```blade
<x-blocks.ai-tools-chat />
```

## Props

- `title` (string, default `Assistant`)

## Use when

- Showcasing a complete AI chat surface: a header with a model selector, a scrollable conversation with a reply and feedback row, and a composer pinned to the bottom.
- Demoing prompt-suggestion pills above the composer as a starting point for a new message.

## Avoid when

- Use chat-demo for a smaller, generic chat panel, or ai-tools-playground for a settings-plus-playground layout instead of a single chat surface.

## Rules

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

  • Showcasing a complete AI chat surface: a header with a model selector, a scrollable conversation with a reply and feedback row, and a composer pinned to the bottom.
  • Demoing prompt-suggestion pills above the composer as a starting point for a new message.

Avoid when

  • Use chat-demo for a smaller, generic chat panel, or ai-tools-playground for a settings-plus-playground layout instead of a single chat surface.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
root block-ai-chat

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.ai-tools-chat />

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/ai-tools-chat.blade.php Blade
@props([
    'title' => 'Assistant',
])

{{--
    AI Chat 01 — a self-contained chat panel composed from generic primitives:
    a model picker header, a scrollable conversation (a typed-out streaming reply +
    a reaction bar + a typing-style dots loader), suggestion pills, and the prompt
    composer. Wrapped in <x-ui.card> so it themes itself and reads as one surface.
--}}
<section data-slot="block-ai-chat" {{ $attributes->merge(['class' => 'mx-auto w-full max-w-2xl']) }}>
    <x-ui.card class="flex h-[640px] flex-col overflow-hidden">
        {{-- Header --}}
        <header class="flex items-center justify-between gap-4 border-b border-border px-4 py-4">
            <div class="flex items-center gap-2">
                <span class="ui-ai-spark grid size-8 shrink-0 place-items-center rounded-md" aria-hidden="true">
                    <svg class="size-4" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l1.9 5.1L19 9l-5.1 1.9L12 16l-1.9-5.1L5 9l5.1-1.9L12 2z" /></svg>
                </span>
                <div>
                    <h2 class="text-sm font-semibold text-foreground">{{ __($title) }}</h2>
                    <p class="flex items-center gap-2 text-xs text-muted-foreground">
                        <span class="size-2 rounded-full bg-success" aria-hidden="true"></span>{{ __('Online') }}
                    </p>
                </div>
            </div>
            <x-ui.select-advanced name="model" value="opus-4-8" :label="__('Opus 4.8')" :placeholder="__('Select a model')" class="w-44">
                <x-ui.select-advanced.option value="opus-4-8" :label="__('Opus 4.8')" :description="__('Most capable')" :meta="__('Smart')" />
                <x-ui.select-advanced.option value="sonnet-4-8" :label="__('Sonnet 4.8')" :description="__('Balanced speed and depth')" :meta="__('Fast')" />
                <x-ui.select-advanced.option value="haiku-4-8" :label="__('Haiku 4.8')" :description="__('Fastest, lightweight')" :meta="__('Instant')" />
            </x-ui.select-advanced>
        </header>

        {{-- Conversation --}}
        <div class="flex-1 space-y-4 overflow-y-auto px-4 py-6" aria-label="{{ __('Conversation') }}">
            <x-ui.chat-bubble role="user" name="You">Can you summarise the Q3 launch plan?</x-ui.chat-bubble>

            <div class="space-y-2">
                <x-ui.chat-bubble role="other" name="Assistant">
                    <x-ui.typewriter
                        :words="['Sure — Q3 ships the billing revamp first, then the new onboarding flow behind a feature flag, with a staged rollout and a one-click revert path.']"
                        :loop="false"
                    />
                </x-ui.chat-bubble>
                <div class="ps-2">
                    <x-ui.reaction-bar text="Sure — Q3 ships the billing revamp first, then the new onboarding flow behind a feature flag, with a staged rollout and a one-click revert path." />
                </div>
            </div>

            <x-ui.dots-loader variant="bounce" :label="__('Assistant is typing')" />
        </div>

        {{-- Suggestions + composer --}}
        <footer class="space-y-4 border-t border-border px-4 py-4">
            <x-ui.suggestion-chips :items="['Draft the announcement', 'List the risks', 'Show the timeline']" />
            <x-ui.ai.prompt model="Opus 4.8" />
        </footer>
    </x-ui.card>
</section>

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
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0