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.

form-group label size to huge

See original GitHub issue

Applying “bg-light” as “label-class” property of “form-group” component results in a background which exceeds the outer html form. We try to create a form with a full-size label-column background color.

I first thinked about a bug of bootstrap and created a ticket. They responded that this is intended result of “form-row” and “col*” usage: A background should be applied to the inner element.

In bootstap-vue this can only be done with “label” slot, but not a “label” property. When using the slot the element will require additional styling because of the classes of the legend element: bootstrap-vue adds both “col*” and “col-form-label”

I think for correct sizeing a form-group:

<b-form-group 
	label="label" 
	description="description"
	valid-feedback="success"
	invalid-feedback="error"
	label-class="bg-light"
>
	Content
</b-form-group>

Should generate something like the following html:

<fieldset class="form-group">
	<!-- form-row automatically adds negative left and right margins  -->
	<div class="form-row">
		<!-- container required to only apply bootstraps size and padding information ("col*") which corrects the margin of form-row -->
		<div class="col">
			<!-- container required to support full size backgrounds -->
			<div class="bg-light">
				<!-- legend which applies the label behaviors -->
				<legend class="col-form-label">label</legend>
			<div>
		<div>
		<div class="col">
			Content
			<div class="invalid-feedback">error</div>
			<div class="valid-feedback">success</div>
			<small class="form-text text-muted">description</small>
		</div>
	</div>
</fieldset>

This seems to be a little awkward. Maybe someone has an alternative?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
trueleadercommented, Aug 20, 2019

Ah, thx: adding of “pt-0 pb-0” to remove the padding, instead of creating a new selector with margins to negate the same effect, seems to be a much cleaner way

0reactions
tmorehousecommented, Aug 19, 2019

You could try adding prop label-class="mb-0 mt-0" which removes the label’s top and bottom margin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How could I make labels appear as "large size" when inline ...
According to the Bootstrap documentation: Quickly size labels and form controls within .form-horizontal by adding .form-group-lg or .form-group- ...
Read more >
Bootstrap 4 forms label size (Interactive Example)
Edit and preview HTML code with this online HTML viewer. Bootstrap 4 forms label size.
Read more >
Forms · Bootstrap v4.6
The .form-group class is the easiest way to add some structure to forms. It provides a flexible class that encourages proper grouping of...
Read more >
Input - BigDesign - BigCommerce Dev Center
Use labels to help users understand what information to enter. Size input containers to their expected content.
Read more >
InputGroup - React-Bootstrap
Remember to place <label> s outside the input group. @. @example.com ... Text id="inputGroup-sizing-lg">Large</InputGroup.Text>. <Form.Control.
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