MazBtnGroup
MazBtnGroup is a component to group multiple MazBtn buttons together with seamless styling. Supports props-based or slot-based rendering with customizable orientation, size, and color.
Before use it, you should install the MazUi plugin in your project, follow instructions in Getting Started
Basic usage with items
Use the items prop to quickly create a button group from an array of button configurations.
Slot-based usage
Use the default slot to pass MazBtn components directly for full control over each button.
Orientation
Use the orientation prop to arrange buttons horizontally (row) or vertically (col).
Row (default)
Column
Sizes
Use the size prop to apply a size to all buttons in the group.
Colors
Use the color prop to apply a color to all buttons in the group.
Button variants
Use the outlined or pastel properties on individual buttons or apply different variants to buttons in the group.
Outlined
Pastel
Slot-based variants
Click handlers
Add click handlers to buttons using the onClick property in items.
With icons
Use the leftIcon or rightIcon properties to add icons to buttons.
With links
Use the href or to properties to create link buttons.
Mixed button styles
Combine different button styles within the same group.
Types
MazButtonGroupOption
import type { MazBtnProps } from 'maz-ui/components/MazBtn'
import type { RouteLocationRaw } from 'vue-router'
interface MazButtonGroupOption extends Omit<MazBtnProps, 'block'> {
/** The text of the button */
text: string
/** Click handler for the button */
onClick?: () => void
/** The href for anchor links */
href?: string
/** The route for router-link */
to?: RouteLocationRaw
}MazButtonGroupProps
interface MazButtonGroupProps {
/**
* The items for the button group (optional when using slot-based approach)
* @default undefined
*/
items?: MazButtonGroupOption[]
/**
* The orientation of the button group
* @values 'row' | 'col'
* @default 'row'
*/
orientation?: 'row' | 'col'
/**
* The size of all buttons (only applies to props-based buttons)
* @default 'md'
*/
size?: 'mini' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
/**
* The color of all buttons (only applies to props-based buttons)
* @default 'primary'
*/
color?: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'destructive' | 'transparent' | 'contrast' | 'accent'
}Props
| Name | Description | Type | Required | Default | Possible values |
|---|---|---|---|---|---|
| items | The items for the button group (optional when using slot-based approach) | MazButtonGroupOption[] | No | undefined | - |
| orientation | The orientation of the button group | "row" | "col" | No | row | row' | 'col |
| size | The size of all buttons (only applies to props-based buttons) | MazSize | No | md | - |
| color | The color of all buttons (only applies to props-based buttons) | MazColor | No | primary | - |
| rounded-size | The rounded size of the buttons | Native type | No | lg | - |
| outlined | The outlined state of the buttons | boolean | No | false | - |
| pastel | The pastel state of the buttons | boolean | No | false | - |
| loading | The loading state of the buttons | boolean | No | false | - |
| disabled | The disabled state of the buttons | boolean | No | false | - |
Slots
| Name | Description | Bindings |
|---|---|---|
| button-[index] | Custom content for a specific button | item MazButtonGroupOption - The button itemindex number - The button index |
| default | Slot for passing MazBtn components directly |