Skip to content
Go back

Why My Flux UI Checkbox Didn't Work (And When to Use Native HTML Instead)

The “Remember Me” checkbox on my login page wasn’t working. Users could see it, but it appeared disabled — clicking did nothing. Even if it could be checked, the value was never being sent to the server.

I asked:

“‘remember me’ checkbox on the login screen doesn’t seem to work or do anything. how should this function? what is the standard way of doing this in laravel?”

The answer revealed a fundamental gotcha about Flux UI components that anyone mixing Flux with traditional Laravel forms needs to know.

Table of contents

Open Table of contents

The problem

My login page used a Flux UI checkbox:

<flux:checkbox label="Remember me" name="remember" />

This looks correct. It has a name attribute. It has a label. It renders a checkbox on the page. But the value never reaches the server.

Why it doesn’t work

Flux UI’s <flux:checkbox> doesn’t render a native <input type="checkbox">. It renders a custom web component called <ui-checkbox>. Custom web components do not participate in native HTML form submission.

This matters because of how the login page works. Laravel’s login (handled by Fortify) uses a traditional <form> POST — not a Livewire component. When the form submits, the browser collects values from native form elements (<input>, <select>, <textarea>) and sends them as POST data. Custom web components like <ui-checkbox> are invisible to this process.

The Flux checkbox is designed exclusively for Livewire, where wire:model handles the data binding through JavaScript rather than form submission. If your page uses Livewire, <flux:checkbox wire:model="remember" /> works perfectly. But on a traditional form page, it silently does nothing.

The fix

Replace the Flux checkbox with a native HTML checkbox:

<!-- Before: Flux checkbox — never submits in a traditional form -->
<flux:checkbox label="Remember me" name="remember" />

<!-- After: native HTML checkbox — works in any form -->
<label class="flex items-center gap-2">
    <input type="checkbox" name="remember"
      class="size-4 rounded border-gray-300
             text-zinc-800 shadow-xs
             focus:ring-zinc-500" />
    <flux:text class="text-sm">Remember me</flux:text>
</label>

The native <input type="checkbox"> participates in form submission. The <flux:text> component is kept for the label to maintain typography consistency with the rest of the page.

When to use Flux components vs native HTML

This is the key lesson. It’s not that Flux components are broken — they’re designed for a specific context.

ScenarioUseWhy
Livewire component with wire:model<flux:checkbox>Data binding handled by Livewire, not form submission
Traditional <form> POSTNative <input type="checkbox">Browser needs native elements to include in POST data
Livewire form with wire:submit<flux:checkbox>Livewire handles submission
Form submitted to a Laravel controllerNative <input>Controller expects POST data from native elements

The same rule applies to other Flux form components. If you’re on a page that uses a traditional <form> with action and method="POST", check whether your Flux components are actually submitting their values. The safest test: submit the form and check the request data on the server side.

How “Remember Me” actually works in Laravel

With the checkbox fixed, here’s what happens when a user checks it:

  1. The form sends remember=on in the POST data
  2. Laravel’s Auth::attempt($credentials, $remember) receives true for the second argument
  3. Laravel stores a remember_token in the users database table
  4. A long-lived cookie is set in the browser
  5. When the session expires, the cookie keeps the user logged in

Without “Remember Me”, users are logged out when their session expires (controlled by SESSION_LIFETIME in your .env). With it, they stay logged in across browser restarts.

One thing to note: if your SESSION_LIFETIME is already long (say 120 minutes) and SESSION_EXPIRE_ON_CLOSE is false, users stay logged in for a long time regardless. The “Remember Me” checkbox becomes more meaningful when you set SESSION_EXPIRE_ON_CLOSE=true — then sessions end when the browser closes, and only users who checked the box persist.

How to spot this issue

The frustrating thing about this bug is that it fails silently. The checkbox renders, it looks right, and the form submits without errors. The only symptom is that the feature doesn’t work — which you might not notice for weeks.

If you’re mixing Flux UI components with traditional forms, check for these signs:

The fix is always the same: use native HTML form elements for traditional form submission, and Flux components for Livewire pages.

Key takeaway

Flux UI components are built for Livewire. They render custom web components that don’t participate in native HTML form submission. If your page uses a traditional <form> POST (like Laravel Fortify’s login), Flux checkboxes, selects, and other form inputs will silently fail to submit their values. Use native HTML elements instead, and save Flux components for Livewire pages where wire:model handles the data binding.


Back to top ↑