Skip to content

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.



Use the href or to properties to create link buttons.

External LinkRouter Link

Mixed button styles

Combine different button styles within the same group.

Types

MazButtonGroupOption

ts
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

ts
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

NameDescriptionTypeRequiredDefaultPossible values
itemsThe items for the button group (optional when using slot-based approach)MazButtonGroupOption[]Noundefined-
orientationThe orientation of the button group"row" | "col"Norowrow' | 'col
sizeThe size of all buttons (only applies to props-based buttons)MazSizeNomd-
colorThe color of all buttons (only applies to props-based buttons)MazColorNoprimary-
rounded-sizeThe rounded size of the buttonsNative typeNolg-
outlinedThe outlined state of the buttonsbooleanNofalse-
pastelThe pastel state of the buttonsbooleanNofalse-
loadingThe loading state of the buttonsbooleanNofalse-
disabledThe disabled state of the buttonsbooleanNofalse-

Slots

NameDescriptionBindings
button-[index]Custom content for a specific button
item MazButtonGroupOption - The button item
index number - The button index
defaultSlot for passing MazBtn components directly