Skip to content
Brok UI

Loading…

No results

Community

Open source

A join-the-community section with a row of total stats and a responsive grid of channel cards (Discord, GitHub, X, Forum), each with a glyph, member count, and a join/follow button linking out.

Responsive Dark mode RTL Localized SEO

Preview

resources/views/blocks/community.blade.php Blade
@props([
    'eyebrow' => 'Community',
    'heading' => 'Join our community',
    'lead' => 'Connect with thousands of developers building with us — get help, share what you ship, and stay in the loop.',
    'stats' => null,
    'channels' => null,
])

@php
    $stats ??= [
        ['value' => '38k+', 'label' => __('Community members')],
        ['value' => '120+', 'label' => __('Countries')],
        ['value' => '1.2k', 'label' => __('Daily messages')],
    ];

    // `icon` keys map to a fixed switch in the loop below — never spliced into a class.
    $channels ??= [
        [
            'icon' => 'discord',
            'name' => 'Discord',
            'count' => __(':n members', ['n' => '12.4k']),
            'description' => __('Real-time chat, support, and show-and-tell.'),
            'action' => __('Join server'),
            'href' => 'https://discord.com',
        ],
        [
            'icon' => 'github',
            'name' => 'GitHub',
            'count' => __(':n stars', ['n' => '9.8k']),
            'description' => __('Browse the source, open issues, and contribute.'),
            'action' => __('Star repo'),
            'href' => 'https://github.com',
        ],
        [
            'icon' => 'x',
            'name' => 'X',
            'count' => __(':n followers', ['n' => '21.3k']),
            'description' => __('Product news, releases, and behind-the-scenes.'),
            'action' => __('Follow'),
            'href' => 'https://x.com',
        ],
        [
            'icon' => 'forum',
            'name' => 'Forum',
            'count' => __(':n topics', ['n' => '4.6k']),
            'description' => __('Long-form discussions, RFCs, and guides.'),
            'action' => __('Visit forum'),
            'href' => 'https://example.com/forum',
        ],
    ];
@endphp

<x-ui.section
    space="xl" {{ $attributes }}
    aria-labelledby="community-01-heading"
    data-slot="community"
>
    <x-ui.container gutter="sm">
        <div class="flex max-w-2xl flex-col items-start gap-4">
            @if ($eyebrow)
                <x-ui.badge variant="secondary">{{ __($eyebrow) }}</x-ui.badge>
            @endif

            <h2 id="community-01-heading" class="text-balance text-3xl font-bold tracking-tight sm:text-4xl">
                {{ __($heading) }}
            </h2>

            @if ($lead)
                <p class="text-pretty text-base text-muted-foreground sm:text-lg">{{ __($lead) }}</p>
            @endif
        </div>

        @if (! empty($stats))
            <div class="mt-12 grid grid-cols-1 gap-4 sm:grid-cols-3">
                @foreach ($stats as $stat)
                    <x-ui.stat :label="$stat['label']" :value="$stat['value']" />
                @endforeach
            </div>
        @endif

        <ul role="list" class="mt-12 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-4">
            @foreach ($channels as $channel)
                <li>
                    <x-ui.card class="flex h-full flex-col">
                        <x-ui.card.header>
                            <span class="flex size-12 items-center justify-center rounded-md bg-primary/10 text-primary">
                                @switch($channel['icon'])
                                    @case('discord')
                                        <svg class="size-6" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                                            <path d="M20.32 4.37A19.8 19.8 0 0 0 15.39 3a13.7 13.7 0 0 0-.63 1.28 18.3 18.3 0 0 0-5.5 0A12.6 12.6 0 0 0 8.62 3a19.7 19.7 0 0 0-4.93 1.37C.55 9.05-.3 13.6.13 18.1a19.9 19.9 0 0 0 6.06 3.06c.49-.66.92-1.36 1.3-2.1-.71-.27-1.39-.6-2.04-.99.17-.13.34-.26.5-.4a14.2 14.2 0 0 0 12.1 0c.16.14.33.27.5.4-.65.39-1.34.72-2.05.99.38.74.81 1.44 1.3 2.1a19.8 19.8 0 0 0 6.07-3.06c.5-5.18-.85-9.69-3.55-13.73ZM8.02 15.33c-1.18 0-2.15-1.08-2.15-2.4 0-1.32.95-2.41 2.15-2.41 1.2 0 2.17 1.09 2.15 2.41 0 1.32-.95 2.4-2.15 2.4Zm7.96 0c-1.18 0-2.15-1.08-2.15-2.4 0-1.32.95-2.41 2.15-2.41 1.2 0 2.17 1.09 2.15 2.41 0 1.32-.95 2.4-2.15 2.4Z"/>
                                        </svg>
                                        @break
                                    @case('github')
                                        <svg class="size-6" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                                            <path d="M12 2a10 10 0 0 0-3.16 19.49c.5.09.68-.22.68-.48v-1.7c-2.78.6-3.37-1.34-3.37-1.34-.45-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.53 2.34 1.09 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.98 1.03-2.68-.1-.25-.45-1.27.1-2.65 0 0 .84-.27 2.75 1.02a9.56 9.56 0 0 1 5 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.38.2 2.4.1 2.65.64.7 1.03 1.59 1.03 2.68 0 3.84-2.34 4.69-4.57 4.93.36.31.68.92.68 1.85v2.74c0 .27.18.58.69.48A10 10 0 0 0 12 2Z"/>
                                        </svg>
                                        @break
                                    @case('x')
                                        <svg class="size-6" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                                            <path d="M18.24 2.25h3.31l-7.23 8.26 8.5 11.24h-6.66l-5.21-6.82-5.97 6.82H1.66l7.73-8.84L1.25 2.25h6.83l4.71 6.23 5.45-6.23Zm-1.16 17.52h1.83L7.01 4.12H5.04l12.04 15.65Z"/>
                                        </svg>
                                        @break
                                    @default
                                        <svg class="size-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                                            <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
                                        </svg>
                                @endswitch
                            </span>

                            <x-ui.card.title class="mt-4 flex items-center gap-2">
                                {{ $channel['name'] }}
                            </x-ui.card.title>

                            <p class="text-sm font-medium text-muted-foreground">{{ $channel['count'] }}</p>
                        </x-ui.card.header>

                        <x-ui.card.content class="flex-1">
                            <p class="text-sm text-muted-foreground">{{ $channel['description'] }}</p>
                        </x-ui.card.content>

                        <x-ui.card.footer>
                            <x-ui.button
                                variant="outline"
                                class="w-full"
                                :href="$channel['href']"
                                withArrow
                                arrow-class="rtl:rotate-180"
                            >
                                {{ $channel['action'] }}
                                <span class="sr-only"> — {{ $channel['name'] }}</span>
                            </x-ui.button>
                        </x-ui.card.footer>
                    </x-ui.card>
                </li>
            @endforeach
        </ul>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/community

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

