Skip to content
Brok UI

Loading…

No results

FAQ

Open source

Frequently-asked-question sections — an accordion, a two-column split, a static grid and grouped categories.

Preview

7 of 8

resources/views/blocks/faq-tabs.blade.php Blade
@props([
    'heading' => 'Frequently asked questions',
    'subheading' => 'Pick a topic to see the questions that matter most. Still stuck? Our team is one message away.',
    'categories' => null,
])

@php
    $categories ??= [
        [
            'label' => 'Billing',
            'items' => [
                ['question' => 'Is there a free tier?', 'answer' => 'The open core is free and MIT licensed. Pro items require a license and unlock additional blocks and admin tooling.'],
                ['question' => 'How does billing work?', 'answer' => 'Plans are billed monthly or annually. You can upgrade, downgrade, or cancel at any time from your account settings.'],
                ['question' => 'Which payment methods do you accept?', 'answer' => 'We accept all major cards and regional payment methods through our checkout. Invoices are issued automatically for every charge.'],
            ],
        ],
        [
            'label' => 'Shipping',
            'items' => [
                ['question' => 'How long does delivery take?', 'answer' => 'Standard delivery arrives within three to five business days. Express options are available at checkout for next-day arrival.'],
                ['question' => 'Do you ship internationally?', 'answer' => 'Yes. We ship to most countries, with duties and taxes calculated at checkout so there are no surprises on arrival.'],
            ],
        ],
        [
            'label' => 'Returns',
            'items' => [
                ['question' => 'What is your return window?', 'answer' => 'You can return any unused item within thirty days of delivery for a full refund to your original payment method.'],
                ['question' => 'How do I start a return?', 'answer' => 'Open your order history, choose the item, and request a return label. Drop the package at any carrier location.'],
                ['question' => 'When will I be refunded?', 'answer' => 'Refunds are processed within five business days of us receiving the returned item and clear back to your account shortly after.'],
            ],
        ],
        [
            'label' => 'Account',
            'items' => [
                ['question' => 'How do I reset my password?', 'answer' => 'Use the reset link on the sign-in screen. We will email you a secure, single-use link to choose a new password.'],
                ['question' => 'Can I change my email address?', 'answer' => 'Yes. Update your email under account settings and confirm the change from the verification message we send you.'],
            ],
        ],
    ];
@endphp

<x-ui.section
    data-slot="faq-07"
    space="xl" {{ $attributes }}
>
    <div class="mx-auto max-w-3xl px-4">
        <div class="text-center">
            <h2 class="text-balance text-3xl font-bold tracking-tight sm:text-4xl">{{ __($heading) }}</h2>
            <p class="mx-auto mt-4 max-w-2xl text-pretty text-lg text-muted-foreground">{{ __($subheading) }}</p>
        </div>

        <x-ui.tabs default="faq-tabs-01-0" variant="pills" marker="filled" class="mt-12 sm:mt-16">
            <x-ui.tabs.list class="mx-auto flex-wrap justify-center" aria-label="{{ __('FAQ categories') }}">
                @foreach ($categories as $c => $category)
                    <x-ui.tabs.trigger :value="'faq-tabs-01-'.$c">
                        {{ __($category['label']) }}
                        <x-ui.badge variant="secondary" class="ms-2">{{ count($category['items']) }}</x-ui.badge>
                    </x-ui.tabs.trigger>
                @endforeach
            </x-ui.tabs.list>

            @foreach ($categories as $c => $category)
                <x-ui.tabs.content :value="'faq-tabs-01-'.$c" class="mt-8">
                    <x-ui.accordion>
                        @foreach ($category['items'] as $i => $item)
                            <x-ui.accordion.item :value="'faq-'.$c.'-'.$i">
                                <x-ui.accordion.trigger class="text-start">{{ __($item['question']) }}</x-ui.accordion.trigger>
                                <x-ui.accordion.content>{{ __($item['answer']) }}</x-ui.accordion.content>
                            </x-ui.accordion.item>
                        @endforeach
                    </x-ui.accordion>
                </x-ui.tabs.content>
            @endforeach
        </x-ui.tabs>
    </div>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/faq-tabs

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/faq-tabs 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/faq-tabs.blade.php

Registry dependencies

accordion badge section tabs

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.

faq-tabs.md
# Brok UI block: FAQ Tabs (`faq-tabs`)

