What's the best way to declare a bootstrap-vue button?


A_L

According to the bootstrap-vue documentation, a button is created like this:

<b-button variant="success" >Button</b-button>

But the standard bootstrap syntax also works and renders the same way:

<button type="button" class="btn btn-success">Button</button>

In my opinion the second one is better because there is no bootstrap-vue specific syntax so it will be easier to change later if needed, so, is there any reason not to use '<button class=...>' instead ' <b-button variant=...>'?

Hannah

In theory, you could just use Bootstrap (instead of bootstrap-vue) and follow the second approach you describe for all elements. I guess the advantage of this bootstrap-vueis that the elements are componentized, so you can add fewer classes to the HTML. It takes advantage of the more declarative programming style provided by Vue, where you don't need to explicitly describe the behavior you want to see - it's already abstracted into components by bootstrap-vuelibraries .

No matter what you do, I recommend following a consistent approach - eg, if you're using bootstrap-vuein a project , use Bootstrap components everywhere (like the first approach you describe).

Related


What's the best way to declare global variables in Vue.js?

Dmitry Bubnenkov: I need to access hostnamevariables in each component. Is it a good idea to put it in data? Am I understanding correctly, if I do this, will I be able to call it anywhere this.hostname? Hash Pen: Warning: The answers below are using Vue1.x. Th

What's the best way to declare global variables in Vue.js?

Dmitry Bubnenkov: I need to access hostnamevariables in each component. Is it a good idea to put it in data? Am I understanding correctly, if I do this, will I be able to call it anywhere this.hostname? Hash Pen: Warning: The answers below are using Vue1.x. Th

What's the best way to declare global variables in Vue.js?

Dmitry Bubnenkov I need to access hostnamevariables in each component. Is it a good idea to put it in data? Am I understanding correctly, if I do this, will I be able to call it anywhere this.hostname? hash pen Warning: The answers below are using Vue1.x. This

What's the best way to declare global variables in Vue.js?

Dmitry Bubnenkov: I need to access hostnamevariables in each component. Is it a good idea to put it in data? Am I understanding correctly, if I do this, will I be able to call it anywhere this.hostname? Hash Pen: Warning: The answers below are using Vue1.x. Th

What's the best way to declare a service in a function module?

Steve California It seems that the default values for services are: @Injectable( { providedIn: 'root' } ) Designed to place the service in "root"... which is a special string, in this case it refers to app.module or whatever you have named the root mo

What's the best way to declare a service in a function module?

Steve California It seems that the default values for services are: @Injectable( { providedIn: 'root' } ) Designed to place the service in "root"... which is a special string, in this case it refers to app.module or whatever you have named the root mo

What's the best way to declare a bunch of drawables (Kotlin)?

Nick Wilde I have a lot of vector icons as XML drawable resources (96 to be exact). I divided them into 8 categories. Currently I declare as follows: private val categoryA = arrayListOf(R.drawable.a1, ... R.drawable.an) private val categoryB = arrayListOf(R.dr

What's the best way to declare a service in a function module?

Steve California It seems that the default values for services are: @Injectable( { providedIn: 'root' } ) Designed to place the service in "root"... which is a special string, in this case it refers to app.module or whatever you have named the root mo

What's the best way to declare a service in a function module?

Steve California It seems that the default values for services are: @Injectable( { providedIn: 'root' } ) Designed to place the service in "root"... which is a special string, in this case it refers to app.module or whatever you have named the root mo

What's the best way to add a back button to a custom toolbar?

Azan: So I know how to add a back navigation button to my custom toolbar, however, there must be a more efficient way to add functionality to multiple activities than copying and pasting this code into each activity... Toolbar toolbar = findViewById(R.

What's the best way to vertically align an SVG with a button?

Taylor Chong How can I align these SVG images vertically to match the button I'm making vertically? <button style= "width:100px;height:100px;border-radius:50%;background-color:white;border-color:#0F75BC;"> Step 1<br> .</button> <svg height="50" viewbox="0 0 51

What's the best way to vertically align an SVG with a button?

Taylor Chong How can I align these SVG images vertically to match the button I'm making vertically? <button style= "width:100px;height:100px;border-radius:50%;background-color:white;border-color:#0F75BC;"> Step 1<br> .</button> <svg height="50" viewbox="0 0 51

What's the best way to vertically align an SVG with a button?

Taylor Chong How can I align these SVG images vertically to match the button I'm making vertically? <button style= "width:100px;height:100px;border-radius:50%;background-color:white;border-color:#0F75BC;"> Step 1<br> .</button> <svg height="50" viewbox="0 0 51

What's the best way to represent a button clicked event?

Programming_crazy This is my button. When I click it in Firefox it shows some dotted lines. But on Chrome, it doesn't show any expressions, so the user can click the "fill" button. <input type="submit" class="button" onclick="GetSentiment()" id="GetSentiment"