This package allows you to render livewire components like a blade component, giving it attributes, slots etc

Last update: Aug 13, 2022

X-livewire

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package allows you to render livewire components like a blade component, giving it attributes, slots etc.

Assuming you wanted to create a livewire component, alert, usually you would render the component by: . However, there a few problems.

  1. You can't allow slots within the component. That is, this is invalid: Alert.
  2. You can't access the $attributes bag. Thus, can't access the $attributes variable directly. That is, if you do this: , you can't access the $title attribute by $attributes->get('title'). Instead, you'd have to make $title a public property in the component. Not to mention, other methods on $attributes are not accessible. Such as ->merge([]), ->whereStartsWith(), etc.

The creator of livewire, Caleb Porzio has made it clear that adding slots, attributes etc are not currently on the roadmap.

That's why I created X-livewire.

With X-Livewire, you can do:

My alert message ">
    
        My alert message
    

And, just like with Blade, you can:

  1. Access the $attributes variable: {{ $attributes->get('title') }},
  2. Access the $slot variable: {{ $slot }}

Installation

You can install the package via composer:

composer require titonova/x-livewire

Usage

  1. After creating your livewire component, make it extend XLivewireBaseComponent rather than Component. ie: class Alert extends XLivewireBaseComponent{
  2. In the view file of the component, e.g alert.blade.php add @setUpXLivewire to the top of the file.
  3. When you want to render the component: Blade My alert message
  4. You can access the $slot and $attributes variables just like you would in a Blade component:
    {{ $slot }}
    {{ $attributes->get('title') }}
    

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

TODO/Roadmap

[ ] Add Tests [ ] Shorten tag declartion to

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

GitHub

https://github.com/titonova/x-livewire
You might also like...

A package for defining scoped styles in Livewire components

A package for defining scoped styles in Livewire components

Jun 23, 2022

Control frontend access to properties/methods in Livewire using PHP 8 attributes.

Control frontend access to properties/methods in Livewire using PHP 8 attributes.

This package adds PHP 8.0 attribute support to Livewire. In specific, the attributes are used for flagging component properties and methods as frontend-accessible.

Jul 9, 2022

Cagilo - a set of simple components for use in your views Laravel Blade.

Cagilo - a set of simple components for use in your views Laravel Blade. Official Documentation Documentation for Cagilo can be found on its we

Jul 29, 2022

Useful blade components and functionality for most Laravel projects.

laravel-base Note: Package is still in early stages of development, so functionality is subject to change. LaravelBase is a package I've created to pr

Jan 16, 2022

Custom Blade components to add sortable/drag-and-drop HTML elements in your apps.

Custom Blade components to add sortable/drag-and-drop HTML elements in your apps.

Laravel Blade Sortable Demo Repo Installation You can install the package via composer: composer require asantibanez/laravel-blade-sortable After the

Aug 1, 2022

Auto generate routes for Laravel Livewire components

livewire-auto-routes Auto generate routes for Laravel Livewire Components. Requirements Livewire 2 Laravel 8 php 8 Installation composer require tanth

May 11, 2022

Livewire DataTables components for back-end. Modular, easy to use, with tons of features.

Livewire DataTables Livewire DataTables components for back-end. Modular, easy to use, with tons of features. Inspired by Caleb's Livewire Screencasts

Jul 27, 2022

Livewire UI components with tailwind base style

Livewire UI components with tailwind base style

WireUI 📚 Documentation Wire UI is a library of components and resources to empower your Laravel and Livewire application development. Starting a new

Aug 9, 2022

Declare routes inside Laravel Livewire components.

Convoy This package allows you to declare routes inside of your full page Laravel Livewire components. All you have to do is create a route method ins

Jul 27, 2022
Related tags
Blade UI Kit is a set of renderless components to utilise in your Laravel Blade views
Blade UI Kit is a set of renderless components to utilise in your Laravel Blade views

Blade UI Kit is a set of renderless components to utilise in your Laravel Blade views. In all essence, it's a collection of useful utilities, connecting the dots between different parts of the TALL stack. It was made for Blade, Laravel's powerful templating engine.

Aug 11, 2022
Laravel-comments-livewire - Livewire components for the laravel-comments package
Laravel-comments-livewire - Livewire components for the laravel-comments package

Associate comments and reactions with Eloquent models This package contains Livewire components to be used with the spatie/laravel-comments package. S

Jan 18, 2022
Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.
Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.

TALL-stack form generator Laravel Livewire, Tailwind forms with auto-generated views. Support Contributions Features This is not an admin panel genera

Aug 5, 2022
Blade Snip allows you to use parts of a blade template multiple times. Basically partials, but inline.

Blade Snip Blade Snip allows you to use parts of a blade template multiple times. Basically partials, but inline: <div class="products"> @snip('pr

Jul 9, 2022
A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.

Laravel Moderation A simple Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc. Keep yo

Aug 15, 2022
A Pocketmine 4.0 Plugin which makes your server query = Current players + 1 Total Slots
A Pocketmine 4.0 Plugin which makes your server query = Current players + 1 Total Slots

The Better-Query Plugin This Plugin implements Better Query System **(i.e. 0/1 as player count)** the server total slots increases by 1 after a player

May 14, 2022
Emmet like Abbreviation to generate and wrap Laravel Blade Component with markup
Emmet like Abbreviation to generate and wrap Laravel Blade Component with markup

Laravel Blade Emerald Emmet like Abbreviation to generate and wrap Laravel Blade Component with markup ?? Features Generate HTML in a Blade file via p

Apr 19, 2022
Laravel package for giving admin-created accounts to users via 'set-password' email.

Invytr When making a website where users are created instead of registering themselves, you are faced with the challenge of safely giving users the ac

Jul 17, 2022
Livewire component that brings Spotlight/Alfred-like functionality to your Laravel application.
Livewire component that brings Spotlight/Alfred-like functionality to your Laravel application.

About LivewireUI Spotlight LivewireUI Spotlight is a Livewire component that provides Spotlight/Alfred-like functionality to your Laravel application.

Aug 5, 2022
Livewire component that brings Spotlight/Alfred-like functionality to your Laravel application.
Livewire component that brings Spotlight/Alfred-like functionality to your Laravel application.

About Wire Elements Spotlight Wire Elements Spotlight is a Livewire component that provides Spotlight/Alfred-like functionality to your Laravel applic

Aug 5, 2022