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

6 of 7

resources/views/blocks/ai-tools-playground.blade.php Blade
{{--
    AI Playground 01 — a settings rail beside a conversation, composed from generic
    primitives. The rail tunes the session (model picker, a temperature range, an
    editable system prompt, and usage budgets); the right card shows a conversation
    thread with reasoning, a tool call, a stop reason, and the composer. Both panels
    are <x-ui.card> surfaces.
--}}
<section data-slot="block-ai-playground" {{ $attributes->merge(['class' => 'mx-auto w-full max-w-5xl']) }}>
    <div class="grid gap-4 lg:grid-cols-[300px_1fr]">
        {{-- Settings rail --}}
        <x-ui.card class="space-y-6 p-4">
            <div>
                <h2 class="text-sm font-semibold text-foreground">{{ __('Parameters') }}</h2>
                <p class="text-xs text-muted-foreground">{{ __('Tune the model for this session') }}</p>
            </div>

            <div class="space-y-2">
                <span class="block text-xs font-medium text-muted-foreground">{{ __('Model') }}</span>
                <x-ui.select-advanced name="model" value="opus-4-8" :label="__('Opus 4.8')" :placeholder="__('Select a model')" class="w-full">
                    <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>
            </div>

            <x-ui.card class="p-6">
                <x-ui.slider
                    name="temperature"
                    :label="__('Temperature')"
                    :min="0"
                    :max="2"
                    :step="0.1"
                    :value="0.7"
                    :decimals="1"
                    show-value
                    :legend-start="__('Precise')"
                    :legend-end="__('Creative')"
                />
            </x-ui.card>

            <x-ui.editable-card
                :label="__('System prompt')"
                :value="__('You are a concise, helpful assistant. Prefer plain language and cite sources when relevant.')"
                :placeholder="__('Describe how the assistant should behave…')"
            />

            <x-ui.separator />

            <x-ui.usage-meter :used="3200" :total="8000" :label="__('Context')" />
            <div class="flex justify-center pt-2">
                <x-ui.usage-gauge :used="6800" :total="10000" :label="__('Budget')" :caption="__('Resets in 12 days')" variant="arc" />
            </div>
        </x-ui.card>

        {{-- Conversation --}}
        <x-ui.card class="flex h-[640px] flex-col overflow-hidden">
            <div class="flex-1 space-y-4 overflow-y-auto p-4" aria-label="{{ __('Conversation') }}">
                <x-ui.chat-thread />
                <x-ui.ai.chain-of-thought />
                <x-ui.ai.function-call name="search_docs" :arguments="['query' => 'Q3 launch', 'top_k' => 5]" status="success" />
                <x-ui.ai.stop-reason reason="stop" :tokens="734" />
            </div>
            <div class="border-t border-border p-4">
                <x-ui.ai.prompt model="Opus 4.8" />
            </div>
        </x-ui.card>
    </div>
</section>

Installation

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

Registry contract

Install confidence

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

Registry dependencies

ai-chain-of-thought ai-function-call ai-prompt ai-stop-reason card chat-thread editable-card select-advanced separator slider usage-gauge usage-meter

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-playground.md
# Brok UI block: AI Playground (`ai-tools-playground`)

A two-column model playground: a settings rail with model selector, temperature, system prompt, token counter, and usage ring beside a conversation that shows chain-of-thought, a tool call, a stop reason, and the prompt 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/ai-tools-playground
```

## Render it

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

## Use when

- Showcasing a two-column AI playground: a settings rail (model, temperature, system prompt, usage) beside a conversation panel.
- Demoing chain-of-thought, a tool call and a stop reason inside the conversation panel alongside the composer.

## Avoid when

- Use ai-tools-chat for a single chat panel without a settings rail, or ai-tools-text through 03 for a single-purpose generation demo.

## Rules

- Render the installed block with `<x-blocks.ai-tools-playground />` 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-playground
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/ai-tools-playground.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 two-column AI playground: a settings rail (model, temperature, system prompt, usage) beside a conversation panel.
  • Demoing chain-of-thought, a tool call and a stop reason inside the conversation panel alongside the composer.

Avoid when

  • Use ai-tools-chat for a single chat panel without a settings rail, or ai-tools-text through 03 for a single-purpose generation demo.

Anti-patterns

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

Usage

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

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

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-playground.blade.php Blade
{{--
    AI Playground 01 — a settings rail beside a conversation, composed from generic
    primitives. The rail tunes the session (model picker, a temperature range, an
    editable system prompt, and usage budgets); the right card shows a conversation
    thread with reasoning, a tool call, a stop reason, and the composer. Both panels
    are <x-ui.card> surfaces.
--}}
<section data-slot="block-ai-playground" {{ $attributes->merge(['class' => 'mx-auto w-full max-w-5xl']) }}>
    <div class="grid gap-4 lg:grid-cols-[300px_1fr]">
        {{-- Settings rail --}}
        <x-ui.card class="space-y-6 p-4">
            <div>
                <h2 class="text-sm font-semibold text-foreground">{{ __('Parameters') }}</h2>
                <p class="text-xs text-muted-foreground">{{ __('Tune the model for this session') }}</p>
            </div>

            <div class="space-y-2">
                <span class="block text-xs font-medium text-muted-foreground">{{ __('Model') }}</span>
                <x-ui.select-advanced name="model" value="opus-4-8" :label="__('Opus 4.8')" :placeholder="__('Select a model')" class="w-full">
                    <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>
            </div>

            <x-ui.card class="p-6">
                <x-ui.slider
                    name="temperature"
                    :label="__('Temperature')"
                    :min="0"
                    :max="2"
                    :step="0.1"
                    :value="0.7"
                    :decimals="1"
                    show-value
                    :legend-start="__('Precise')"
                    :legend-end="__('Creative')"
                />
            </x-ui.card>

            <x-ui.editable-card
                :label="__('System prompt')"
                :value="__('You are a concise, helpful assistant. Prefer plain language and cite sources when relevant.')"
                :placeholder="__('Describe how the assistant should behave…')"
            />

            <x-ui.separator />

            <x-ui.usage-meter :used="3200" :total="8000" :label="__('Context')" />
            <div class="flex justify-center pt-2">
                <x-ui.usage-gauge :used="6800" :total="10000" :label="__('Budget')" :caption="__('Resets in 12 days')" variant="arc" />
            </div>
        </x-ui.card>

        {{-- Conversation --}}
        <x-ui.card class="flex h-[640px] flex-col overflow-hidden">
            <div class="flex-1 space-y-4 overflow-y-auto p-4" aria-label="{{ __('Conversation') }}">
                <x-ui.chat-thread />
                <x-ui.ai.chain-of-thought />
                <x-ui.ai.function-call name="search_docs" :arguments="['query' => 'Q3 launch', 'top_k' => 5]" status="success" />
                <x-ui.ai.stop-reason reason="stop" :tokens="734" />
            </div>
            <div class="border-t border-border p-4">
                <x-ui.ai.prompt model="Opus 4.8" />
            </div>
        </x-ui.card>
    </div>
</section>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
2.1.1
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0