Skip to content

Section Heading

Section title with an optional description, used to introduce the content of a card or a form.

The section heading introduces a section inside a page: a title, and an optional description that explains what the section holds. The card renders one for its title.

Preview

The preview shows a title with a description.

General InformationThe name, description and pricing of the product.

Usage

Pass the title and the description as attributes:

<x-shopper::section-heading
    title="General Information"
    description="The name, description and pricing of the product."
/>

The title and description are rendered with Filament's section heading and description components, so they match the headings of Filament sections in the same page.

Props

The title is required. Other attributes go to the wrapping div.

PropDefaultDescription
x-shopper::section-headingrenders a <div> element
title
string
required

The section title.

description
string
null

Text displayed below the title.

Examples

The examples below show the component alone, with a description, and inside a card.

Title Only

Leave out the description for a short title.

Pricing

This Blade passes the title only:

<x-shopper::section-heading title="Pricing" />

With Description

The description is limited to a readable line length.

InventoryStock levels, SKU and barcode of the product.

This Blade adds the description under the title:

<x-shopper::section-heading
    title="Inventory"
    description="Stock levels, SKU and barcode of the product."
/>

Inside a Card

The card uses the section heading when you pass it a title string, and forwards its description:

MediaImages and videos shown on the product page.
No media yet

This Blade passes the title and the description to the card, and puts an empty card in it:

<x-shopper::card
    title="Media"
    description="Images and videos shown on the product page."
>
    <x-shopper::empty-card heading="No media yet" icon="untitledui-image" />
</x-shopper::card>

Standalone Usage

Use the section heading on its own to split a long form into parts:

<div class="space-y-6">
    <x-shopper::section-heading
        title="Customer Details"
        description="Personal information and contact details."
    />

    <div class="grid grid-cols-2 gap-4">
        <x-shopper::forms.input name="first_name" placeholder="First name" />
        <x-shopper::forms.input name="last_name" placeholder="Last name" />
    </div>

    <x-shopper::section-heading
        title="Shipping Address"
        description="Where orders will be delivered."
    />

    <div class="grid grid-cols-2 gap-4">
        <x-shopper::forms.input name="street_address" placeholder="Street address" />
        <x-shopper::forms.input name="city" placeholder="City" />
    </div>
</div>

Blade Component Source

The view is resources/views/components/section-heading.blade.php in the shopper/framework package:

@blaze

@props([
    'title',
    'description' => null,
])

<div {{ $attributes }}>
    <x-filament::section.heading class="font-heading text-sh-fg font-semibold">
        {{ $title }}
    </x-filament::section.heading>

    @if ($description)
        <x-filament::section.description class="text-sh-fg-muted mt-1 max-w-2xl text-sm">
            {{ $description }}
        </x-filament::section.description>
    @endif
</div>

Last updated on

Edit on GitHub