QSelect label-slot issue



  • Hi,

    I would want to handle q-select label display according to a variable :

    <q-select :label-slot="showLabel" label="My label" ... />
    

    Unfortunately, :label-slot=“false” will display the label anyway 😕
    Note that the opposite is working, i.e :label-slot=“true” without label (even if I don’t really see its interest…).

    I’ve also tried :label=“showLabel ? ‘My label’ : null”, but I still have a blank label.
    The only way not to have a label is to not set the label attribute at all.

    Thanks for your help !



  • Not sure what is it you are trying to do. But maybe this? https://codepen.io/smolinari/pen/rNemXoB?editors=1010

    Scott



  • Thanks for your reply.
    However, in your example, the label is hidden but its slot is still here (blank space on top).

    I’ve found a way to do what I want :

    <q-select :label-slot=“showLabel” … >
    <template v-slot:label>
    My label
    </template>
    </q-select>

    Regards.



  • Yeah. The label-slot prop basically just means you want to put your own content into the label slot.

    Scott


Log in to reply