badge button card container section stat

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.

community.md
# Brok UI block: Community (`community`)

A join-the-community section with a row of total stats and a responsive grid of channel cards (Discord, GitHub, X, Forum), each with a glyph, member count, and a join/follow button linking out.

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/community
```

## Render it

```blade
<x-blocks.community />
```

## Props

- `eyebrow` (string, default `Community`)
- `heading` (string, default `Join our community`)
- `lead` (string, default `Connect with thousands of developers building with us — get help, share what you ship, and stay in the loop.`)
- `stats` (mixed|null, default `null`)
- `channels` (mixed|null, default `null`)

## Use when

- Inviting visitors to join community channels (Discord, GitHub, X, forum) via a row of stats and a channel-card grid.
- Showing a member count per channel so each card reads as an active, populated space.

## Avoid when

- Use footer-centered or footer-social for a lighter social-icon row instead of a dedicated community section.

## Rules

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

  • Inviting visitors to join community channels (Discord, GitHub, X, forum) via a row of stats and a channel-card grid.
  • Showing a member count per channel so each card reads as an active, populated space.

Avoid when

  • Use footer-centered or footer-social for a lighter social-icon row instead of a dedicated community section.

Anti-patterns

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

Usage

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

resources/views/welcome.blade.php Blade
<x-blocks.community />

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/community.blade.php Blade
@props([
    'eyebrow' => 'Community',
    'heading' => 'Join our community',
    'lead' => 'Connect with thousands of developers building with us — get help, share what you ship, and stay in the loop.',
    'stats' => null,
    'channels' => null,
])

@php
    $stats ??= [
        ['value' => '38k+', 'label' => __('Community members')],
        ['value' => '120+', 'label' => __('Countries')],
        ['value' => '1.2k', 'label' => __('Daily messages')],
    ];

    // `icon` keys map to a fixed switch in the loop below — never spliced into a class.
    $channels ??= [
        [
            'icon' => 'discord',
            'name' => 'Discord',
            'count' => __(':n members', ['n' => '12.4k']),
            'description' => __('Real-time chat, support, and show-and-tell.'),
            'action' => __('Join server'),
            'href' => 'https://discord.com',
        ],
        [
            'icon' => 'github',
            'name' => 'GitHub',
            'count' => __(':n stars', ['n' => '9.8k']),
            'description' => __('Browse the source, open issues, and contribute.'),
            'action' => __('Star repo'),
            'href' => 'https://github.com',
        ],
        [
            'icon' => 'x',
            'name' => 'X',
            'count' => __(':n followers', ['n' => '21.3k']),
            'description' => __('Product news, releases, and behind-the-scenes.'),
            'action' => __('Follow'),
            'href' => 'https://x.com',
        ],
        [
            'icon' => 'forum',
            'name' => 'Forum',
            'count' => __(':n topics', ['n' => '4.6k']),
            'description' => __('Long-form discussions, RFCs, and guides.'),
            'action' => __('Visit forum'),
            'href' => 'https://example.com/forum',
        ],
    ];
@endphp

<x-ui.section
    space="xl" {{ $attributes }}
    aria-labelledby="community-01-heading"
    data-slot="community"
>
    <x-ui.container gutter="sm">
        <div class="flex max-w-2xl flex-col items-start gap-4">
            @if ($eyebrow)
                <x-ui.badge variant="secondary">{{ __($eyebrow) }}</x-ui.badge>
            @endif

            <h2 id="community-01-heading" class="text-balance text-3xl font-bold tracking-tight sm:text-4xl">
                {{ __($heading) }}
            </h2>

            @if ($lead)
                <p class="text-pretty text-base text-muted-foreground sm:text-lg">{{ __($lead) }}</p>
            @endif
        </div>

        @if (! empty($stats))
            <div class="mt-12 grid grid-cols-1 gap-4 sm:grid-cols-3">
                @foreach ($stats as $stat)
                    <x-ui.stat :label="$stat['label']" :value="$stat['value']" />
                @endforeach
            </div>
        @endif

        <ul role="list" class="mt-12 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-4">
            @foreach ($channels as $channel)
                <li>
                    <x-ui.card class="flex h-full flex-col">
                        <x-ui.card.header>
                            <span class="flex size-12 items-center justify-center rounded-md bg-primary/10 text-primary">
                                @switch($channel['icon'])
                                    @case('discord')
                                        <svg class="size-6" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                                            <path d="M20.32 4.37A19.8 19.8 0 0 0 15.39 3a13.7 13.7 0 0 0-.63 1.28 18.3 18.3 0 0 0-5.5 0A12.6 12.6 0 0 0 8.62 3a19.7 19.7 0 0 0-4.93 1.37C.55 9.05-.3 13.6.13 18.1a19.9 19.9 0 0 0 6.06 3.06c.49-.66.92-1.36 1.3-2.1-.71-.27-1.39-.6-2.04-.99.17-.13.34-.26.5-.4a14.2 14.2 0 0 0 12.1 0c.16.14.33.27.5.4-.65.39-1.34.72-2.05.99.38.74.81 1.44 1.3 2.1a19.8 19.8 0 0 0 6.07-3.06c.5-5.18-.85-9.69-3.55-13.73ZM8.02 15.33c-1.18 0-2.15-1.08-2.15-2.4 0-1.32.95-2.41 2.15-2.41 1.2 0 2.17 1.09 2.15 2.41 0 1.32-.95 2.4-2.15 2.4Zm7.96 0c-1.18 0-2.15-1.08-2.15-2.4 0-1.32.95-2.41 2.15-2.41 1.2 0 2.17 1.09 2.15 2.41 0 1.32-.95 2.4-2.15 2.4Z"/>
                                        </svg>
                                        @break
                                    @case('github')
                                        <svg class="size-6" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                                            <path d="M12 2a10 10 0 0 0-3.16 19.49c.5.09.68-.22.68-.48v-1.7c-2.78.6-3.37-1.34-3.37-1.34-.45-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.53 2.34 1.09 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.98 1.03-2.68-.1-.25-.45-1.27.1-2.65 0 0 .84-.27 2.75 1.02a9.56 9.56 0 0 1 5 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.38.2 2.4.1 2.65.64.7 1.03 1.59 1.03 2.68 0 3.84-2.34 4.69-4.57 4.93.36.31.68.92.68 1.85v2.74c0 .27.18.58.69.48A10 10 0 0 0 12 2Z"/>
                                        </svg>
                                        @break
                                    @case('x')
                                        <svg class="size-6" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                                            <path d="M18.24 2.25h3.31l-7.23 8.26 8.5 11.24h-6.66l-5.21-6.82-5.97 6.82H1.66l7.73-8.84L1.25 2.25h6.83l4.71 6.23 5.45-6.23Zm-1.16 17.52h1.83L7.01 4.12H5.04l12.04 15.65Z"/>
                                        </svg>
                                        @break
                                    @default
                                        <svg class="size-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                                            <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
                                        </svg>
                                @endswitch
                            </span>

                            <x-ui.card.title class="mt-4 flex items-center gap-2">
                                {{ $channel['name'] }}
                            </x-ui.card.title>

                            <p class="text-sm font-medium text-muted-foreground">{{ $channel['count'] }}</p>
                        </x-ui.card.header>

                        <x-ui.card.content class="flex-1">
                            <p class="text-sm text-muted-foreground">{{ $channel['description'] }}</p>
                        </x-ui.card.content>

                        <x-ui.card.footer>
                            <x-ui.button
                                variant="outline"
                                class="w-full"
                                :href="$channel['href']"
                                withArrow
                                arrow-class="rtl:rotate-180"
                            >
                                {{ $channel['action'] }}
                                <span class="sr-only"> — {{ $channel['name'] }}</span>
                            </x-ui.button>
                        </x-ui.card.footer>
                    </x-ui.card>
                </li>
            @endforeach
        </ul>
    </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.0.5
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0