Skip to content

Utility Components

Structural and utility components for layouts

These components provide structural and utility functionality. They don't require visual previews as they are primarily wrappers or functional elements.

Container

Page content wrapper with responsive horizontal padding.

<x-shopper::container>
    <!-- Page content -->
</x-shopper::container>

Source:

@blaze

<div {{ $attributes->twMerge(['class' => 'px-4 lg:px-6']) }}>
    {{ $slot }}
</div>

Internal navigation link with Livewire wire:navigate.hover for SPA-like navigation.

<x-shopper::link href="{{ route('shopper.products.index') }}">
    Products
</x-shopper::link>

Source:

@blaze

<a {{ $attributes }} wire:navigate.hover>
    {{ $slot }}
</a>

Separator

Visual divider between content sections.

<x-shopper::separator />

Source:

@blaze(fold: true)

<div class="sh-separator py-8 lg:py-10">
    <div class="border-t border-gray-200 dark:border-white/20"></div>
</div>

Navigation breadcrumb with mobile back link support.

<x-shopper::breadcrumb :back="route('shopper.products.index')" current="iPhone 15">
    <x-shopper::breadcrumb.link
        :link="route('shopper.products.index')"
        :title="__('Products')"
    />
</x-shopper::breadcrumb>

Props

PropDefaultDescription
x-shopper::breadcrumbrenders a <div> element
back
string
required

URL for mobile back link

current
string
null

Current page title

The link prop sets the URL and the title prop sets the text:

<x-shopper::breadcrumb.link
    :link="route('shopper.categories.index')"
    :title="__('Categories')"
/>

Validation Errors

Displays Laravel validation errors in a styled error box.

<x-shopper::validation-errors />

Automatically displays all validation errors from $errors->all().

Source:

@if ($errors->count() > 0)
    <div class="bg-danger-50 my-2 rounded-lg p-4">
        <div class="flex">
            <div class="shrink-0">
                <svg class="text-danger-400 size-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
                    <path
                        fill-rule="evenodd"
                        d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
                        clip-rule="evenodd"
                    />
                </svg>
            </div>
            <div class="ml-3">
                <h3 class="text-danger-800 text-sm leading-5 font-medium">
                    {{ __('shopper::forms.error') }}
                </h3>
                <div class="text-danger-700 mt-2 text-sm leading-5">
                    <ul class="list-disc space-y-1 pl-5">
                        @foreach ($errors->all() as $message)
                            <li>{{ $message }}</li>
                        @endforeach
                    </ul>
                </div>
            </div>
        </div>
    </div>
@endif

Menu item for dropdown menus.

<x-shopper::dropdown-link :href="route('shopper.profile')">
    Profile
</x-shopper::dropdown-link>

Form Slide-over

Wrapper for forms displayed in slide-over panels. Use it in the view of a slide-over component:

<x-shopper::form-slider-over
    action="save"
    title="Edit Supplier"
    description="Update the supplier contact details."
>
    {{ $this->form }}
</x-shopper::form-slider-over>

Props

PropDefaultDescription
x-shopper::form-slider-overbuilt on the <x-shopper::slideover-card> component
action
string
required

Livewire method to call on submit

title
string
required

Slide-over header title

description
string
null

Text below the title

Slots

SlotDefaultDescription
x-shopper::form-slider-overbuilt on the <x-shopper::slideover-card> component
default-

Form content

The footer always shows a Cancel button, which dispatches closePanel, and a Save button that submits the form.

Last updated on

Edit on GitHub