bootstrap-touchspin icon indicating copy to clipboard operation
bootstrap-touchspin copied to clipboard

Custom button, how to change text

Open lingtalfi opened this issue 5 years ago • 5 comments

Hi, I am trying to the custom vertical buttons example with font-awesome icons, but I face multiple problems:

  • first: since I want to replace the plus/minus text with icons, I need to remove the plus/minus text (because they get in the way, showing next to the icon: this is not what I want: I want just the icon, not the text). But I didn't find an option to do so.

  • second: is is possible to tell bootstrap-touchspin to use an i tag instead of the button tag

  • third: in the same order of idea, it would be nice if I could choose the bootstrap class applied to the vertical buttons (by default it's btn btn-primary, but what if I want to change this to btn btn-danger for instance...)

lingtalfi avatar Jun 04 '19 07:06 lingtalfi

@lingtalfi

About the custom plus/minus text to be replaced with icons: Here are some ideas from my project...you can use CSS to achieve that.

  .bootstrap-touchspin-down, .bootstrap-touchspin-up {
   visibility: hidden;
  }

  .bootstrap-touchspin-down:before {
   visibility: visible;
   content: "\f063";
   font-family: FontAwesome;
   font-style: normal;
   font-weight: normal;
   text-decoration: inherit;
   /*--adjust as necessary--*/
   color: #000;
   font-size: 16px;
   padding-right: 5px;
   position: absolute;
   top: 10px;
   left: 0;
  }

  .bootstrap-touchspin-up:before {
   visibility: visible;
   content: "\f062";
   font-family: FontAwesome;
   font-style: normal;
   font-weight: normal;
   text-decoration: inherit;
   /*--adjust as necessary--*/
   color: #000;
   font-size: 16px;
   padding-left: 5px;
   position: absolute;
   top: 10px;
   left: 0;

I hope you will find this useful.

andresayej avatar Sep 10 '19 14:09 andresayej

Thanks.

lingtalfi avatar Sep 10 '19 17:09 lingtalfi

You can also use the option buttondown_txt and buttonup_txt to change the button text:

buttondown_txt: '<i class="fa fa-minus"></i>'
buttonup_txt:   '<i class="fa fa-plus"></i>'

diesl avatar Sep 16 '19 16:09 diesl

@diesl in bootstrap 4 it is not working

bharatribadiya avatar Sep 18 '19 09:09 bharatribadiya

buttondown_class: 'btn btn-outline-light', buttonup_class: 'btn btn-outline-light', verticalbuttons: true, verticalup: '<i class="mdi mdi-chevron-up m-0"></i>', verticaldown: '<i class="mdi mdi-chevron-down m-0"></i>'

for me its working

bharatribadiya avatar Sep 18 '19 09:09 bharatribadiya

This should work by tweaking the options. Feel free to reopen if there seems to be a bug, but please provide an example then.

istvan-ujjmeszaros avatar Apr 04 '23 11:04 istvan-ujjmeszaros