Vuetify: [Feature Request] Prepend label for switch

Created on 24 May 2019  路  5Comments  路  Source: vuetifyjs/vuetify

Problem to solve

It would be possible to have the text on the left side and the switch itself on the right side

Proposed solution

My suggestion would be to add a prepend-label property so you could decide to have the switch element the default way

switch - label

or

label - switch

Selection controls enhancement feature has workaround

Most helpful comment

This isn't too painful to work around in CSS with the current component, since flexbox can swap the order of the elements. I put together a basic proof-of-concept using the standard label slot with a new class applied to the v-switch and it works fine for my uses.

https://codepen.io/alanaktion/pen/OJPQKdx

It would be nice to see this included in Vuetify natively, especially since most of the switch examples in the Material documentation use this reversed layout.

All 5 comments

That could apply also for radio and checkbox, and probably better prop name would be "reverse" to be in line with other components

It's not aligned properly, doesn't have pointer cursor, doesn't toggle value on click and feels like misuse of slots

https://codepen.io/anon/pen/byvoWz

anything new about it ?

This isn't too painful to work around in CSS with the current component, since flexbox can swap the order of the elements. I put together a basic proof-of-concept using the standard label slot with a new class applied to the v-switch and it works fine for my uses.

https://codepen.io/alanaktion/pen/OJPQKdx

It would be nice to see this included in Vuetify natively, especially since most of the switch examples in the Material documentation use this reversed layout.

Was this page helpful?
0 / 5 - 0 ratings