Skip to content

Cannot use custom tag with button component #1644

Open
@michelheusschen

Description

@michelheusschen

Describe the bug

The button component always renders the <button> element instead of a custom tag. This also impacts other components like CheckboxButton and RadioButton, because they internally use <Button tag="label">

As a workaround I'm currently using <Button href={null} tag="label">

Reproduction

<Button tag="label">Test</Button>
Expected: <label>Test</label>
Result:   <button>Test</button>

<CheckboxButton>Test</CheckboxButton>
Expected: <label><input />Test</label>
Result:   <button><input />Test</button> 

Version and System Info

System:
    OS: Linux 6.6 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 5700X 8-Core Processor
    Memory: 7.57 GB / 11.68 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.13.1 - ~/.local/share/pnpm/node
    npm: 10.9.2 - ~/.local/share/pnpm/npm
    pnpm: 10.3.0 - ~/.local/share/pnpm/pnpm
    bun: 1.2.7 - ~/.bun/bin/bun
  npmPackages:
    @sveltejs/kit: ^2.16.0 => 2.22.0 
    flowbite-svelte: ^1.7.1 => 1.7.1 
    svelte: ^5.34.3 => 5.34.3 
    vite: ^6.2.6 => 6.3.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions