Skip to content
Brok UI

Loading…

No results

Settings

Open source

Account settings screens — a grouped account form, a notification-preferences matrix and a connected-apps integrations list.

Preview

1 of 6

resources/views/blocks/settings-account.blade.php Blade
@props([
    'heading' => 'Settings',
    'subheading' => 'Manage your profile and notification preferences.',
    'action' => '#',
    'profile' => null,
    'notifications' => null,
    'headingTag' => 'h2',
])

@php
    $profile ??= ['name' => '', 'email' => '', 'bio' => ''];
    $notifications ??= [
        ['name' => 'product', 'label' => 'Product updates', 'description' => 'News about features and improvements.', 'enabled' => true],
        ['name' => 'security', 'label' => 'Security alerts', 'description' => 'Sign-in and account-security notifications.', 'enabled' => true],
        ['name' => 'marketing', 'label' => 'Marketing emails', 'description' => 'Tips, offers, and occasional newsletters.', 'enabled' => false],
    ];
@endphp

<x-ui.section space="md" {{ $attributes }}>
    <x-ui.container size="sm" gutter="sm">
        <div class="mb-8">
            <{{ $headingTag }} class="text-2xl font-bold tracking-tight">{{ __($heading) }}</{{ $headingTag }}>
            <p class="mt-2 text-muted-foreground">{{ __($subheading) }}</p>
        </div>

        <x-ui.form method="POST" :action="$action">

            <x-ui.card>
                <x-ui.card.header>
                    <x-ui.card.title>{{ __('Profile') }}</x-ui.card.title>
                    <x-ui.card.description>{{ __('This information may appear publicly.') }}</x-ui.card.description>
                </x-ui.card.header>
                <x-ui.card.content class="space-y-4">
                    <x-ui.field>
                        <x-ui.label for="settings-name" required>{{ __('Full name') }}</x-ui.label>
                        <x-ui.input id="settings-name" name="name" value="{{ $profile['name'] }}" autocomplete="name" required />
                    </x-ui.field>

                    <x-ui.field>
                        <x-ui.label for="settings-email" required>{{ __('Email') }}</x-ui.label>
                        <x-ui.input id="settings-email" type="email" name="email" value="{{ $profile['email'] }}" autocomplete="email" required />
                    </x-ui.field>

                    <x-ui.field>
                        <x-ui.label for="settings-bio">{{ __('Bio') }}</x-ui.label>
                        <x-ui.textarea id="settings-bio" name="bio" rows="3">{{ $profile['bio'] }}</x-ui.textarea>
                        <x-ui.field.description>{{ __('Brief description for your profile.') }}</x-ui.field.description>
                    </x-ui.field>
                </x-ui.card.content>
            </x-ui.card>

            <x-ui.card>
                <x-ui.card.header>
                    <x-ui.card.title>{{ __('Notifications') }}</x-ui.card.title>
                    <x-ui.card.description>{{ __('Choose what we email you about.') }}</x-ui.card.description>
                </x-ui.card.header>
                <x-ui.card.content class="space-y-4">
                    @foreach ($notifications as $i => $notification)
                        @if ($i > 0)
                            <x-ui.separator />
                        @endif
                        <x-ui.switch-field
                            :id="'notify-'.$notification['name']"
                            :name="'notifications['.$notification['name'].']'"
                            :label="__($notification['label'])"
                            :description="__($notification['description'])"
                            :checked="$notification['enabled']"
                        />
                    @endforeach
                </x-ui.card.content>
            </x-ui.card>

            <div class="flex justify-end gap-4">
                <x-ui.button type="reset" variant="outline">{{ __('Cancel') }}</x-ui.button>
                <x-ui.button type="submit">{{ __('Save changes') }}</x-ui.button>
            </div>
        </x-ui.form>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/settings-account

Registry contract

Install confidence

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

Registry dependencies

button card container field form input label section separator textarea switch-field

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.

settings-account.md
# Brok UI block: Settings Form (`settings-account`)

A grouped account settings form with profile fields and toggle-based notification preferences.

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/settings-account
```

## Render it

```blade
<x-blocks.settings-account />
```

## Props

- `heading` (string, default `Settings`) — Section heading.
- `subheading` (string, default `Manage your profile and notification preferences.`) — Supporting copy under the heading.
- `action` (string, default `#`) — Form submission endpoint.
- `profile` (mixed|null, default `null`) — Current {name, email, bio} values; null falls back to empty fields.
- `notifications` (mixed|null, default `null`) — Notification preference rows with a label, description and enabled state; null falls back to sample data.
- `heading-tag` (string, default `h2`) — HTML heading tag rendered for the title.

## Use when

- Building an account settings screen with profile fields and toggle-based notification preferences in one grouped form.
- Wanting profile and notification settings together on a single page.

## Avoid when

- Needing notification channels broken out with per-channel Email/Push/SMS switches; use settings-notifications instead.

## Rules

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

  • Building an account settings screen with profile fields and toggle-based notification preferences in one grouped form.
  • Wanting profile and notification settings together on a single page.

Avoid when

  • Needing notification channels broken out with per-channel Email/Push/SMS switches; use settings-notifications instead.

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.settings-account />

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/settings-account.blade.php Blade
@props([
    'heading' => 'Settings',
    'subheading' => 'Manage your profile and notification preferences.',
    'action' => '#',
    'profile' => null,
    'notifications' => null,
    'headingTag' => 'h2',
])

@php
    $profile ??= ['name' => '', 'email' => '', 'bio' => ''];
    $notifications ??= [
        ['name' => 'product', 'label' => 'Product updates', 'description' => 'News about features and improvements.', 'enabled' => true],
        ['name' => 'security', 'label' => 'Security alerts', 'description' => 'Sign-in and account-security notifications.', 'enabled' => true],
        ['name' => 'marketing', 'label' => 'Marketing emails', 'description' => 'Tips, offers, and occasional newsletters.', 'enabled' => false],
    ];
@endphp

<x-ui.section space="md" {{ $attributes }}>
    <x-ui.container size="sm" gutter="sm">
        <div class="mb-8">
            <{{ $headingTag }} class="text-2xl font-bold tracking-tight">{{ __($heading) }}</{{ $headingTag }}>
            <p class="mt-2 text-muted-foreground">{{ __($subheading) }}</p>
        </div>

        <x-ui.form method="POST" :action="$action">

            <x-ui.card>
                <x-ui.card.header>
                    <x-ui.card.title>{{ __('Profile') }}</x-ui.card.title>
                    <x-ui.card.description>{{ __('This information may appear publicly.') }}</x-ui.card.description>
                </x-ui.card.header>
                <x-ui.card.content class="space-y-4">
                    <x-ui.field>
                        <x-ui.label for="settings-name" required>{{ __('Full name') }}</x-ui.label>
                        <x-ui.input id="settings-name" name="name" value="{{ $profile['name'] }}" autocomplete="name" required />
                    </x-ui.field>

                    <x-ui.field>
                        <x-ui.label for="settings-email" required>{{ __('Email') }}</x-ui.label>
                        <x-ui.input id="settings-email" type="email" name="email" value="{{ $profile['email'] }}" autocomplete="email" required />
                    </x-ui.field>

                    <x-ui.field>
                        <x-ui.label for="settings-bio">{{ __('Bio') }}</x-ui.label>
                        <x-ui.textarea id="settings-bio" name="bio" rows="3">{{ $profile['bio'] }}</x-ui.textarea>
                        <x-ui.field.description>{{ __('Brief description for your profile.') }}</x-ui.field.description>
                    </x-ui.field>
                </x-ui.card.content>
            </x-ui.card>

            <x-ui.card>
                <x-ui.card.header>
                    <x-ui.card.title>{{ __('Notifications') }}</x-ui.card.title>
                    <x-ui.card.description>{{ __('Choose what we email you about.') }}</x-ui.card.description>
                </x-ui.card.header>
                <x-ui.card.content class="space-y-4">
                    @foreach ($notifications as $i => $notification)
                        @if ($i > 0)
                            <x-ui.separator />
                        @endif
                        <x-ui.switch-field
                            :id="'notify-'.$notification['name']"
                            :name="'notifications['.$notification['name'].']'"
                            :label="__($notification['label'])"
                            :description="__($notification['description'])"
                            :checked="$notification['enabled']"
                        />
                    @endforeach
                </x-ui.card.content>
            </x-ui.card>

            <div class="flex justify-end gap-4">
                <x-ui.button type="reset" variant="outline">{{ __('Cancel') }}</x-ui.button>
                <x-ui.button type="submit">{{ __('Save changes') }}</x-ui.button>
            </div>
        </x-ui.form>
    </x-ui.container>
</x-ui.section>

Ownership & lifecycle

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