Laravel - Blade Templates - Data Properties Attributes

Since anonymous components do not have any associated class, you may wonder how you may differentiate which data should be passed to the component as variables and which attributes should be placed in the component's attribute bag.

You may specify which attributes should be considered data variables using the @props directive at the top of your component's Blade template. All other attributes on the component will be available via the component's attribute bag. If you wish to give a data variable a default value, you may specify the variable's name as the array key and the default value as the array value:

    @props(['type' => 'info', 'message'])
merge(['class' => 'alert alert-'.$type]) }}> {{ $message }}

Given the component definition above, we may render the component like so: