generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 4
Checkboxes
Ned Zimmerman edited this page Mar 24, 2022
·
5 revisions
The Checkboxes component is used to create a group of related checkbox inputs with an optional hint and validation status reflected using aria-invalid
. It must be used in a fieldset
in combination with related Hint and Error components.
The following example shows a group of checkboxes which indicates a user's preferred communication method and which has a hint as well as validation error support with a named message bag.
<fieldset class="field @error('communication_methods', 'updateProfileInformation') field--error @enderror">
<legend>{{ __('Preferred communication methods') }}</legend>
<x-hearth-checkboxes name="communication_methods" :options="['email' => __('Email'), 'phone' => __('Phone')]" :checked="old('communication_methods', $user->communication_methods) ?? false" hinted bag="updateProfileInformation" />
<x-hearth-hint for="communication_methods">{{ __('If we need to contact you, we will use the methods you indicate here.') }}</x-hearth-hint>
<x-hearth-error for="communication_methods" bag="updateProfileInformation" />
</fieldset>