Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix button-or-div to allow button type to be changed #1168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joshhanley
Copy link
Member

@joshhanley joshhanley commented Feb 23, 2025

The scenario

Currently if you want to use a badge as a submit button, the button's type is set to button even if you pass in type="submit".

<flux:badge color="cyan" as="button" type="submit">Submit button</flux:badge>

The problem

The badge component is wrapped in the button-or-div component and the attributes are being correctly forwarded to it.

But it turns out that the type on the button in the button-or-div component is hard coded, so can't be overridden with attributes.

<button type="button" {{ $attributes }}>

The solution

Change button-or-div button so that the type can be merged in through attributes.

<button {{ $attributes->merge(['type' => 'button']) }}>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant