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

q-btn stack prop weird behavior on undefined #16494

Closed
Dtsiantaris opened this issue Oct 21, 2023 · 1 comment
Closed

q-btn stack prop weird behavior on undefined #16494

Dtsiantaris opened this issue Oct 21, 2023 · 1 comment
Labels
area/components bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite kind/bug 🐞 Qv2 🔝 Quasar v2 issues

Comments

@Dtsiantaris
Copy link

Dtsiantaris commented Oct 21, 2023

What happened?

Created a CustomButton wrapping q-btn and run into a minor styling issue that i thought it was unintentional. So basically i had a condition for the stack prop.

 <q-btn
    class="relative"
    color="primary"
    unelevated
    :stack="customStack"

Where customStack was defined like any custom-like boolean prop would:

defineProps({
     customStack: {
          type: Boolean,
          default: undefined
},
  • Actual behavior:

When the condition is met the button stacks vertically, but when not provided, margin between the icon and the label are removed.
image

  • stack is undefined

What did you expect to happen?

  • Expected behavior:

The q-btn label with its icon would conditionally stack vertically.
image

  • left btn: stack is true
  • right btn: stack is false

Documentation clearly states that stack is of type Boolean and not Boolean | undefined, but i believed this was maybe unintentional?
image

Reproduction URL

https://codepen.io/dtsiantaris/pen/VwgwwNv

How to reproduce?

  • Go to provided codepen link. 3 buttons are already set up.

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Components (quasar)

Platforms/Browsers

Firefox, Chrome, Microsoft Edge

Quasar info output

No response

Relevant log output

No response

Additional context

I know that the fix is as simple as this:

  defineProps({
       customStack: {
            type: Boolean,
            default: false
  },

But i say again, i believe this was unintentional from the Quasar team.

@rstoenescu
Copy link
Member

The default for a Boolean prop should be false, not undefined.
Regardless, enhancement will be available on Quasar v2.14.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/components bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

2 participants