- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.7k
Open
Description
Describe the bug
The following checkbox binding
<input {...edit_customer.fields.active.as('checkbox')} bind:checked={customer.active}>errors with
[plugin:vite-plugin-svelte:compile] src/routes/+page.svelte:25:15 `bind:checked` can only be used with `<input type="checkbox">`
https://svelte.dev/e/bind_invalid_target
if I add type="checkbox":
<input type="checkbox" {...edit_customer.fields.active.as('checkbox')} bind:checked={customer.active}>
I get a warning
'type' is specified more than once, so this usage will be overwritten.js(2783)
Reproduction
https://github.com/thebjorn/checkbox-bug
Logs
Without `type="checkbox"`:
:05:24 PM [vite] (ssr) Error when evaluating SSR module /src/routes/+page.svelte: src/routes/+page.svelte:26:15 `bind:checked` can only be used with `<input type="checkbox">`
https://svelte.dev/e/bind_invalid_target
  Plugin: vite-plugin-svelte:compile
  File: src/routes/+page.svelte:26:15
   24 |      <input
   25 |                 {...edit_customer.fields.active.as('checkbox')}
   26 |                 bind:checked={customer.active}>
                                                      ^
   27 |          Active
   28 |    </label>
[500] GET /
with `type="checkbox"` (vscode):
'type' is specified more than once, so this usage will be overwritten.js(2783)System Info
System:
    OS: Windows 11 10.0.26200
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 39.98 GB / 63.92 GB
  Binaries:
    Node: 24.10.0 - C:\nvm4w\nodejs\node.EXE
    npm: 10.9.2 - C:\Users\bp.DATAKORTET\AppData\Roaming\npm\npm.CMD
    pnpm: 10.11.0 - C:\Users\bp.DATAKORTET\AppData\Local\Microsoft\WinGet\Links\pnpm.EXE
  Browsers:
    Chrome: 141.0.7390.108
    Edge: Chromium (141.0.3537.85)
    Firefox Developer Edition: 145.0 - C:\Program Files\Firefox Developer Edition\firefox.exe
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    svelte: ^5.41.1 => 5.41.1Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels