Button Toggle #
The button is used to switch between different values.
Examples #
Basic usage #
By default, an object with parameters and a v-model is to be passed.
Colors #
Applies color presets and HEX colors.
Toggle color #
Use toggle-color prop to set the color of the active button.
Gradient #
Applies gradient style to background.
Sizes #
You can provide size presets to the component.
Presets and styles #
You can use the same preset's (default, primary, secondary, plain, plainOpacity) and styles (round, outline via borderColor property) as in va-button.
Disabled #
The component can be disabled via disabled prop.
Icons #
You can set icon instead (or in addition) of label for buttons via options props (icon and iconRight attributes).
API #
Props #
| Name | Description | Types | Default |
|---|---|---|---|
| activeButtonTextColor | The color of the button text with the selected value |
| - |
| activeClass | Applied when the link is active. More info here. |
| - |
| append | When set, always appends the relative path to the current path. More info here. |
| - |
| autofocus |
|
| |
| backgroundOpacity | Sets up button background opacity. |
|
|
| borderColor | Color CSS style |
|
|
| color | Color of the component (theme string or |
|
|
| disabled | Applies |
|
|
| disabledBy | Specify the key in the object to be used as item |
|
|
| exact | Exactly match the link. Without this, '/' will match every route. More info here. |
| - |
| exactActiveClass | Applied when the link is active with exact match. More info here. |
| - |
| fontSizesConfig | Provide a set of sizes for fonts as a global component specific setting. |
|
|
| gradient | Adds a background gradient. |
|
|
| groupBy | When |
|
|
| grow | Take all container width |
|
|
| hoverBehavior | Behavior of the button, when it's being hovered. Can be |
|
|
| hoverMaskColor | Mask color for |
|
|
| hoverOpacity | Opacity value for |
|
|
| href | Designates the component as anchor and applies the href attribute. More info here. |
| - |
| icon | Sets an icon. |
|
|
| iconColor | Sets an icon color. |
|
|
| iconRight | The icon to be displayed to the right of a title. |
|
|
| loading | Indicates that something is loading (spinner icon). |
|
|
| modelValue | The value of the |
|
|
| options | The array of objects with |
| - |
| plain | Applies |
|
|
| preset | Named preset combination of component props. |
| - |
| pressedBehavior | Behavior of the button, when it's being pressed. Can be |
|
|
| pressedMaskColor | Mask color for |
|
|
| pressedOpacity | Opacity value for |
|
|
| replace | When set, calls |
| - |
| round | Adds rounded corners (or make a button fully rounded if only icon is passed). |
|
|
| size | Specify size for component. "small", "medium", "large" sizes are available |
|
|
| sizesConfig | Provide a set of sizes as a global component specific setting. |
|
|
| tag | Replaces html tag. This is useful for semantics and also to allow for valid markup in some cases ( |
|
|
| target | Navigation target, More info here. |
| - |
| textBy | When |
|
|
| textColor | Text color (theme string or HEX string). |
|
|
| textOpacity | Sets button text opacity. |
|
|
| to | The target route of the link. More info here. |
| - |
| toggleColor | Color of the toggle button |
|
|
| trackBy | When |
|
|
| type | Will be used as value for html |
|
|
| valueBy | When |
|
|
Events #
| Name | Description |
|---|---|
update:modelValue | The event is triggered when the component needs to change the model. Is also used by |