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

6 of 8

resources/views/blocks/faq-search.blade.php Blade
@props([
    'heading'    => 'Frequently asked questions',
    'subheading' => 'Can\'t find the answer you\'re looking for? Browse the topics below or reach out to our support team.',
    'hint'       => 'e.g. billing, refunds, API limits',
    'items'      => null,
])

@php
    $items ??= [
        ['question' => 'Is there a free plan?', 'answer' => 'Yes — our Starter tier is free forever with no credit card required. It includes up to 3 projects, 5 team members, and 1 GB of storage. You can upgrade at any time from your account dashboard.'],
        ['question' => 'How does billing work?', 'answer' => 'We bill monthly or annually. Annual plans include a 20% discount compared to month-to-month pricing. Your card is charged on the same calendar day each cycle, and you receive a receipt by email.'],
        ['question' => 'Can I get a refund?', 'answer' => 'We offer a 30-day money-back guarantee on all paid plans. If you are not satisfied for any reason, contact support within 30 days of your initial purchase and we will issue a full refund.'],
        ['question' => 'What are the API rate limits?', 'answer' => 'Rate limits depend on your plan tier. Starter accounts are limited to 100 requests per minute; Pro accounts to 1,000; Enterprise accounts have custom limits negotiated during onboarding.'],
        ['question' => 'How do I add or remove team members?', 'answer' => 'Navigate to Settings then Team in your dashboard. From there you can invite people by email, assign roles, and remove members instantly. Changes take effect immediately.'],
        ['question' => 'Is my data encrypted?', 'answer' => 'All data is encrypted in transit with TLS 1.3 and at rest with AES-256. We are SOC 2 Type II certified and undergo annual third-party penetration tests.'],
        ['question' => 'Can I export my data?', 'answer' => 'Yes. Go to Settings then Data & Privacy and click Export everything. You will receive a compressed archive containing your projects, assets, and activity logs in open formats.'],
    ];
@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>

        <form role="search" action="#" method="GET" class="mt-10">
            <div class="mx-auto max-w-xl">
                <label for="faq-search-input" class="sr-only">{{ __('Search frequently asked questions') }}</label>
                <div class="relative">
                    <span class="pointer-events-none absolute inset-y-0 start-3 flex items-center text-muted-foreground" aria-hidden="true">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4" aria-hidden="true">
                            <circle cx="11" cy="11" r="8" /><path d="m21 21-4.35-4.35" />
                        </svg>
                    </span>
                    <x-ui.input id="faq-search-input" type="search" name="q" class="ps-10" :placeholder="__('Search for answers…')" aria-label="{{ __('Search frequently asked questions') }}" autocomplete="off" />
                </div>
                <p class="mt-2 text-center text-sm text-muted-foreground">{{ __($hint) }}</p>
            </div>
        </form>

        <p class="mt-8 text-sm text-muted-foreground">{{ trans_choice(':count article|:count articles', count($items), ['count' => count($items)]) }}</p>

        <x-ui.accordion class="mt-4">
            @foreach ($items as $i => $item)
                <x-ui.accordion.item :value="'faq-search-'.$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-search

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

accordion input 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-search.md
# Brok UI block: FAQ Search (`faq-search`)

An FAQ section with a prominent search field and an article count above an accordion of grouped questions.

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

## Render it

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

## Props

- `heading` (string, default `Frequently asked questions`)
- `subheading` (string, default `Can\'t find the answer you\'re looking for? Browse the topics below or reach out to our support team.`)
- `hint` (string, default `e.g. billing, refunds, API limits`)
- `items` (mixed|null, default `null`)

## Use when

- Fronting an FAQ with a prominent search field and an article count above a grouped accordion of questions.
- Fitting a help-centre style page where visitors are expected to search rather than scan.

## Avoid when

- Use faq-categories for grouped categories without a search field, if the question count is small.

## Rules

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

  • Fronting an FAQ with a prominent search field and an article count above a grouped accordion of questions.
  • Fitting a help-centre style page where visitors are expected to search rather than scan.

Avoid when

  • Use faq-categories for grouped categories without a search field, if the question count is small.

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-search />

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-search.blade.php Blade
@props([
    'heading'    => 'Frequently asked questions',
    'subheading' => 'Can\'t find the answer you\'re looking for? Browse the topics below or reach out to our support team.',
    'hint'       => 'e.g. billing, refunds, API limits',
    'items'      => null,
])

@php
    $items ??= [
        ['question' => 'Is there a free plan?', 'answer' => 'Yes — our Starter tier is free forever with no credit card required. It includes up to 3 projects, 5 team members, and 1 GB of storage. You can upgrade at any time from your account dashboard.'],
        ['question' => 'How does billing work?', 'answer' => 'We bill monthly or annually. Annual plans include a 20% discount compared to month-to-month pricing. Your card is charged on the same calendar day each cycle, and you receive a receipt by email.'],
        ['question' => 'Can I get a refund?', 'answer' => 'We offer a 30-day money-back guarantee on all paid plans. If you are not satisfied for any reason, contact support within 30 days of your initial purchase and we will issue a full refund.'],
        ['question' => 'What are the API rate limits?', 'answer' => 'Rate limits depend on your plan tier. Starter accounts are limited to 100 requests per minute; Pro accounts to 1,000; Enterprise accounts have custom limits negotiated during onboarding.'],
        ['question' => 'How do I add or remove team members?', 'answer' => 'Navigate to Settings then Team in your dashboard. From there you can invite people by email, assign roles, and remove members instantly. Changes take effect immediately.'],
        ['question' => 'Is my data encrypted?', 'answer' => 'All data is encrypted in transit with TLS 1.3 and at rest with AES-256. We are SOC 2 Type II certified and undergo annual third-party penetration tests.'],
        ['question' => 'Can I export my data?', 'answer' => 'Yes. Go to Settings then Data & Privacy and click Export everything. You will receive a compressed archive containing your projects, assets, and activity logs in open formats.'],
    ];
@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>

        <form role="search" action="#" method="GET" class="mt-10">
            <div class="mx-auto max-w-xl">
                <label for="faq-search-input" class="sr-only">{{ __('Search frequently asked questions') }}</label>
                <div class="relative">
                    <span class="pointer-events-none absolute inset-y-0 start-3 flex items-center text-muted-foreground" aria-hidden="true">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4" aria-hidden="true">
                            <circle cx="11" cy="11" r="8" /><path d="m21 21-4.35-4.35" />
                        </svg>
                    </span>
                    <x-ui.input id="faq-search-input" type="search" name="q" class="ps-10" :placeholder="__('Search for answers…')" aria-label="{{ __('Search frequently asked questions') }}" autocomplete="off" />
                </div>
                <p class="mt-2 text-center text-sm text-muted-foreground">{{ __($hint) }}</p>
            </div>
        </form>

        <p class="mt-8 text-sm text-muted-foreground">{{ trans_choice(':count article|:count articles', count($items), ['count' => count($items)]) }}</p>

        <x-ui.accordion class="mt-4">
            @foreach ($items as $i => $item)
                <x-ui.accordion.item :value="'faq-search-'.$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.3
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0