Skip to content

Toggle Button

BsToggleButton is a group of buttons with toggle capability. It is primarily used to visualize options with different approaches, such as selecting options, switching views, or sorting elements.

Overview

BsToggleButton component shares the same style variants as BsButton. And if you like Google Material Design 3 - Segmented Button style, you can choose a style variant that meet the Material Design 3 - Segmented Button specifications.

BsToggleButton component is like HTML5 <input> element. This means that you can add attributes like readonly, or disabled and it will react to them to give the best experience. You can also use v-model directive to create two-way data bindings on the model-value property. This is useful to control or maintain the model-value property.

Updated on v2.0.0
What are you drinking?

IMPORTANT

  • The <bs-button-toggle> tag still works, but has been deprecated since v2.0.0.
  • Never assign a datasource to multiple <bs-toggle-button>. It may cause a bug or duplicate ID attribute.

TIP

Any MDBootstrap Color variants and Material Color variants can be applied to the color property.

Checked Icon

With the help of slot icon you can add dynamic checked icon.

Added since v2.0.1

Multiple Selection

BsToggleButton also support multiple selection mode. Use and define the multiple property explicitly to enable multiple selection mode.

Style Variants

You can style the <bs-toggle-button> component to your own preference or use a style variant based on Google Material Design 3 specifications. Example below show various built-in style variants and demonstrate how to put an icon inside the <bs-toggle-button> and change the icon dynamically like a segmented buttons behaves.

Updated on v2.0.1
How is the weather today?

Combination

How is the weather today?

INFO

Since Vue MDBootstrap v2.1.0, Google Material Icons are replaced with Google Material Symbols.

Usage Example

The following is an example that demonstrate more advanced use of the <bs-toggle-button>.

21st Century Strangers
68 MB
New Name
72 MB
Not Me
58 MB
Mutter
68 MB
True Love
68 MB

CSS Variables

The component css variables inherited from BsButton css variables.

Added since v2.0.0

API Reference

TInputOptionItem

The Input item has properties as described below:

PropertyTypeDescription
value requiredString/Number/BooleanThe item value.
label requiredStringThe item label.
idStringHtml <input> element ID.
nameStringHtml <input> element name. It is used when multiple is true.
disabledBooleanHtml <input> element state.
readonlyBooleanHtml <input> element state.
iconString
The icon to display inside the button. Updated on v2.1.0

Use any valid android icon name from Google Material Symbols with or without a suffix. Valid suffixes are: _outlined, _rounded, _sharp, _filled, _outlined_filled, _rounded_filled, and _sharp_filled.

Suffix will take precedence over iconVariant property.
iconFlipStringFlip the icon. Valid values are: horizontal, vertical, both.
iconPulseBooleanApply pulse animation to the icon.
iconSizeNumberRender the icon at predefined size in pixel.
iconSpinBooleanApply spin animation to the icon.
iconRotationNumberRotate the icon. Valid values are: 90, 180, 270.
iconVariantStringUse predefined icon style variant. Valid values are: outlined, rounded, sharp, filled, outlined_filled, rounded_filled, and sharp_filled. v2.1.0

Released under the BSD-3-Clause License.