Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Wireuse Laravel Package

foxws/wireuse

View on GitHub
Deep Wiki
Context7

title: Laravel HTML (Spatie) order: 7 tags:

  • html
  • blade
  • views

Introduction

The laravel-html package of Spatie helps you generate HTML using a simple and readable API.

WireUse offers mixins to make the package compatible and usable with Livewire.

Configuration

HTML-mixins are disabled by default, and can be enabled in config/wireuse.php:

php artisan vendor:publish --tag="wireuse-config"
'html' => [
    'mixins' => true,
],

Usage

The following example shows how to use the wireKey helper to generate a list of posts, e.g. posts.blade.php:

{{ html()->div()->class('grid grid-cols-1 gap-3')->open() }}
    [@foreach](https://github.com/foreach) ($this->posts as $post)
        {{ html()->div()->wireKey($post->getRouteKey())->open() }}
            <livewire:app::post-item :$post :key="$post->getRouteKey()" />
        {{ html()->div()->close() }}
    [@endforeach](https://github.com/endforeach)
{{ html()->div()->close() }}

The following example shows how to use the wireForm helper to generate a form, e.g. edit.blade.php:

{{ html()->wireForm($form, action: 'submit')->class('flex flex-col gap-y-6')->children([
    html()->div()
        ->classIf(flash()->message, 'form-message')
        ->textIf(flash()->message, flash()->message),

    html()->div()->class('form-control')->children([
        html()->label('Name', 'form.name')->class('label'),
        html()->text()->wireModel('form.name')->placeholder('Name')->class('input'),
        html()->validate('form.name'),
    ]),
]) }}

To generate a link that includes the wire:navigate attribute:

{{ html()->a()->link('home)->text('Home') }}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope