help text in attribute
vwasteels opened this issue · comments
Hi,
I was wondering if it could be possible to pass help text
directly through an attribute like any other parameters ?
something like this :
<x-form-input
name="name"
label="Name"
help="Your name will not be visible"
/>
Thanks !!
Yes you can do that! First you need to publish the Blade views, and then you can use the $attributes
variable to access the help text.
https://github.com/protonemedia/laravel-form-components#customize-the-blade-views
For example, resources/views/vendor/form-components/tailwind-2/form-input.blade.php
:
<div class="@if($type === 'hidden') hidden @else mt-4 @endif">
<label class="block">
...
</label>
@isset($attributes['help'])
<p class="mt-4 text-orange-500">{{ $attributes['help'] }}</p>
@endisset
...
</div>
ok thanks !
in the mean time I made a pull request : #30
I've closed the PR as you can do this without modifying the package (see PR).