protonemedia / laravel-form-components

A set of Blade components to rapidly build forms with Tailwind CSS (v1.0 and v2.0) and Bootstrap 4/5. Supports validation, model binding, default values, translations, Laravel Livewire, includes default vendor styling and fully customizable!

Home Page:https://protone.media/blog/laravel-form-components-to-rapidly-build-forms-with-tailwind-css-and-bootstrap-4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass class to child component

temosis opened this issue · comments

Is there any way to pass class to the label inside <x-form-input>

You should publish the Blade views and then you could use the $attributes variable inside the form-input view. You don't have to touch the form-label view.

Try this in your form:

<x-form-input label-class="text-xl">

And then modify the form-input view so it passes the label-class attribute to the form-label component:

<x-form-label :label="$label" :class="$attributes['label-class'] ?? null" />

That works as intended. I guess i miss understood how component data is shared.