Guides
Navigation
Feedback
Overlays
Layout
Data Display
Forms
.md

Forms

switch

Toggle switch built on a native checkbox, submits with the form.

Installation

php artisan ui:add switch

Usage

<x-ui.switch name="notifications" :checked="true" />

{{-- value is what gets submitted when the switch is on (default "1") --}}
<x-ui.switch name="plan" value="annual" />

Pure CSS over a native checkbox, no JavaScript at all. Pass `name` to submit its state in a form.

Props

Every prop with its default. Pass any of them as attributes, using : to bind a PHP value.

@props([
    'name' => null,
    'checked' => false,
    'value' => '1',
])