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

1 of 8

resources/views/blocks/faq-accordion.blade.php Blade
@props([
    'heading' => 'Frequently asked questions',
    'subheading' => 'Everything you need to know about the product and billing.',
    'items' => null,
])

@php
    $items ??= [
        ['question' => 'Do I own the installed code?', 'answer' => 'Yes. Components and blocks are copied into your project as plain Blade. There is no runtime lock-in — edit anything you like.'],
        ['question' => 'How do updates work?', 'answer' => 'Run the update command to pull upstream changes. Unedited files update automatically; edited files are never overwritten and produce a reviewable diff.'],
        ['question' => 'Can I theme it?', 'answer' => 'The entire system is driven by CSS design tokens. Re-theme light, dark, and per-surface variants by editing variables only.'],
        ['question' => 'Is it accessible?', 'answer' => 'Components target WCAG 2.2 AA: keyboard support, focus-visible states, ARIA wiring, reduced motion, and RTL-safe layout.'],
    ];
@endphp

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

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

Installation

terminal
php artisan ui:add blocks/faq-accordion

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

accordion section

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.

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

A frequently-asked-questions section built on the interactive accordion primitive.

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-accordion
```

## Render it

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

## Props

- `heading` (string, default `Frequently asked questions`)
- `subheading` (string, default `Everything you need to know about the product and billing.`)
- `items` (mixed|null, default `null`)

## Use when

- Answering common questions in a single, centred accordion — the simplest FAQ layout in the family.
- Fitting a page that needs a short, unstructured list of question/answer pairs.

## Avoid when

- Use faq-split for a two-column layout with a support CTA, or faq-categories for questions grouped into categories.

## Rules

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

  • Answering common questions in a single, centred accordion — the simplest FAQ layout in the family.
  • Fitting a page that needs a short, unstructured list of question/answer pairs.

Avoid when

  • Use faq-split for a two-column layout with a support CTA, or faq-categories for questions grouped into categories.

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.faq-accordion />

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-accordion.blade.php Blade
@props([
    'heading' => 'Frequently asked questions',
    'subheading' => 'Everything you need to know about the product and billing.',
    'items' => null,
])

@php
    $items ??= [
        ['question' => 'Do I own the installed code?', 'answer' => 'Yes. Components and blocks are copied into your project as plain Blade. There is no runtime lock-in — edit anything you like.'],
        ['question' => 'How do updates work?', 'answer' => 'Run the update command to pull upstream changes. Unedited files update automatically; edited files are never overwritten and produce a reviewable diff.'],
        ['question' => 'Can I theme it?', 'answer' => 'The entire system is driven by CSS design tokens. Re-theme light, dark, and per-surface variants by editing variables only.'],
        ['question' => 'Is it accessible?', 'answer' => 'Components target WCAG 2.2 AA: keyboard support, focus-visible states, ARIA wiring, reduced motion, and RTL-safe layout.'],
    ];
@endphp

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

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

Ownership & lifecycle

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