question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to allow label to be positioned on the left of checkboxes and radios

See original GitHub issue

Is your feature request related to a problem? Please describe…

There are certain cases with checkboxes/radios where a left-aligned label is useful. For example, when dealing with switches that are right aligned to a card.

image

Describe the solution you’d like

Add a label-position prop to <b-form-checkbox>, <b-form-checkbox-group>, <b-form-radio>, <b-form-radio-group>. This prop could be set to left or right but defaults to right. This would do exactly what it says and render the label to either the left or right hand side of the checkbox/radio.

Describe alternatives you’ve considered

We might be able to get away with a flexbox order css trick if the checkbox and label lived inside a flex container.

This can be done manually in HTML but requires abandoning most of the work that the Bootstrap Vue components are doing.

Additionally, the prop could just be a boolean called label-position-opposite or something. This would be potentially beneficial for localization reasons with right-to-left languages. However, this would require considerable awareness from the bootstrap library to make this seamless to toggle between different localizations.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
tmorehousecommented, Feb 12, 2020

An alternative is to do this:

<div class="d-flex">
  <h4 class="mb-0">LIABILITIES</h4>
  <label for="switch_1" class="ml-auto mb-0">Itemize</label>
  <b-form-checkbox id="switch_1" v-model="itemize" switch class="ml-2 mr-n2"></b-form-checkbox>
</div>

image

See working fiddle here: https://jsfiddle.net/8od9zucb/

1reaction
tmorehousecommented, May 6, 2020

Bootstrap v5 will be changing how the “custom” checks and radios are rendered (using custom styles on the input rather than the label).

Closing as this should be available in bootstrap v5 when released (BootstrapVue v3.x)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should checkbox labels be to the right or the left?
So the answer seems to be to put them on the left side. On the other hand, you need to consider consistency within...
Read more >
Should checkbox labels be to the right or the left? - UX Pickle
Generally, the label is placed to the right of the control by the designer. What you're sensing is most likely the rationale.
Read more >
How to Align a Checkbox and Its Label Consistently Cross ...
Checkbox is one of HTML forms that is used on every website. This tutorial will show how to align checkboxes and their labels...
Read more >
How to align checkboxes and their labels consistently cross ...
Put each checkbox and label within an <li> element. Add overflow:hidden to the <li> and float the label and checkbox left. Then they...
Read more >
Align radio button or checkbox labels to left and next to each ...
With radio buttons (or checkboxes for that matter), if the text of the option goes beyond a given length it wraps to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found