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.

b-form-group feature to add asterisk to labels

See original GitHub issue

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

A for now <b-form-group label="title"> takes label as string, I would like to add * after the label.

Describe the solution you’d like

Something like this: <b-form-group :label=" 'Customer Name <span>*</span>' " > So the span could be styled like making the * red color.

Describe alternatives you’ve considered

So far I could achieve what I want with giving the group a class like required, and work my way down like:

.form-group.required > label:after {
    content: " *";
    color: red;
}

Issue Analytics

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

github_iconTop GitHub Comments

14reactions
tmorehousecommented, Oct 9, 2019

Oops… had a typo in the example. It should be:

<b-form-group label-for="input-customer-name" >
  <template v-slot:label>
    Customer Name <span class="text-danger">*</span>
  </template>
  <b-form-input id="input-customer-name"></b-form-input>
</b-form-group>
7reactions
tmorehousecommented, Oct 9, 2019

You can use the label slot to place HTML (or component) markup in the label (which is why the slot is provided):

<b-form-group label-for="input-customer-name" >
  <template v-slot="label">
    Customer Name <span class="text-danger">*</span>
  </template>
  <b-form-input id="input-customer-name"></b-form-input>
</b-form-group>

See https://bootstrap-vue.js.org/docs/components/form-group#comp-ref-b-form-group-slots

Read more comments on GitHub >

github_iconTop Results From Across the Web

Indicating form controls as required using asterisks (*) - ADG
It is a common technique to add an asterisk * to a form control's label. Then, somewhere else on the page, for example...
Read more >
Form Group | Components - BootstrapVue
Easily add some structure to forms. Its purpose is to pair form controls with a legend or label, and to provide help text...
Read more >
Use CSS to automatically add 'required field' asterisk to form ...
Here is a simple "CSS only" trick I created and am using to dynamically add a red asterisk on the labels of required...
Read more >
bootstrap vue b-form-group show red asterisk - Helptipsweb
https://github.com/bootstrap-vue/bootstrap-vue/issues/4231#issuecomment-540036573.
Read more >
Show Asterisk By Labels for Required Fields on the form.
I would like to display red asterisk after field label. Is there a built in function for this in ASP.NET MVC 5 using...
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