A centered FAQ section with a row of category tabs (Billing, Shipping, Returns, Account) that switch which accordion of questions is shown. Each tab carries a question-count badge, tabs and panels are wired with roving tabindex and aria-controls/aria-labelledby, and only the active category's accordion is visible.

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/faq-tabs
```

## Render it

```blade
<x-blocks.faq-tabs />
```

## Props

- `heading` (string, default `Frequently asked questions`)
- `subheading` (string, default `Pick a topic to see the questions that matter most. Still stuck? Our team is one message away.`)
- `categories` (mixed|null, default `null`)

## Use when

- Switching between FAQ categories (Billing, Shipping, Returns, Account) via a row of tabs, each with a question-count badge.
- Showing only the active category's accordion at a time, keeping the page short.

## Avoid when

- Use faq-categories for all categories shown at once (stacked), rather than switched via tabs.

## Rules

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

  • Switching between FAQ categories (Billing, Shipping, Returns, Account) via a row of tabs, each with a question-count badge.
  • Showing only the active category's accordion at a time, keeping the page short.

Avoid when

  • Use faq-categories for all categories shown at once (stacked), rather than switched via tabs.

Anti-patterns

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

Usage

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

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

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/faq-tabs.blade.php Blade
@props([
    'heading' => 'Frequently asked questions',
    'subheading' => 'Pick a topic to see the questions that matter most. Still stuck? Our team is one message away.',
    'categories' => null,
])

@php
    $categories ??= [
        [
            'label' => 'Billing',
            'items' => [
                ['question' => 'Is there a free tier?', 'answer' => 'The open core is free and MIT licensed. Pro items require a license and unlock additional blocks and admin tooling.'],
                ['question' => 'How does billing work?', 'answer' => 'Plans are billed monthly or annually. You can upgrade, downgrade, or cancel at any time from your account settings.'],
                ['question' => 'Which payment methods do you accept?', 'answer' => 'We accept all major cards and regional payment methods through our checkout. Invoices are issued automatically for every charge.'],
            ],
        ],
        [
            'label' => 'Shipping',
            'items' => [
                ['question' => 'How long does delivery take?', 'answer' => 'Standard delivery arrives within three to five business days. Express options are available at checkout for next-day arrival.'],
                ['question' => 'Do you ship internationally?', 'answer' => 'Yes. We ship to most countries, with duties and taxes calculated at checkout so there are no surprises on arrival.'],
            ],
        ],
        [
            'label' => 'Returns',
            'items' => [
                ['question' => 'What is your return window?', 'answer' => 'You can return any unused item within thirty days of delivery for a full refund to your original payment method.'],
                ['question' => 'How do I start a return?', 'answer' => 'Open your order history, choose the item, and request a return label. Drop the package at any carrier location.'],
                ['question' => 'When will I be refunded?', 'answer' => 'Refunds are processed within five business days of us receiving the returned item and clear back to your account shortly after.'],
            ],
        ],
        [
            'label' => 'Account',
            'items' => [
                ['question' => 'How do I reset my password?', 'answer' => 'Use the reset link on the sign-in screen. We will email you a secure, single-use link to choose a new password.'],
                ['question' => 'Can I change my email address?', 'answer' => 'Yes. Update your email under account settings and confirm the change from the verification message we send you.'],
            ],
        ],
    ];
@endphp

<x-ui.section
    data-slot="faq-07"
    space="xl" {{ $attributes }}
>
    <div class="mx-auto max-w-3xl px-4">
        <div class="text-center">
            <h2 class="text-balance text-3xl font-bold tracking-tight sm:text-4xl">{{ __($heading) }}</h2>
            <p class="mx-auto mt-4 max-w-2xl text-pretty text-lg text-muted-foreground">{{ __($subheading) }}</p>
        </div>

        <x-ui.tabs default="faq-tabs-01-0" variant="pills" marker="filled" class="mt-12 sm:mt-16">
            <x-ui.tabs.list class="mx-auto flex-wrap justify-center" aria-label="{{ __('FAQ categories') }}">
                @foreach ($categories as $c => $category)
                    <x-ui.tabs.trigger :value="'faq-tabs-01-'.$c">
                        {{ __($category['label']) }}
                        <x-ui.badge variant="secondary" class="ms-2">{{ count($category['items']) }}</x-ui.badge>
                    </x-ui.tabs.trigger>
                @endforeach
            </x-ui.tabs.list>

            @foreach ($categories as $c => $category)
                <x-ui.tabs.content :value="'faq-tabs-01-'.$c" class="mt-8">
                    <x-ui.accordion>
                        @foreach ($category['items'] as $i => $item)
                            <x-ui.accordion.item :value="'faq-'.$c.'-'.$i">
                                <x-ui.accordion.trigger class="text-start">{{ __($item['question']) }}</x-ui.accordion.trigger>
                                <x-ui.accordion.content>{{ __($item['answer']) }}</x-ui.accordion.content>
                            </x-ui.accordion.item>
                        @endforeach
                    </x-ui.accordion>
                </x-ui.tabs.content>
            @endforeach
        </x-ui.tabs>
    </div>
</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