FAQ
faq-10
Left-aligned FAQ with questions and answers always open in a three-column grid, plus a contact prompt.
{{--
Left-aligned FAQ with questions and answers always open in a grid (three
columns on desktop) and a "Still have questions?" prompt. Every piece of content is a prop.
Each item is ['question' => ..., 'answer' => ...]. Set :schema="true" to
print FAQPage JSON-LD for search engines.
<x-ui.blocks.faq-10
heading="Frequently asked questions"
description="Everything you need to know about billing and accounts."
:items="[
['question' => 'Can I cancel at any time?', 'answer' => 'Yes. Cancel from your billing page and you keep access until the period ends.'],
['question' => 'Do you offer refunds?', 'answer' => 'We refund any payment made in the last 14 days.'],
]"
cta-heading="Still have questions?"
cta-text="Our team answers within one working day."
cta-label="Contact us"
cta-href="/contact"
:schema="true"
/>
--}}
@props([
'heading' => 'FAQs',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.',
'items' => array_fill(0, 6, [
'question' => 'Question text goes here',
'answer' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.',
]),
'ctaHeading' => 'Still have questions?',
'ctaText' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'ctaLabel' => 'Contact',
'ctaHref' => '#',
'schema' => false,
])
<section {{ $attributes->merge(['class' => 'w-full bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}>
<div class="mx-auto max-w-7xl">
<div class="mb-12 flex max-w-3xl flex-col gap-5 md:mb-18 md:gap-6 lg:mb-20">
<h2 class="text-4xl font-bold leading-[1.2] md:text-5xl">{{ $heading }}</h2>
<p class="md:text-lg">{{ $description }}</p>
</div>
<dl class="grid grid-cols-1 gap-x-12 gap-y-10 md:grid-cols-2 md:gap-y-12 lg:grid-cols-3 lg:gap-x-16 lg:gap-y-16">
@foreach ($items as $item)
<div>
<dt class="mb-3 text-base font-bold leading-normal md:mb-4 md:text-lg">{{ $item['question'] ?? '' }}</dt>
<dd>{{ $item['answer'] ?? '' }}</dd>
</div>
@endforeach
</dl>
<div class="mt-12 flex max-w-xl flex-col items-start gap-6 md:mt-18 lg:mt-20">
<div class="flex flex-col gap-3 md:gap-4">
<h3 class="text-2xl font-bold leading-[1.3] md:text-[2rem]">{{ $ctaHeading }}</h3>
<p class="md:text-lg">{{ $ctaText }}</p>
</div>
<x-ui.button variant="outline" :href="$ctaHref">{{ $ctaLabel }}</x-ui.button>
</div>
</div>
@if ($schema)
@php
// Built in a php block: Blade would read the '@context' key below as a directive anywhere else.
$faqSchema = [
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => array_map(fn ($item) => [
'@type' => 'Question',
'name' => $item['question'] ?? '',
'acceptedAnswer' => ['@type' => 'Answer', 'text' => $item['answer'] ?? ''],
], array_values($items)),
];
@endphp
<script type="application/ld+json">{!! json_encode($faqSchema, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) !!}</script>
@endif
</section>
Installation
php artisan ui:add-block faq-10
A single command installs the block's Blade file and every component it depends on. Render it in your own layout as
<x-ui.blocks.faq-10
/>.
Components it includes
1. Install component dependencies
php artisan ui:add button
2. External packages
- composer:
gehrisandro/tailwind-merge-laravel
3.
Copy the block source into
resources/views/components/ui/
resources/views/components/ui/blocks/faq-10.blade.php
{{--
Left-aligned FAQ with questions and answers always open in a grid (three
columns on desktop) and a "Still have questions?" prompt. Every piece of content is a prop.
Each item is ['question' => ..., 'answer' => ...]. Set :schema="true" to
print FAQPage JSON-LD for search engines.
<x-ui.blocks.faq-10
heading="Frequently asked questions"
description="Everything you need to know about billing and accounts."
:items="[
['question' => 'Can I cancel at any time?', 'answer' => 'Yes. Cancel from your billing page and you keep access until the period ends.'],
['question' => 'Do you offer refunds?', 'answer' => 'We refund any payment made in the last 14 days.'],
]"
cta-heading="Still have questions?"
cta-text="Our team answers within one working day."
cta-label="Contact us"
cta-href="/contact"
:schema="true"
/>
--}}
@props([
'heading' => 'FAQs',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.',
'items' => array_fill(0, 6, [
'question' => 'Question text goes here',
'answer' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.',
]),
'ctaHeading' => 'Still have questions?',
'ctaText' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'ctaLabel' => 'Contact',
'ctaHref' => '#',
'schema' => false,
])
<section {{ $attributes->merge(['class' => 'w-full bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}>
<div class="mx-auto max-w-7xl">
<div class="mb-12 flex max-w-3xl flex-col gap-5 md:mb-18 md:gap-6 lg:mb-20">
<h2 class="text-4xl font-bold leading-[1.2] md:text-5xl">{{ $heading }}</h2>
<p class="md:text-lg">{{ $description }}</p>
</div>
<dl class="grid grid-cols-1 gap-x-12 gap-y-10 md:grid-cols-2 md:gap-y-12 lg:grid-cols-3 lg:gap-x-16 lg:gap-y-16">
@foreach ($items as $item)
<div>
<dt class="mb-3 text-base font-bold leading-normal md:mb-4 md:text-lg">{{ $item['question'] ?? '' }}</dt>
<dd>{{ $item['answer'] ?? '' }}</dd>
</div>
@endforeach
</dl>
<div class="mt-12 flex max-w-xl flex-col items-start gap-6 md:mt-18 lg:mt-20">
<div class="flex flex-col gap-3 md:gap-4">
<h3 class="text-2xl font-bold leading-[1.3] md:text-[2rem]">{{ $ctaHeading }}</h3>
<p class="md:text-lg">{{ $ctaText }}</p>
</div>
<x-ui.button variant="outline" :href="$ctaHref">{{ $ctaLabel }}</x-ui.button>
</div>
</div>
@if ($schema)
@php
// Built in a php block: Blade would read the '@context' key below as a directive anywhere else.
$faqSchema = [
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => array_map(fn ($item) => [
'@type' => 'Question',
'name' => $item['question'] ?? '',
'acceptedAnswer' => ['@type' => 'Answer', 'text' => $item['answer'] ?? ''],
], array_values($items)),
];
@endphp
<script type="application/ld+json">{!! json_encode($faqSchema, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) !!}</script>
@endif
</section>
Usage
Left-aligned FAQ with questions and answers always open in a grid (three columns on desktop) and a "Still have questions?" prompt. Every piece of content is a prop. Each item is ['question' => ..., 'answer' => ...]. Set :schema="true" to print FAQPage JSON-LD for search engines.
<x-ui.blocks.faq-10
heading="Frequently asked questions"
description="Everything you need to know about billing and accounts."
:items="[
['question' => 'Can I cancel at any time?', 'answer' => 'Yes. Cancel from your billing page and you keep access until the period ends.'],
['question' => 'Do you offer refunds?', 'answer' => 'We refund any payment made in the last 14 days.'],
]"
cta-heading="Still have questions?"
cta-text="Our team answers within one working day."
cta-label="Contact us"
cta-href="/contact"
:schema="true"
/>
Props
Every prop with its default. Pass any of them as attributes, using : to bind a PHP value.
@props([
'heading' => 'FAQs',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.',
'items' => array_fill(0, 6, [
'question' => 'Question text goes here',
'answer' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.',
]),
'ctaHeading' => 'Still have questions?',
'ctaText' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'ctaLabel' => 'Contact',
'ctaHref' => '#',
'schema' => false,
])