Skip to content
Brok UI

Loading…

No results

Editor Blocks

Open + Pro variants

platejs.org-inspired rich-text editors — a full document surface, a compact composer, a commented document and an AI-assisted draft.

Preview

2 of 5

resources/views/blocks/editor-minimal.blade.php Blade
@props([
    'placeholder' => 'Add a comment…',
    'submitLabel' => 'Comment',
])

<section class="bg-background py-10 text-foreground sm:py-14">
    <div class="mx-auto w-full max-w-xl px-4 sm:px-6">

        <x-ui.editor
            :placeholder="__($placeholder)"
            :ariaLabel="__('Comment editor')"
            class="min-h-0"
        >
            {{-- Slim toolbar --}}
            <x-slot:toolbar>
                <x-ui.editor-toolbar />
            </x-slot:toolbar>

            {{-- Empty initial content so the placeholder is shown --}}
            <p></p>

            {{-- Footer: hint on start, submit button on end --}}
            <x-slot:footer>
                <span class="text-muted-foreground">
                    {{ __('Markdown supported') }}
                </span>
                <x-ui.button
                    type="button"
                    class="ms-auto"
                    @mousedown.prevent="$dispatch('editor-noop')"
                >
                    {{ __($submitLabel) }}
                </x-ui.button>
            </x-slot:footer>
        </x-ui.editor>

    </div>
</section>

Installation

terminal
php artisan ui:add blocks/editor-minimal

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

editor editor-toolbar button

Package dependencies

composer: jml/brok:^0.2

npm: alpinejs

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.

editor-minimal.md
# Brok UI block: Editor Minimal (`editor-minimal`)

A compact inline comment composer with a slim formatting toolbar, a short editable area, a markdown-hint footer, and a primary submit button.

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/editor-minimal
```

## Render it

```blade
<x-blocks.editor-minimal />
```

## Props

- `placeholder` (string, default `Add a comment…`)
- `submit-label` (string, default `Comment`)

## Use when

- Composing a short comment or reply with a slim formatting toolbar, a compact editable area and a markdown-hint footer.
- Fitting a comment thread or discussion UI rather than a full document-editing surface.

## Avoid when

- Use editor-document for a full-page document editor, or editor-rich for the kitchen-sink rich text editor.

## Rules

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

  • Composing a short comment or reply with a slim formatting toolbar, a compact editable area and a markdown-hint footer.
  • Fitting a comment thread or discussion UI rather than a full document-editing surface.

Avoid when

  • Use editor-document for a full-page document editor, or editor-rich for the kitchen-sink rich text editor.

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.editor-minimal />

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/editor-minimal.blade.php Blade
@props([
    'placeholder' => 'Add a comment…',
    'submitLabel' => 'Comment',
])

<section class="bg-background py-10 text-foreground sm:py-14">
    <div class="mx-auto w-full max-w-xl px-4 sm:px-6">

        <x-ui.editor
            :placeholder="__($placeholder)"
            :ariaLabel="__('Comment editor')"
            class="min-h-0"
        >
            {{-- Slim toolbar --}}
            <x-slot:toolbar>
                <x-ui.editor-toolbar />
            </x-slot:toolbar>

            {{-- Empty initial content so the placeholder is shown --}}
            <p></p>

            {{-- Footer: hint on start, submit button on end --}}
            <x-slot:footer>
                <span class="text-muted-foreground">
                    {{ __('Markdown supported') }}
                </span>
                <x-ui.button
                    type="button"
                    class="ms-auto"
                    @mousedown.prevent="$dispatch('editor-noop')"
                >
                    {{ __($submitLabel) }}
                </x-ui.button>
            </x-slot:footer>
        </x-ui.editor>

    </div>
</section>

Ownership & lifecycle

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