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

Laravel Blade X Laravel Package

spatie/laravel-blade-x

Blade-X brings Blade-style HTML components to Laravel 6 and below, letting you use tags like instead of @include. Package is abandoned because Laravel 7+ has native Blade components; migrate when upgrading.

View on GitHub
Deep Wiki
Context7

title: Using variables weight: 2

When using a BladeX component all attributes will be passed as variables to the underlying Blade view.

{{-- the `myAlert` view will receive a variable named `type` with a value of `error` --}}

<my-alert type="error">

If you want to pass on a PHP variable or something that needs to be evaluated you must prefix the attribute name with :.

{{-- the `myAlert` view will receive the contents of `$message` --}}
<my-alert type="error" :message="$message">

{{-- the `myAlert` view will receive the uppercased contents of `$message` --}}
<my-alert type="error" :message="strtoupper($message)">

Spread operator for attributes

Passing an array of component attributes to a BladeX component can be achieved using the spread operator:

<text-input ...$input />

Combining multiple destructured arrays and normal attributes is supported too! Normal attributes will override attributes in the spreaded attributes array.

<text-field
    label="E-Mail"
    ...$input
    ...$email
    :var="$foo"
/>

Boolean attributes

Boolean attributes (attributes without a value), e.g. <checkbox checked /> will be passed to the component as variables evaluating to true.

{{-- the `checkboxInput` view will receive a `$checked` variable that evaluates as true --}}
<checkbox-input checked />
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony