Skip to content

Checkbox

tanthammar edited this page Nov 18, 2020 · 6 revisions

Checkbox

Extends BaseField

Additional methods

->placeholder(string $placeholder)

The placeholder attribute becomes the checkbox label

Example

Checkbox::make('Checkbox') //cast to boolean on model
    ->placeholder('The checkbox label')
    ->rules('boolean')
    ->default(1); //equivalent to checked

Blade component

<x-tall-checkbox
    :field="$field"
/>

Styling

Extend Blade component (or override in config file)

Tanthammar\TallForms\Components\Checkbox::class

Theme

    /* Checkbox */
    /* If you want to change the color, see tailwind custom form documentation */
    .tf-checkbox {
        @apply mt-1;
    }
    .tf-checkbox-label {
        @apply text-sm text-gray-900;
    }
    .tf-checkbox-label-spacing {
        @apply ml-2 block;
    }
Clone this wiki locally