`, default: `{ enabled: false, debounce: 300, autoFocus: false }`): The search input options.
- `search-options` (`(NormalizeStringOptions & { threshold?: number | undefined; })`): The options to normalize the search query (used by the default search function) By default, the threshold is 0.75.
- `search-function` (`((query: string, items: O[]) => O[] | undefined)`): Replace the default search function to provide a custom search function.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the checklist (card, checkbox and search input).
- `translations` (`{ noResultsFound?: string | undefined; searchInput?: { placeholder?: string | undefined; } | undefined; }`, default: `Translations from`): Translations of the checklist component.
### Events
- `@update:model-value` (payload: `value?: T[] | undefined`): Emitted when the model value change
- `@update:query` (payload: `value?: string | undefined`): Emitted when the query change
### Slots
- `#title`: use this slot to customize the title
- `#no-results`: use this slot to customize the no results area
- `#no-results-text`: use this slot to customize the no results message
- `#item`: use this slot to customize the item Bindings: `selectedValues: T[]`, `item: O`.
---
source: https://maz-ui.com/components/maz-circular-progress-bar.md
---
---
title: "MazCircularProgressBar"
description: "MazCircularProgressBar displays a percentage or a progress in an animated ring, with a configurable size, color, duration and content in the center"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-circular-progress-bar"
---
# MazCircularProgressBar
> MazCircularProgressBar displays a percentage or a progress in an animated ring, with a configurable size, color, duration and content in the center
- Package: `maz-ui`
- Import: `import MazCircularProgressBar from 'maz-ui/components/MazCircularProgressBar'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-circular-progress-bar
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
```
## Size
The size of the component can be changed by passing the `size` prop. The value could be a string in px, em or rem.
```vue
```
## Duration
The duration of the animation can be changed by passing the `duration` prop. The value could be a number in milliseconds.
```vue
```
## Color
```vue
```
## Auto-color
The color of the component is automatically according to the percentage. The color will be green if the percentage is egal to 100%, orange if below 100%, and red if below 50%.
```vue
```
## Slot
Replace the percentage value by a custom slot.
Obviously, the "counter animation" will not work in this case.
```vue
```
## MazCircularProgressBar API
`import MazCircularProgressBar from 'maz-ui/components/MazCircularProgressBar'`
### Props
- `percentage` (`number`, required): The percentage value of the progress bar.
- `size` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``, default: `"10em"`): The size of the progress bar.
- `duration` (`number`, default: `1000`): Duration of the animation in milliseconds.
- `delay` (`number`, default: `100`): Delay before the animation starts in milliseconds.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`): The color of the progress bar.
- `auto-color` (`boolean`, default: `false`): Auto color based on the count (destructive, warning, success).
- `prefix` (`string`): Suffix to display next to the number.
- `suffix` (`string`): Suffix to display next to the number.
- `stroke-linecap` (`"square" | "butt" | "round" | "inherit"`, default: `"round"`): The stroke-linecap style.
- `stroke-width` (`Numberish`, default: `6`): The stroke width.
- `stroke` (`string`): The stroke color Use this prop to override the gradient color You can use a color name or a color code.
- `success-percentage` (`number`, default: `100`): The percentage value of the success level - The progress circle will be filled with the success color when the percentage is greater than or equal to this value.
- `warning-percentage` (`number`, default: `75`): The percentage value of the warning level - The progress circle will be filled with the warning color when the percentage is greater than or equal to this value.
- `danger-percentage` (`number`, default: `50`): The percentage value of the danger level - The progress circle will be filled with the danger color when the percentage is greater than or equal to this value.
- `once` (`boolean`, default: `true`): Play the animation only once.
### Slots
- `#default`: Default slot - Replace the percaentage value
- `#prefix`: Prefix slot - Add a prefix next to the number (e.g: "$")
- `#suffix`: Suffix slot - Add a suffix next to the number (e.g: "%")
---
source: https://maz-ui.com/components/maz-code-highlight.md
---
---
title: "MazCodeHighlight"
description: "MazCodeHighlight displays source code with syntax highlighting powered by shiki. It auto-detects dark/light mode, ships with a copy-to-clipboard button, a language badge, and supports lazy loading."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-code-highlight"
---
# MazCodeHighlight
> MazCodeHighlight displays source code with syntax highlighting powered by shiki. It auto-detects dark/light mode, ships with a copy-to-clipboard button, a language badge, and supports lazy loading.
- Package: `maz-ui`
- Import: `import MazCodeHighlight from 'maz-ui/components/MazCodeHighlight'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-code-highlight
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Installation requirement
Install [`shiki`](https://shiki.style) in your project to enable highlighting:
```bash [pnpm]
pnpm add shiki
```
```bash [npm]
npm install shiki
```
```bash [yarn]
yarn add shiki
```
If `shiki` is not installed, the component falls back to a plain `` block.
## Basic usage
```vue
```
## With slot
The default slot text is used as source code when the `code` prop is not provided. This is useful for plain text blocks.
```vue
npm install maz-ui
```
## Languages
Pass any valid [shiki language identifier](https://shiki.style/languages) to the `language` prop. The chosen language is also displayed as a small badge in the top-right corner (the badge fades out on hover when the copy button appears).
```vue
```
## Custom theme
Override the auto-detected theme with any [shiki built-in theme](https://shiki.style/themes).
```vue
```
## Copy to clipboard
A copy button is displayed in the top-right corner on hover (or when focused via keyboard). Clicking it writes the resolved code to the clipboard and shows a check icon for ~1.5s.
### Disable the copy button
Set `:copyable="false"` to hide the button entirely.
```vue
```
### Copy a different value than the displayed code
Use `copyValue` when the displayed source differs from what should be copied - for example to strip a leading `$` prompt when rendering a shell command. This is the mechanism `MazWindowMockup` uses internally to keep the terminal prompt out of the clipboard.
```vue
```
## Disable rounded corners
Set `:rounded="false"` to render the highlighted block with squared corners - useful when embedding inside another container that already has its own border-radius (e.g. inside `MazWindowMockup`).
```vue
```
## Custom translations
The copy button's aria-label and tooltip come from the `@maz-ui/translations` package (`codeHighlight.copyToClipboard` / `codeHighlight.copiedToClipboard`). You can override either key per-instance with the `translations` prop without touching the global locale:
```vue
```
For app-wide translations, set up the [maz-ui translations plugin](../ecosystem/translations.md) and the component will pick up your locale automatically.
---
source: https://maz-ui.com/components/maz-container.md
---
---
title: "MazContainer"
description: "MazContainer is a lightweight component to wrap content with optional header, border, elevation, and rounded corners - a simpler alternative to MazCard"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-container"
---
# MazContainer
> MazContainer is a lightweight component to wrap content with optional header, border, elevation, and rounded corners - a simpler alternative to MazCard
- Package: `maz-ui`
- Import: `import MazContainer from 'maz-ui/components/MazContainer'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-container
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
MazContainer is designed to be a lighter alternative to [MazCard](./maz-card.md). Use it when you need a simple container with basic styling options without the extra features like galleries, collapsible content, or actions.
## Basic usage
```vue
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
```
## With title
Add a header with a title using the `title` prop or the `title` slot.
```vue
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
```
## With icons
Add icons to the header using `start-icon` and `end-icon` props.
```vue
Configure your application settings here.
View and edit your profile information.
```
`startIcon` and `endIcon` also accept a full `MazIconProps` object - pass the same shape `` accepts to override the icon size, add a `` for screen readers, etc.
```vue
Configure your application settings here.
```
## Styling options
### Elevation
Add shadow to make the container stand out.
```vue
Container with elevation effect and no border.
```
### Bordered
By default, the container has a border. You can disable it.
```vue
This container has a border.
This container has no border.
```
### Transparent
Remove the background color with the `transparent` prop.
```vue
This container has a transparent background.
```
### Rounded sizes
Customize the border radius with the `rounded-size` prop.
```vue
{{ size }}
```
### No padding
Remove internal padding with `:padding="false"`.
```vue
Content without container padding - useful for custom layouts.
```
## Full width
Use the `block` prop to make the container take full width.
```vue
This container spans the full width of its parent.
```
## Custom header
Use the `header` slot to fully customize the header, or use `title`, `icon-start`, and `icon-end` slots for more granular control.
```vue
Custom Header
New
Content with a fully customized header.
```
## Combining options
```vue
Users
1,234
Revenue
$12.5k
Orders
567
```
## MazContainer API
`import MazContainer from 'maz-ui/components/MazContainer'`
### Props
- `title` (`string`): Title of the card in header.
- `elevation` (`boolean`, default: `false`): Add elevation to the component.
- `padding` (`boolean`, default: `true`): Add padding to the content.
- `bordered` (`boolean`, default: `true`): Add border to the component.
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Size of the rounded. Values: `'none'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'full'` (non exhaustive).
- `transparent` (`boolean`, default: `false`): Remove background color.
- `overflow-hidden` (`boolean`, default: `true`): Hide overflow.
- `start-icon` (`MazIconLike`): Icon displayed on the inline-start edge of the header (left in LTR, right in RTL). Accepts a bare value (Vue component, raw SVG string, URL or `data:` URI) or a full `MazIconProps` object.
- `end-icon` (`MazIconLike`): Icon displayed on the inline-end edge of the header (right in LTR, left in RTL). Accepts a bare value or a full `MazIconProps` object.
- `icon-size` (`MazIconSize`, default: `"md"`): Size of the icon.
- `block` (`boolean`, default: `false`): Display the container in full width.
- `content-class` (`string`): Additional class to add to the content wrapper.
### Slots
- `#header`: Replace the header
- `#icon-start`: inline-start edge of the header (left in LTR, right in RTL)
- `#title`: title
- `#icon-end`: inline-end edge of the header (right in LTR, left in RTL)
- `#default`: content of the container
---
source: https://maz-ui.com/components/maz-date-picker.md
---
---
title: "MazDatePicker"
description: "A powerful and flexible date picker component with support for single dates, date ranges, time selection, and extensive customization options"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-date-picker"
---
# MazDatePicker
> A powerful and flexible date picker component with support for single dates, date ranges, time selection, and extensive customization options
- Package: `maz-ui`
- Import: `import MazDatePicker from 'maz-ui/components/MazDatePicker'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-date-picker
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
## Table of Contents
- Basic Usage
- Date Formats
- Date Selection
- Custom Trigger
- Time Selection
- Range Selection
- Internationalization
- Validation & Constraints
- Types
- Props
- Events
- Slots
## Basic Usage
The simplest way to use MazDatePicker:
```vue
```
## Date Formats
Understanding date formats is crucial for using MazDatePicker effectively. The component uses two different format concepts:
### 1. Data Format (`format` prop)
This controls how dates are stored and transmitted in your `v-model`. Default is `'YYYY-MM-DD'`.
### 2. Display Format (`input-date-format` prop)
This controls how dates appear in the input field using `Intl.DateTimeFormatOptions`.
```vue
```
### Custom Display Transformation
Use `inputDateTransformer` to completely customize how dates appear in the input:
```vue
```
## Date Selection
### Standard Date Picker
```vue
```
### Inline Date Picker
Perfect for dashboards or when you want the calendar always visible:
```vue
```
### Double Calendar
Show two months at once for better date selection:
```vue
```
## Custom Trigger
By default MazDatePicker renders a readonly `MazInput` as the field that opens the calendar. Use the `#trigger` slot to replace it with your own element - a button, a custom input, an icon... Clicking the slotted element opens the calendar automatically (no `@click` needed), and the slot exposes the current open state plus functions for programmatic control.
### Slot bindings
| Binding | Type | Description |
| --- | --- | --- |
| `is-open` | `boolean` | Whether the calendar is currently open |
| `open` | `() => void` | Open the calendar programmatically |
| `close` | `() => void` | Close the calendar programmatically |
| `toggle` | `() => void` | Toggle the calendar programmatically |
```vue
{{ date || 'Pick a date' }}
```
**Tip:**
The model value is not passed through the slot - use your own `v-model` ref (here `date`) to display the selected value in your custom trigger. The exposed `open` / `close` / `toggle` functions are only needed when you want to drive the picker from your own logic.
> In `inline` mode the calendar is always visible, so the `trigger` slot is not rendered. To open the picker from an element rendered outside the component, use the `custom-element-selector` prop instead.
## Time Selection
### Date + Time (24h format)
```vue
```
### Date + Time (12h format)
```vue
```
### Time Only Selection
```vue
```
### Custom Minute Intervals
```vue
```
## Range Selection
For selecting date ranges, pass an object with `start` and `end` properties:
```vue
```
### Range with Shortcuts
Provide predefined shortcuts for common date ranges:
```vue
```
### Property `shortcuts`
#### Model
```ts
interface MazDatePickerShortcut {
identifier: string // should be uniq
label: string
value: {
start: string
end: string
}
}
type MazDatePickerShortcuts = MazDatePickerShortcut[]
```
#### Example
```ts
import type { MazDatePickerShortcut } from 'maz-ui/components'
const shortcuts: MazDatePickerShortcut[] = [{
label: 'Next month',
identifier: 'nextMonth',
value: {
start: dayjs().add(1, 'month').set('date', 1).format('YYYY-MM-DD'),
end: dayjs()
.add(1, 'month')
.set('date', dayjs().add(1, 'month').daysInMonth())
.format('YYYY-MM-DD'),
},
}]
```
**Details: View default shortcuts**
```ts
const shortcuts = [
{
label: 'Last 7 days',
identifier: 'last7Days',
value: {
start: dayjs().subtract(6, 'day').format('YYYY-MM-DD'),
end: dayjs().format('YYYY-MM-DD'),
},
},
{
label: 'Last 30 days',
identifier: 'last30Days',
value: {
start: dayjs().subtract(29, 'day').format('YYYY-MM-DD'),
end: dayjs().format('YYYY-MM-DD'),
},
},
{
label: 'This week',
identifier: 'thisWeek',
value: {
start: dayjs().startOf('week').format('YYYY-MM-DD'),
end: dayjs().endOf('week').format('YYYY-MM-DD'),
},
},
{
label: 'Last week',
identifier: 'lastWeek',
value: {
start: dayjs()
.subtract(1, 'week')
.startOf('week')
.format('YYYY-MM-DD'),
end: dayjs().subtract(1, 'week').endOf('week').format('YYYY-MM-DD'),
},
},
{
label: 'This month',
identifier: 'thisMonth',
value: {
start: dayjs().set('date', 1).format('YYYY-MM-DD'),
end: dayjs()
.set('date', dayjs().daysInMonth())
.format('YYYY-MM-DD'),
},
},
{
label: 'This year',
identifier: 'thisYear',
value: {
start: dayjs().startOf('year').format('YYYY-MM-DD'),
end: dayjs().endOf('year').format('YYYY-MM-DD'),
},
},
{
label: 'Last year',
identifier: 'lastYear',
value: {
start: dayjs()
.subtract(1, 'year')
.startOf('year')
.format('YYYY-MM-DD'),
end: dayjs().subtract(1, 'year').endOf('year').format('YYYY-MM-DD'),
},
},
]
```
## Validation & Constraints
### Min/Max Dates
```vue
```
#### Property `min-max-auto`
Disable min-max auto check to not change the value when it is out of range
```vue
```
### Disabled Days & Dates
```vue
```
### Disabled Hours
```vue
```
## Internationalization
MazDatePicker supports full internationalization. **By default, it uses the locale from the [MazUiTranslations](../ecosystem/translations.md) plugin**, but you can override it:
```vue
```
## Types
```typescript
// Value types
type MazDatePickerValue = string | undefined | MazDatePickerPartialRangeValue
interface MazDatePickerRangeValue {
start: string
end: string
}
type MazDatePickerPartialRangeValue = Partial
// Shortcut type
interface MazDatePickerShortcut {
identifier: string
label: string
value: {
start: string
end: string
}
}
```
## Accessibility
- The input is a `combobox` opening a `dialog` (`aria-haspopup="dialog"`, `aria-expanded`, `aria-controls`).
- Each month is a `grid` labelled by the month and the year, the days of the week are its column headers and each day has its full date as label (`aria-current="date"` for today, `aria-selected` on the selected days).
- **Keyboard** in the calendar: only one day is in the tab sequence, the arrows move by day (← →) and by week (↑ ↓), Home / End go to the start / end of the week, Page Up / Page Down to the previous / next month (with Shift: year). Disabled days are skipped and the calendar follows the focus to the displayed month.
- The navigation buttons labels come from `@maz-ui/translations` (`aria` namespace).
## MazDatePicker API
`import MazDatePicker from 'maz-ui/components/MazDatePicker'`
### Props
- `id` (`string`): The unique identifier of the component.
- `input-props` (`MazInputProps`): The props to apply to the input component.
- `model-value` (`MazDatePickerValue`, `v-model`): The value of the date picker component If an object is provided, the picker will be a range picker.
- `format` (`string`, default: `"YYYY-MM-DD"`): The format pattern for date display and parsing.
- `open` (`boolean`, default: `false`, `v-model:open`): Controls whether the picker window is open.
- `label` (`string`): The label text displayed above the input field.
- `placeholder` (`string`): The placeholder text shown when no value is selected.
- `input-date-format` (`Intl.DateTimeFormatOptions`, default: `{ dateStyle: "medium", timeStyle: "short" }`): The Intl.DateTimeFormatOptions for styling the input date display.
- `input-date-transformer` (`((payload: { formattedDate?: string | undefined; value?: MazDatePickerValue; locale: string; }) => string)`): Custom function to transform the formatted date display.
- `locale` (`string`, default: `""`, `v-model:locale`): The locale string for date formatting and localization.
- `hide-header` (`boolean`, default: `false`): Controls whether the calendar header is hidden.
- `disabled` (`boolean`, default: `false`): Controls whether the component is disabled.
- `first-day-of-week` (`0 | 1 | 2 | 3 | 4 | 5 | 6`, default: `0`): The first day of the week in the calendar. Values: `'0'`, `'1'`, `'2'`, `'3'`, `'4'`, `'5'`, `'6'` (non exhaustive).
- `auto-close` (`boolean`, default: `false`): Controls whether the picker closes automatically after date selection.
- `custom-element-selector` (`string`): CSS selector for a custom element that triggers the picker.
- `double` (`boolean`, default: `false`): Controls whether the picker displays two months side by side.
- `inline` (`boolean`, default: `false`): Controls whether the picker is displayed inline without input field.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color theme of the component.
- `picker-position` (`MazPopoverPosition`, default: `"auto"`): The position where the picker popover should appear. Values: `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-end'`, `'bottom-end'`, `'left-end'`, `'right-end'`, `'top-start'`, `'bottom-start'`, `'left-start'`, `'right-start'` (non exhaustive).
- `picker-prefer-position` (`MazPopoverPreferPosition`, default: `"bottom-start"`): The preferred position of the picker popover. Values: `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-end'`, `'bottom-end'`, `'left-end'`, `'right-end'`, `'top-start'`, `'bottom-start'`, `'left-start'`, `'right-start'` (non exhaustive).
- `picker-fallback-position` (`MazPopoverFallbackPosition`, default: `"top-start"`): The fallback position of the picker popover. Values: `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-end'`, `'bottom-end'`, `'left-end'`, `'right-end'`, `'top-start'`, `'bottom-start'`, `'left-start'`, `'right-start'` (non exhaustive).
- `time` (`boolean`, default: `false`): Controls whether the picker includes a time selector.
- `only-time` (`boolean`, default: `false`): Controls whether the picker shows only time selection (no date).
- `minute-interval` (`number`, default: `5`): The interval in minutes for the time picker minute selection. Values: `'1'`, `'5'`, `'10'`, `'15'`, `'30'` (non exhaustive).
- `use-browser-locale` (`boolean`, default: `true`): Controls whether to automatically detect and use the browser's locale.
- `fetch-local` (`boolean`, default: `true`): Controls whether to fetch locale data dynamically.
- `shortcuts` (`boolean | MazDatePickerShortcut[]`, default: `true`): Array of predefined date range shortcuts or false to disable.
- `shortcut` (`string`): The identifier of the currently selected shortcut.
- `min-date` (`string`): The minimum selectable date in ISO format.
- `max-date` (`string`): The maximum selectable date in ISO format.
- `min-max-auto` (`boolean`, default: `true`): When minDate or maxDate are provided, if the current date is not between minDate and maxDate, the current date will be set to the minDate or maxDate.
- `disabled-weekly` (`number[]`, default: `[]`): Array of weekday numbers to disable (0 = Sunday, 6 = Saturday).
- `disabled-dates` (`string[]`, default: `[]`): Array of specific dates to disable in ISO format.
- `disabled-hours` (`number[]`, default: `[]`): Array of hour numbers to disable in the time picker (0-23).
- `block` (`boolean`, default: `false`): Controls whether the input displays in full width.
- `range` (`boolean`, default: `false`): Controls whether the picker operates in range selection mode.
- `transition` (`string`, default: `"scale-fade"`): The transition name of the popover.
### Events
- `@update:model-value` (payload: `value: MazDatePickerValue`): Emitted when the picker value changes
- `@close` (payload: `(void | undefined)?`): Emitted when the picker closes
- `@update:locale` (payload: `value: string`)
- `@update:open` (payload: `value: boolean`)
### Slots
- `#trigger`: Replace the default input with your own element Bindings: `isOpen: boolean` (Current open state of the popover), `close: () => void` (Function to close the popover), `open: () => void` (Function to open the popover), `toggle: () => void` (Function to toggle the popover).
---
source: https://maz-ui.com/components/maz-dialog.md
---
---
title: "MazDialog"
description: "MazDialog is a standalone dialog component to show important informations to the user or propose specific action. Many options are available. You can hide the header or the footer, full-size layout, differents states etc."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-dialog"
---
# MazDialog
> MazDialog is a standalone dialog component to show important informations to the user or propose specific action. Many options are available. You can hide the header or the footer, full-size layout, differents states etc.
- Package: `maz-ui`
- Import: `import MazDialog from 'maz-ui/components/MazDialog'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-dialog
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component uses `` with [MazBackdrop](./maz-backdrop.md), so you can implement this component anywhere and it inherits all its props
## Basic usage
```vue
Open Dialog
Your content
Confirm
```
## Scrollable
For long content, you can enable scrolling in content part (Header and footer slot remain visible at top and bottom)
```html
Scrollable Dialog Title
Scroll down
Confirm
```
## Width
On tablet and up, the dialog is sized by two CSS variables coming from the active theme preset (`components.dialog`):
- `--maz-dialog-max-width` (default `38rem`)
- `--maz-dialog-min-width` (default `32rem`)
You can set these defaults globally per preset - see [the theme `components.dialog` documentation](../ecosystem/themes.md#dialog-sizing). To change the width of a single dialog, pass the `max-width` / `min-width` props - they always override the preset:
```vue
This dialog overrides the preset width through props.
```
**Tip:**
The default widths are expressed in `rem`, so they scale with the preset's `base-font-size`. Presets with a larger base size (e.g. `ocean` at `16px`) ship rem values adjusted to keep the rendered pixel width consistent across presets.
## Accessibility
- The dialog is a modal `dialog` (`aria-modal`), labelled by its title and described by its content (override them with the `aria-labelledby` / `aria-describedby` props).
- The focus moves into the dialog on open, stays trapped inside and goes back to the previous element on close. Esc closes it (`close-on-escape`).
- While it is open, the rest of the page is `inert` (no focus, no click, hidden from assistive technologies), except the toasts and the live regions.
## MazDialog API
`import MazDialog from 'maz-ui/components/MazDialog'`
### Props
- `model-value` (`boolean`, `v-model`): Modal's model value.
- `title` (`string`): Title of the modal in header.
- `hide-close-button` (`boolean`): Remove the close button in header.
- `max-width` (`string`, default: `"var(--maz-dialog-max-width, 38rem)"`): Modal's max-width.
- `min-width` (`string`, default: `"var(--maz-dialog-min-width, 32rem)"`): Modal's min-width.
- `scrollable` (`boolean`): Modal's content becomes scrollable - warning: a overflow is applied.
- `persistent` (`boolean`): Persistent dialog (not closable by clicking outside and remove close button).
- `teleport-selector` (`string`): Teleport selector.
- `before-close` (`(() => void | Promise)`): Function called before modal is close.
- `close-on-escape` (`boolean`, default: `true`): Prevent close on escape key.
- `transition-name` (`string`): Transition name.
- `backdrop-class` (`ClassValue`): Backdrop class.
- `backdrop-content-class` (`ClassValue`): Backdrop content class.
- `content-padding` (`boolean`): Add padding to the content.
- `justify` (`"none" | "center" | "end" | "start" | "space-between" | "space-around"`): Justify content.
- `align` (`"none" | "center" | "end" | "start"`): Align content.
- `variant` (`"bottom-sheet" | "dialog" | "drawer"`): Variant.
- `aria-labelledby` (`string`): ID for aria-labelledby.
- `aria-describedby` (`string`): ID for aria-describedby.
### Events
- `@update:model-value` (payload: `value: boolean`): emitted when modal is open or close
- `@open` (payload: `value?: void | undefined`): emitted when modal is open
- `@close` (payload: `value?: void | undefined`): emitted when modal is close
### Slots
- `#header`: Header slot Bindings: `close: () => void` (close function).
- `#title`: Title slot in the header
- `#default`: Default content Bindings: `close: () => void` (close function).
- `#footer`: Footer slot Bindings: `close: () => void` (close function).
### Exposed (template ref)
- `close`: Close the dialog
---
source: https://maz-ui.com/components/maz-dialog-confirm.md
---
---
title: "MazDialogConfirm"
description: "MazDialogConfirm is a standalone component that dialogs with the user to show important information and propose confirmation. You should wait for this response with await."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-dialog-confirm"
---
# MazDialogConfirm
> MazDialogConfirm is a standalone component that dialogs with the user to show important information and propose confirmation. You should wait for this response with await.
- Package: `maz-ui`
- Import: `import MazDialogConfirm from 'maz-ui/components/MazDialogConfirm'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-dialog-confirm
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Note:**
This component uses [MazDialog](./maz-dialog.md), so it inherits all its props
**Tip:**
This component uses `` with [MazBackdrop](./maz-backdrop.md), so you can implement this component anywhere and it inherits all its props
## Basic usage
```vue
Ask user
Do you really want to delete this user?
Are you really sure you want to delete this user?
User deleted
User has been deleted!
Ok
```
## Types
```ts
interface MazDialogConfirmData {
/**
* Dialog title
*/
title?: string
/**
* Dialog message
*/
message?: string
/**
* Dialog custom buttons
* @default [{ text: 'Confirm', color: 'success', type: 'accept' }, { text: 'Cancel', color: 'destructive', type: 'reject' }]
* @type {MazDialogConfirmButton[]}
*/
buttons?: MazDialogConfirmButton[]
}
// All props of MazBtn
interface MazDialogConfirmButton {
text?: string
block?: boolean
color?: Color
disabled?: boolean
loading?: boolean
outlined?: boolean
rounded?: boolean
size?: Size
text: string
type: 'accept' | 'reject'
response?: unknown
}
type Color = 'primary'
| 'secondary'
| 'info'
| 'success'
| 'warning'
| 'destructive'
| 'accent'
| 'contrast'
| 'transparent'
type Size = 'mini' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
```
## MazDialogConfirm API
`import MazDialogConfirm from 'maz-ui/components/MazDialogConfirm'`
### Props
- `identifier` (`string`, required): Uniq identifier of the dialog - This is used to identify the dialog in the state.
- `title` (`string`): Dialog title displayed in the header Title of the modal in header.
- `message` (`string`): Dialog message displayed in the body.
- `reject-text` (`string`): Text for the reject button - will be applied only if buttons props is not provided.
- `reject-props` (`(Omit & MazDialogConfirmButton)`, default: `{ color: 'destructive', type: 'reject', text: 'Cancel', response: 'reject' }`): Props for the reject button - will be applied only if buttons props is not provided.
- `hide-reject-button` (`boolean`, default: `true`): Whether to display the reject button.
- `accept-text` (`string`): Text for the accept button.
- `accept-props` (`(Omit & MazDialogConfirmButton)`, default: `{ color: 'success', type: 'accept', text: 'Confirm', response: 'accept' }`): Props for the accept button - will be applied only if buttons props is not provided.
- `hide-accept-button` (`boolean`, default: `true`): Whether to display the accept button.
- `buttons` (`MazDialogConfirmButton[]`): Buttons to display in the footer.
- `model-value` (`boolean`): Modal's model value.
- `hide-close-button` (`boolean`): Remove the close button in header.
- `max-width` (`string`, default: `` Theme preset `components.dialog.max-width` via `var(--maz-dialog-max-width, 38rem)` ``): Modal's max-width.
- `min-width` (`string`, default: `` Theme preset `components.dialog.min-width` via `var(--maz-dialog-min-width, 32rem)` ``): Modal's min-width.
- `scrollable` (`boolean`): Modal's content becomes scrollable - warning: a overflow is applied.
- `persistent` (`boolean`): Persistent dialog (not closable by clicking outside and remove close button).
- `teleport-selector` (`string`): Teleport selector.
- `before-close` (`(() => void | Promise)`): Function called before modal is close.
- `close-on-escape` (`boolean`, default: `true`): Prevent close on escape key.
- `transition-name` (`string`): Transition name.
- `backdrop-class` (`ClassValue`): Backdrop class.
- `backdrop-content-class` (`ClassValue`): Backdrop content class.
- `content-padding` (`boolean`): Add padding to the content.
- `justify` (`"none" | "center" | "end" | "start" | "space-between" | "space-around"`): Justify content.
- `align` (`"none" | "center" | "end" | "start"`): Align content.
- `variant` (`"bottom-sheet" | "dialog" | "drawer"`): Variant.
- `aria-labelledby` (`string`): ID for aria-labelledby.
- `aria-describedby` (`string`): ID for aria-describedby.
### Events
- `@open` (payload: `value?: void | undefined`): Emitted when modal is open
- `@close` (payload: `value?: void | undefined`): Emitted when modal is close
### Slots
- `#title`: title slot - Place your title
- `#default`: Default slot - Place your content Bindings: `accept: (reason?: unknown) => Promise` (accept function), `reject: (reason?: unknown) => Promise` (reject function).
- `#footer-button`: Footer slot Bindings: `accept: (reason?: unknown) => Promise` (accept function), `reject: (reason?: unknown) => Promise` (reject function).
### Exposed (template ref)
- `close`: Close the dialog
- `isActive`: Check if the dialog is active
---
source: https://maz-ui.com/components/maz-drawer.md
---
---
title: "MazDrawer"
description: "MazDrawer is a panel that slides in from the top, the bottom, the left or the right side of the screen over a backdrop, for side menus, filters or details"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-drawer"
---
# MazDrawer
> MazDrawer is a panel that slides in from the top, the bottom, the left or the right side of the screen over a backdrop, for side menus, filters or details
- Package: `maz-ui`
- Import: `import MazDrawer from 'maz-ui/components/MazDrawer'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-drawer
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component uses `` with [MazBackdrop](./maz-backdrop.md), so you can implement this component anywhere and it inherits all its props
## Basic usage
```html
Open top drawer
Open left drawer
Open right drawer
Open bottom drawer
Drawer top
Drawer bottom
Drawer left
Drawer right
```
## Accessibility
The drawer is a modal `dialog` labelled by its `title`. The focus is trapped inside while it is open, Esc closes it, and the rest of the page is `inert` (except the toasts and the live regions). The close button is labelled from `@maz-ui/translations` (`aria.close`).
## MazDrawer API
`import MazDrawer from 'maz-ui/components/MazDrawer'`
### Props
- `title` (`string`): The title of the drawer.
- `variant` (`"end" | "start" | "bottom" | "top"`, default: `"end"`): The edge from which the drawer slides in. `start` (= left in LTR, right in RTL) and `end` (= right in LTR, left in RTL) follow the document direction; `top` and `bottom` are physical.
- `size` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``, default: `"30rem"`): The size of the drawer.
- `backdrop-class` (`string`): The class of the backdrop.
- `hide-close-button` (`boolean`): Disable the close button.
- `model-value` (`boolean`, `v-model`): Value of `v-model`, forwarded to the inner component.
### Events
- `@update:model-value` (payload: `value: boolean`): emitted when drawer is open or close
- `@open`: emitted when drawer is open
- `@close`: emitted when drawer is close (after animation)
- `@before-close`: emitted before drawer is close
### Slots
- `#title` Bindings: `close: () => void`.
- `#default` Bindings: `close: () => void`.
---
source: https://maz-ui.com/components/maz-dropdown.md
---
---
title: "MazDropdown"
description: "MazDropdown is a standalone dropdown menu component and versatile designed for various use cases."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-dropdown"
---
# MazDropdown
> MazDropdown is a standalone dropdown menu component and versatile designed for various use cases.
- Package: `maz-ui`
- Import: `import MazDropdown from 'maz-ui/components/MazDropdown'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-dropdown
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
## Basic usage
```vue
Dropdown Menu
```
## Open dropdown with adaptive trigger
The `adaptive` trigger mode automatically adapts to the user's device:
- **Desktop**: Uses hover behavior (mouseenter/mouseleave)
- **Mobile/Touch devices**: Uses click behavior
This provides the best user experience across all devices without requiring manual configuration.
```html{7}
Adaptive trigger
```
## Open dropdown only on click
```html{7}
Click me
```
## Open dropdown only on hover
```html{7}
Hover me
```
## Custom dropdown icon
You can provide an icon to replace the default chevron icon and disable the animation
```vue{7}
Hover me
No icon animation
```
`dropdownIcon` also accepts a full `MazIconProps` object - pass the same shape `` accepts when you need to set a `` for screen readers, override the size, or attach `svgAttributes`.
```vue
Custom icon
```
## Custom dropdown main button without chevron icon
**Tip:**
This component uses [MazBtn](./maz-btn.md) has a menu button, so it inherits all its props
**Details: View code**
```vue{7-13}
```
## Custom slots
### Custom dropdown panel
You can provide a template to replace the default dropdown panel
**Details: View code**
```html
Customized dropdown panel
Item
Item
Item
Item
Item
Item
Item
Item
Item
Item
Item
Item
```
### Custom menuitem labels
You can provide a template to replace menuitem labels to add more elements in each menuitem
**Details: View code**
```html
Customized labels
{{ item.label }}
```
### Custom control triggered element
You can provide an HTML element or a component to replace the default button
**Warning:**
Add `tabindex="-1"` attribute to your element to avoid a double focus with Tab key
**Details: View code**
```html
HTMLButtonElement: isOpen {{ isOpen }}
```
## Open programmatically
isOpen:
```vue
Open
Open Dropdown
```
## Position
## Types
### MazDropdownMenuItem
```ts
type MazDropdownMenuItem = {
label: string
onClick?: () => unknown
target?: string
href?: string
to?: RouteLocationRaw
class?: string
} & Record
```
## Accessibility
The trigger button exposes the menu state (`aria-haspopup="menu"`, `aria-expanded`, `aria-controls`), the panel is a `menu` and each item a `menuitem`. ↓ / ↑ move between the items, Enter runs the focused item and Esc closes the menu.
## MazDropdown API
`import MazDropdown from 'maz-ui/components/MazDropdown'`
### Props
- `model-value` (`boolean`, default: `false`, `v-model`): Controls whether the dropdown menu is open.
- `items` (`MazDropdownMenuItem[]`, default: `[]`): Menu items to display in the dropdown Each item can be either a link (with href/to properties) or an action (with onClick function).
- `items-size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): Size of the dropdown menu items.
- `id` (`string`): Unique identifier for the dropdown component.
- `trigger` (`MazPopoverTrigger`, default: `"adaptive"`): Determines how the dropdown should be triggered. Values: `'click'`, `'hover'`, `'manual'`, `'adaptive'` (non exhaustive).
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"transparent"`): Color theme for the dropdown button.
- `position` (`MazPopoverPosition`, default: `"auto"`): Position of the menu relative to trigger. Values: `'auto'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-start'`, `'top-end'`, `'bottom-start'`, `'bottom-end'`, `'left-start'`, `'left-end'`, `'right-start'`, `'right-end'` (non exhaustive).
- `close-on-click` (`boolean`, default: `false`): Controls whether the dropdown menu closes when a menu item is clicked.
- `disabled` (`boolean`, default: `false`): Disables the dropdown functionality.
- `chevron` (`boolean`, default: `true`): Controls whether to show the chevron icon in the trigger button.
- `screen-reader-description` (`string`, default: `MazUiTranslationsSchema['dropdown']['screenReaderDescription']`): Accessible description for screen readers describing the dropdown functionality If not provided, the default translation of MazUiTranslations plugin will be used.
- `menu-panel-class` (`ClassValue`): Additional CSS classes to apply to the dropdown menu panel Useful for customizing the dropdown appearance (background, border, etc.).
- `menu-panel-style` (`StyleValue`): Inline styles to apply to the dropdown menu panel Useful for custom styling. You may use `!important` to override default styles.
- `block` (`boolean`, default: `false`): Makes the dropdown button expand to full width of its container.
- `dropdown-icon` (`MazIconLike`): Icon to use instead of the default chevron for the dropdown indicator Custom icon to display in place of the default chevron. Accepts a bare value (Vue component, raw SVG string, URL or `data:` URI) or a full `MazIconProps` object.
- `dropdown-icon-animation` (`boolean`, default: `true`): Controls whether the dropdown icon rotates when the dropdown is opened.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): Size of the dropdown button.
- `transition` (`string`, default: `"scale-pop"`): Transition to use when the dropdown is opened or closed. Values: `'scale-pop'`, `'scale-fade'`, `'string'` (non exhaustive).
- `delay` (`number`, default: `0`): Delay before showing/hiding in milliseconds.
- `persistent` (`boolean`, default: `false`): Prevent auto-close (ignores click outside and escape key).
- `close-on-escape` (`boolean`, default: `true`): Close popover when pressing Escape key.
- `aria-labelledby` (`string`): ARIA labelledby attribute for accessibility.
- `aria-describedby` (`string`): ARIA describedby attribute for accessibility.
- `offset` (`number`, default: `8`): Distance between trigger and popover in pixels.
- `aria-label` (`string`): ARIA label for the popover.
- `prefer-position` (`MazPopoverPreferPosition`, default: `"bottom-start"`): Preferred position of the popover relative to trigger when auto position is used - Preferred position of the popover relative to trigger. Values: `'auto'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-start'`, `'top-end'`, `'bottom-start'`, `'bottom-end'`, `'left-start'`, `'left-end'`, `'right-start'`, `'right-end'` (non exhaustive).
- `fallback-position` (`MazPopoverFallbackPosition`, default: `auto`): Fallback position of the popover relative to trigger when prefer position is not visible - Fallback position of the popover relative to trigger. Values: `'auto'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-start'`, `'top-end'`, `'bottom-start'`, `'bottom-end'`, `'left-start'`, `'left-end'`, `'right-start'`, `'right-end'` (non exhaustive).
- `announce-changes` (`boolean`, default: `false`): Announce content changes to screen readers.
- `hover-delay` (`number`, default: `150`): Delay before closing on hover in milliseconds.
- `teleport-to` (`string`, default: `'body'`): Teleport target selector.
- `overlay-class` (`ClassValue`): Additional CSS classes for the overlay wrapper.
- `panel-class` (`ClassValue`): Additional CSS classes for the popover panel.
- `panel-style` (`StyleValue`): Inline styles for the popover panel.
- `close-on-click-outside` (`boolean`, default: `true`): Close popover when clicking outside.
- `trap-focus` (`boolean`, default: `true`): Trap focus inside the popover.
- `keep-open-on-hover` (`boolean`, default: `false`): Keep popover open when hovering over the panel.
- `position-reference` (`string | HTMLElement`): CSS selector or element reference to use for positioning calculations - When provided, the popover will position relative to this element instead of the trigger Useful for components with labels where you want to position relative to the actual input.
### Events
- `@update:model-value` (payload: `value: boolean`): Emitted when the dropdown open state changes
- `@update:modelValue` (payload: `value: boolean`)
- `@menuitem-clicked` (payload: `event: Event`): Emitted when a menu item is clicked
### Slots
- `#screen-reader-description`: description for screen readers (hidden from visual display)
- `#trigger`: trigger element for the dropdown Bindings: `isOpen: boolean` (Current state of the dropdown (true when open, false when closed)), `toggle: () => void` (Function to toggle the dropdown), `close: () => void` (Function to close the dropdown), `open: () => void` (Function to open the dropdown).
- `#default`: Text content of the trigger element
- `#dropdown-icon`: Dropdown indicator icon Bindings: `isOpen: boolean` (Current state of the dropdown (true when open, false when closed)), `toggle: () => void`, `close: () => void`, `open: () => void`.
- `#dropdown`: Dropdown menu panel content Bindings: `items: MazDropdownMenuItem[]` (Array of menu items passed via the items prop), `open: () => void` (Function to open the dropdown), `close: () => void` (Function to close the dropdown), `isOpen: boolean` (Current state of the dropdown (true when open, false when closed)), `toggle: () => void` (Function to toggle the dropdown).
- `#prepend-menu`: Prepend to the list of menu items Bindings: `isOpen: boolean` (Current state of the dropdown (true when open, false when closed)), `open: () => void` (Function to open the dropdown), `close: () => void` (Function to close the dropdown), `toggle: () => void` (Function to toggle the dropdown).
- `#menuitem`: Menu item component Bindings: `item: MazDropdownMenuItem` (Individual menu item object with properties like label, href, onClick, etc.), `open: () => void` (Function to open the dropdown), `close: () => void` (Function to close the dropdown), `isOpen: boolean` (Current state of the dropdown (true when open, false when closed)), `toggle: () => void` (Function to toggle the dropdown).
- `#menuitem-label`: Label content for menu item Bindings: `item: MazDropdownMenuItem` (Individual menu item object containing label and other properties), `open: () => void` (Function to open the dropdown), `close: () => void` (Function to close the dropdown), `isOpen: boolean` (Current state of the dropdown (true when open, false when closed)), `toggle: () => void` (Function to toggle the dropdown).
- `#append-menu`: Append to the list of menu items Bindings: `isOpen: boolean` (Current state of the dropdown (true when open, false when closed)), `open: () => void` (Function to open the dropdown), `close: () => void` (Function to close the dropdown), `toggle: () => void` (Function to toggle the dropdown).
---
source: https://maz-ui.com/components/maz-dropzone.md
---
---
title: "MazDropzone"
description: "MazDropzone is a powerful and flexible file upload component with drag & drop support, progress tracking, and customizable UI. Perfect for handling single or multiple file uploads in your Vue applications."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-dropzone"
---
# MazDropzone
> MazDropzone is a powerful and flexible file upload component with drag & drop support, progress tracking, and customizable UI. Perfect for handling single or multiple file uploads in your Vue applications.
- Package: `maz-ui`
- Import: `import MazDropzone from 'maz-ui/components/MazDropzone'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-dropzone
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
## Key Features
- 🎯 Drag & drop support
- 📁 Single or multiple file uploads
- 🖼️ Image preview thumbnails
- 🚀 Auto upload support
- ⚡ Async file processing
- 🎨 Fully customizable UI
- 🌐 Support for various file types
- ⚙️ Extensive configuration options
- 🔒 File validation (size, type, count)
- 🌍 Internationalization support
## Error codes
| Error Code | Description | Trigger |
| ---------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------- |
| `FILE_SIZE_EXCEEDED` | File size exceeds the allowed limit | When a file is larger than `maxFileSize` (in MB) |
| `FILE_SIZE_TOO_SMALL` | File size is below the minimum limit | When a file is smaller than `minFileSize` (in MB) |
| `MAX_FILES_EXCEEDED` | Maximum number of allowed files exceeded | When trying to add more files than `maxFiles` or more than 1 file if `multiple=false` |
| `FILE_TYPE_NOT_ALLOWED` | File type is not allowed | When the file's MIME type doesn't match the specified `dataTypes` |
| `FILE_DUPLICATED` | An identical file already exists | When `allowDuplicates=false` and a file with the same name, size and type already exists |
| `NO_FILES_TO_UPLOAD` | No files to upload | When starting upload but there are no files in the dropzone |
| `FILE_UPLOAD_ERROR` | Error during individual file upload | When uploading a specific file fails (`single` mode) |
| `FILE_UPLOAD_ERROR_MULTIPLE` | Error during batch upload | When uploading multiple files fails (`multiple` mode) |
| `NO_URL` | No upload URL configured | When attempting auto-upload without defining the `url` prop |
### Error handling example
**Details: View code**
```vue
```
## Basic Usage
```vue
Upload Files
```
## File Type Restrictions
You can restrict allowed file types using the `data-types` prop:
```vue
```
## Auto Upload
Enable automatic file upload using the `auto-upload` prop. Files can be uploaded individually (`single`) in separate requests or all at once (`multiple`) in a single request:
```html
```
You can also upload all files at once using `multiple`:
**Tip:**
Multiple upload is allowed:
- when `max-files` is greater than 1
- when `auto-upload` is set to `multiple`
- when `multiple` prop is set to `true`
[Link to the source code](https://github.com/maz-ui/maz-ui/blob/main/components/MazDropzone.vue#L219)
```html
```
## Custom Upload Area
Customize the upload area using slots:
```html
Drop your files here or click to browse
Select Files
```
## Custom Translations
### Using `translations` prop
Customize text messages using the `translations` prop:
```html
```
### Using `MazUi` plugin
You can also use the `MazUi` plugin to customize the translations:
**Details: View code**
```ts
import { MazUi } from 'maz-ui/plugins/maz-ui'
app.use(MazUi, {
translations: {
locale: 'en',
messages: {
en: {
dropzone: {
dragAndDrop: 'Drag files here',
selectFile: 'select files',
divider: 'or',
fileMaxCount: 'Maximum {count} files',
fileMaxSize: 'Maximum {size} MB',
fileTypes: 'Allowed file types: {types}',
},
},
},
},
})
```
## Custom Upload Request
Customize the upload request using `uploadUrl`, `requestOptions` and `transformBody`:
```html
```
## MazDropzone API
`import MazDropzone from 'maz-ui/components/MazDropzone'`
### Props
- `id` (`string`): The id of the dropzone.
- `multiple` (`boolean`, default: `false`): Allow multiple files to be uploaded.
- `data-types` (`string[]`, default: `['*\/*']`): Allowed data types/MIME types for files (e.g. ['application/json']).
- `prevent-default-for-unhandled` (`boolean`, default: `true`): Prevent default behavior for unhandled drag & drop events.
- `max-file-size` (`number`): Maximum file size in MB.
- `max-files` (`number`): Maximum number of files allowed.
- `disabled` (`boolean`, default: `false`): Disable the dropzone.
- `preview` (`boolean`, default: `true`): Show file preview.
- `min-file-size` (`number`): Minimum file size in MB.
- `allow-duplicates` (`boolean`, default: `false`): Allow duplicates.
- `translations` (`{ dragAndDrop?: string | undefined; selectFile?: string | undefined; divider?: string | undefined; fileMaxCount?: string | undefined; fileMaxSize?: string | undefined; fileTypes?: string | undefined; types?: { image?: string | undefined;...`): Translations - Custom translations for the component.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Main color of the component.
- `remove-file-btn-props` (`MazBtnProps`, default: `{}`): MazBtn props [MazBtn props](./maz-btn.md#props).
- `spinner-props` (`MazSpinnerProps`, default: `{}`): MazSpinner props [MazSpinner props](./maz-spinner.md#props).
- `auto-upload` (`false | "multiple" | "single"`, default: `false`): Auto upload files - If set to `multiple`, all files will be uploaded at once in a single request. If set to `single`, files will be uploaded one by one in separate requests. If set to `false`, no upload will be done automatically.
- `url` (`string`): Upload URL - If set, files will be uploaded to the given URL.
- `request-options` (`RequestInit`): Request options - Request options to be used for the upload (using fetch) [Request options](https://developer.mozilla.org/en-US/docs/Web/API/fetch#options).
- `transform-body` (`((formData: FormData) => BodyInit | null | undefined)`): Transform the body of the request.
- `max-concurrent-uploads` (`number`, default: `5`): Maximum number of concurrent uploads - Limit the number of files uploaded simultaneously to avoid overwhelming the server.
- `model-value` (`MazDropzoneFileData[]`, default: `[]`, `v-model`): The files data.
### Events
- `@add` (payload: `value: File`): Event emitted when a file is added to the dropzone
- `@error` (payload: `values: { files: File[] | null; event: DragEvent | null; code: MazDropzoneErrorCode; }`): Event emitted when an error occurs
- `@drop` (payload: `values: { files: File[] | null; event: DragEvent; }`): Event emitted when files are dropped in the dropzone
- `@update:modelValue` (payload: `value: MazDropzoneFileData[]`)
- `@enter` (payload: `values: { files: File[] | null; event: DragEvent; }`): Event emitted when dragged files enter the dropzone
- `@leave` (payload: `values: { files: File[] | null; event: DragEvent; }`): Event emitted when dragged files leave the dropzone
- `@over` (payload: `values: { files: File[] | null; event: DragEvent; }`): Event emitted when dragged files are over the dropzone
- `@remove` (payload: `value: File`): Event emitted when a file is removed from the dropzone
- `@upload-error` (payload: `values: { file: File; code: MazDropzoneErrorCode; error: unknown; }`): Event emitted when an error occurs during file upload
- `@upload-error-multiple` (payload: `values: { files: File[]; code: MazDropzoneErrorCode; error: unknown; }`): Event emitted when an error occurs during multiple files upload
- `@upload-success` (payload: `values: { file: File; response?: Response | undefined; }`): Event emitted when a file is successfully uploaded
- `@upload-success-multiple` (payload: `values: { files: File[]; response?: Response | undefined; }`): Event emitted when multiple files are successfully uploaded
### Slots
- `#files-area`: Slot to customize the files area Bindings: `filesData: MazDropzoneFileData[]` (The files data).
- `#file-item`: Slot to customize the file item Bindings: `file: MazDropzoneFileData` (The drop file data).
- `#no-files-area`: Slot to customize the no files area Bindings: `selectFile: () => void` (The function to select the file).
- `#upload-icon`: Slot to customize the upload icon
### Exposed (template ref)
- `uploadFiles`: Upload files
- `uploadFilesMultiple`: Upload multiple files
- `getFormData`: Get form data
- `getFormDataMultiple`: Get form data multiple
- `reset`: Reset the files
- `isUploading`: Check if the files are uploading
- `addFile`: Add a file to the dropzone
- `removeFile`: Remove a file from the dropzone
---
source: https://maz-ui.com/components/maz-expand-animation.md
---
---
title: "MazExpandAnimation"
description: "MazExpandAnimation is a standalone component that allows you to animate the height of a block element"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-expand-animation"
---
# MazExpandAnimation
> MazExpandAnimation is a standalone component that allows you to animate the height of a block element
- Package: `maz-ui`
- Import: `import MazExpandAnimation from 'maz-ui/components/MazExpandAnimation'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-expand-animation
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
Exec animation
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
```
## Options
- **duration**: `String` - default: `300ms` - Duration of the animation in ms
- **timing-function**: `String` - default: `ease-in-out` - Timing function of the animation
```vue
Exec animation
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
```
## MazExpandAnimation API
`import MazExpandAnimation from 'maz-ui/components/MazExpandAnimation'`
### Props
- `duration` (`string`, default: `"300ms"`): Duration of the animation in milliseconds.
- `timing-function` (`string`, default: `"ease-in-out"`): Timing function of the animation.
- `model-value` (`boolean`, `v-model`)
### Events
- `@update:modelValue` (payload: `value: boolean | undefined`)
### Slots
- `#default`: Default Slot - Display content
---
source: https://maz-ui.com/components/maz-fullscreen-loader.md
---
---
title: "MazFullscreenLoader"
description: "MazFullscreenLoader covers the whole page with a backdrop and a spinner to block the interface during a global loading"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-fullscreen-loader"
---
# MazFullscreenLoader
> MazFullscreenLoader covers the whole page with a backdrop and a spinner to block the interface during a global loading
- Package: `maz-ui`
- Import: `import MazFullscreenLoader from 'maz-ui/components/MazFullscreenLoader'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-fullscreen-loader
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
Loading...
(click to hide loader)
Show loader
```
## MazFullscreenLoader API
`import MazFullscreenLoader from 'maz-ui/components/MazFullscreenLoader'`
### Props
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the spinner.
- `size` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``, default: `"3em"`): The size of the spinner.
- `teleport-selector` (`string`, default: `"body"`): The selector to teleport the loader.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-gallery.md
---
---
title: "MazGallery"
description: "MazGallery is a standalone component used to display images in a container and has many options and actions"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-gallery"
---
# MazGallery
> MazGallery is a standalone component used to display images in a container and has many options and actions
- Package: `maz-ui`
- Import: `import MazGallery from 'maz-ui/components/MazGallery'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-gallery
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
```
## Set height by CSS
```html
```
## Types
```ts
type MazGalleryImage
= | {
thumbnail?: string
src: string
alt?: string
}
| string
```
## MazGallery API
`import MazGallery from 'maz-ui/components/MazGallery'`
### Props
- `images` (`MazGalleryImage[]`, default: `[]`): Array of string or object: `['https://via.placeholder.com/500', 'https://via.placeholder.com/600']` or `[{ slug: 'https://via.placeholder.com/500', alt: 'image descripton' }, { slug: 'https://via.placeholder.com/600', alt: 'image descripton' }]`.
- `displayed-count` (`number`, default: `5`): Images count shown (max: 5).
- `remaining` (`boolean`, default: `true`): Remove transparent layer with the remain count (ex: +2).
- `height` (`string | number | false`, default: `"100%"`): Height of gallery - set to `false` to remove default height.
- `width` (`string | number | false`, default: `"100%"`): Width of gallery - set to `false` to remove default width.
- `radius` (`boolean`, default: `true`): Disable the border radius of the gallery.
- `zoom` (`boolean`, default: `true`): Disable full size display when clicking on image.
- `has-empty-layer` (`boolean`, default: `true`): Layer with photography icon when no images is provided.
- `lazy` (`boolean`, default: `true`): Lazy load image - if false, images are directly loaded.
- `blur` (`boolean`, default: `true`): Disable blur effect on image hover.
- `scale` (`boolean`, default: `true`): Disable scale animation effect on image hover.
- `separator-color` (`string`, default: `"transparent"`): Choose color of borders between images - Should be a CSS color or CSS variable - Ex: `#000`.
- `background-color` (`string`): Choose background color of the gallery - Should be a CSS color or CSS variable - Ex: `#000`.
---
source: https://maz-ui.com/components/maz-icon.md
---
---
title: "MazIcon"
description: "A flexible icon component that accepts Vue components, raw SVG strings, URLs and data URIs."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-icon"
---
# MazIcon
> A flexible icon component that accepts Vue components, raw SVG strings, URLs and data URIs.
- Package: `maz-ui`
- Import: `import MazIcon from 'maz-ui/components/MazIcon'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-icon
**Tip:**
Download the bundled icons pack or use [`@maz-ui/icons`](../ecosystem/icons/index.md) for the full set.
## How it works
Pass an `icon` prop in any of the supported formats - the component detects what it received and renders accordingly:
| Input | Example | Use it for |
| --- | --- | --- |
| **Vue component** | `import { MazStar } from '@maz-ui/icons/static/MazStar'` | Always-rendered icons that you also want available as a standalone component (` `). |
| **Raw SVG string** | `import { MazStar } from '@maz-ui/icons/raw/MazStar'` | Always-rendered icons - the lightest format, no Vue component overhead. |
| **URL or `data:` URI** | `'/icons/star.svg'`, `'data:image/svg+xml,…'` | SVGs hosted in your `public/` folder or external CDN. Fetched and cached on demand. |
```vue
```
## Examples
### Raw SVG (recommended)
```vue
```
### URL (fetched at runtime)
Place your SVG file in your `public/` folder, then point `icon` to its path. The component caches the fetched payload and shares it across instances.
```vue
```
### Vue component
```vue
```
## Fallback
When the URL fetch fails, an `error` event is emitted and `MazIcon` switches to the `fallback` prop (same shape as `icon`). If neither resolves, the bundled `MazQuestionMarkCircle` is rendered.
```vue
```
## Sizing
### Predefined sizes (`'xs' | 'sm' | 'md' | 'lg' | 'xl'`)
```vue
```
### Custom size (any CSS length)
Allowed units: `px`, `em`, `rem`, `%`, `vw`, `vh`, `cm`, `mm`, `in`, `pt`, `pc`, `ex`.
```vue
```
## Accessibility
By default `MazIcon` is rendered as decorative (`aria-hidden="true"`, no `role`). Provide an `aria-label` (either on `` or in `svgAttributes`) to expose it to assistive tech - `role="img"` is set automatically and `aria-hidden` is dropped.
```vue
```
## RTL flipping
Set `flip-icon-for-rtl` on directional icons (chevrons, arrows). The icon is mirrored horizontally when the document direction is `rtl` and rendered unchanged otherwise.
```vue
```
## Custom SVG attributes
Inject extra attributes onto the rendered `` (or onto the inlined raw SVG) via `svg-attributes`:
```vue
```
## SSR
Components, raw SVG strings and SVG `data:` URIs (e.g. a small `?url` import inlined by Vite) are always part of the server HTML, without any request.
The server never waits for the network to render a URL icon:
- once the server has the SVG in its cache, it inlines it;
- otherwise, it renders an empty placeholder reserving the icon box and fetches the SVG in the background for the next renders. The client loads the icon in the placeholder.
A relative URL (`/icons/star.svg`, from your `public/` directory) can only be fetched by the server with an absolute base URL, see below.
## Base URL for relative URLs
Prefix every relative URL icon by providing a base URL via Vue's `provide`. An absolute base also lets the server fetch them:
```ts
import { createApp } from 'vue'
const app = createApp(App)
app.provide('mazIconPath', 'https://cdn.your-app.com')
```
In Nuxt, set `mazUi.general.defaultMazIconPath` in `nuxt.config` and `@maz-ui/nuxt` wires the provide for you.
## Forwarding `MazIconProps` from a consumer
Most icon-aware components in maz-ui (`MazBtn`, `MazInput`, `MazLink`, `MazContainer`, `MazDropdown`) accept a flexible icon prop on their `startIcon`, `endIcon`, `icon` or `dropdownIcon` slots. You can pass either a bare value (the same shape as `MazIcon`'s `icon` prop) or a full `MazIconProps` object when you need fine-grained control:
```html
```
The consuming component still derives sensible defaults (e.g. icon size from the button's `size` prop), and the values you set in the props object override those defaults.
## All bundled icons
This pack is the Heroicons set plus a few additions specific to maz-ui.
Source: [Heroicons](https://heroicons.com/) - see also the [icon set page](../ecosystem/icons/icon-set.md).
## MazIcon API
`import MazIcon from 'maz-ui/components/MazIcon'`
### Props
- `icon` (`MazIconValue`): The icon to render. Accepts: - A Vue component (e.g. `import { MazStar } from '@maz-ui/icons/static/MazStar'`) - A URL or `data:` URI to a `.svg` file (`'/icons/star.svg'`, `'data:image/svg+xml,…'`) - A raw SVG string (`'… '`) The component detects the format and renders accordingly.
- `fallback` (`MazIconValue`, default: `MazQuestionMarkCircle`): Fallback icon used when: - `icon` is not provided - `icon` is a URL that fails to load or returns invalid SVG Same shape as `icon`. Defaults to the imported `MazQuestionMarkCircle` if neither `icon` nor `fallback` resolves to anything renderable.
- `size` (`MazIconSize`): Predefined keyword (`'xs' | 'sm' | 'md' | 'lg' | 'xl'`) or any CSS length.
- `title` (`string`): Sets a `` element inside the SVG for screen-reader accessibility.
- `svg-attributes` (`Record`): Extra attributes to merge onto the rendered `` root.
- `flip-icon-for-rtl` (`boolean`, default: `false`): Mirror the icon horizontally when the document direction is RTL. Useful for directional icons (chevrons, arrows). Renders unchanged in LTR.
### Events
- `@error` (payload: `error: Error`): Emitted when an SVG fails to fetch or parse - useful for telemetry / fallback UI.
---
source: https://maz-ui.com/components/maz-input.md
---
---
title: "MazInput"
description: "MazInput is a standalone component that replaces the standard html input text with a beautiful design system. Many options like colors, sizes, disabled, loading, error, warning, valid states, error messages and icons are included."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-input"
---
# MazInput
> MazInput is a standalone component that replaces the standard html input text with a beautiful design system. Many options like colors, sizes, disabled, loading, error, warning, valid states, error messages and icons are included.
- Package: `maz-ui`
- Import: `import MazInput from 'maz-ui/components/MazInput'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-input
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
```
## Top label
```html
```
## Assistive text
```html
```
## Password
```html
```
## Placeholder
```html
```
## Required
```html
```
## Disabled
```html
```
## Hint
> Will replace the label, useful to display short message
```html
```
## Icons
### Use icon name
**Details: View code**
When you use the properties `end-icon`, `start-icon` or `icon` with the icon name (string), the component uses ` ` component.
Check out how [MazIcon](./maz-icon.md) works, see all available icons and download them to put them in your public folder.
```html
```
### Use your own SVG icons
**Details: View code**
```html
```
### Use [vite-svg-loader](https://github.com/jpkleemans/vite-svg-loader)
**Details: View code**
```vue
```
### Pass a full `MazIconProps` object
`startIcon` and `endIcon` also accept a full `MazIconProps` object - pass the same shape `` accepts to override the size, set a `` for screen readers, attach `svgAttributes`, etc.
**Details: View code**
```vue
```
## Auto focus
> Will focus automatically the component
```html
```
## Debounce
> The value emit by the input will be delayed, usefull for searching
>
> The attribute `debounce` is in milliseconds
>
> If the debounce is true, the default debounce delay is 500ms
```html
```
## Sizes
> Use the attribute `size` with a value in
```vue
```
**Note: Zoom on iOS**
iOS zooms the page when a focused field has a font size below `16px` (most sizes with a `14px` `base-font-size`). This applies to every form field: `MazInput` and the components built on it, `MazTextarea`, `MazInputCode`... To prevent it without changing the design of the fields, enable the `general.preventIosInputZoom` option of [@maz-ui/nuxt](../ecosystem/nuxt.md), or call [preventIosInputZoom](../ecosystem/utils/prevent-ios-input-zoom.md) from `@maz-ui/utils` in a Vue app.
## Colors
**Tip:**
Click on each input to show colors
```vue
```
## Rounded Size
Use the attribute `rounded-size` with a value in `'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'`
```html
```
## State
**destructive**
```html
```
**Warning**
```html
```
**Success**
```html
```
## MazInput API
`import MazInput from 'maz-ui/components/MazInput'`
### Props
- `model-value` (`T`, `v-model`): The current value of the input field. This prop is used for two-way data binding with v-model.
- `placeholder` (`string`): Text displayed when the input is empty to guide the user.
- `label` (`string`): Floating label that appears inside the input and moves up when focused or filled. Provides better UX than traditional placeholders.
- `top-label` (`string`): Static label displayed above the input field. Unlike the floating label, this remains fixed.
- `assistive-text` (`string`): Helper text displayed below the input to provide additional context or validation feedback.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Theme color that affects the border and focus states of the input.
- `type` (`InputTypeHTMLAttribute`, default: `"text"`): HTML input type attribute that determines the input behavior and validation. Values: `'text'`, `'password'`, `'email'`, `'number'`, `'tel'`, `'url'`, `'search'`, `'date'`, `'time'`, `'datetime-local'`, `'month'`, `'week'` (non exhaustive).
- `required` (`boolean`, default: `false`): Makes the input field mandatory for form submission.
- `disabled` (`boolean`, default: `false`): Disables the input field, preventing user interaction and form submission.
- `readonly` (`boolean`): Makes the input field read-only, allowing selection but preventing modification.
- `id` (`string`): Unique identifier for the input element, used for form labels and accessibility.
- `error` (`boolean`, default: `false`): Applies error styling (red border and text) to indicate validation failure.
- `success` (`boolean`, default: `false`): Applies success styling (green border and text) to indicate successful validation.
- `warning` (`boolean`, default: `false`): Applies warning styling (orange border and text) to indicate potential issues.
- `hint` (`string`): Alternative text that replaces the label when provided. Useful for contextual hints.
- `input-classes` (`string`): Additional CSS classes to apply specifically to the input wrapper element.
- `border` (`boolean`, default: `true`): Controls whether the input has a visible border. Set to false for borderless inputs.
- `inputmode` (`"none" | "text" | "search" | "email" | "tel" | "url" | "numeric" | "decimal"`, default: `"text"`): HTML inputmode attribute that provides hints for virtual keyboards on mobile devices.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): Controls the height and text size of the input component.
- `debounce` (`number | boolean`, default: `false`): Enables input debouncing to limit the frequency of value updates. When true, uses 500ms delay. When a number, uses that value as delay in milliseconds.
- `auto-focus` (`boolean`, default: `false`): Automatically focuses the input when the component mounts.
- `border-active` (`boolean`, default: `false`): When true, shows the colored border immediately instead of only on focus.
- `start-icon` (`MazIconLike`): Icon displayed on the inline-start edge of the input (left in LTR, right in RTL). Accepts a bare value (Vue component, raw SVG string, URL or `data:` URI) or a full `MazIconProps` object for fine-grained control (size, title, svgAttributes, fallback, …).
- `end-icon` (`MazIconLike`): Icon displayed on the inline-end edge of the input (right in LTR, left in RTL). Accepts a bare value or a full `MazIconProps` object.
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Controls the border radius of the input component. Values: `'none'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'full'` (non exhaustive).
- `block` (`boolean`): Makes the input expand to the full width of its container.
- `name` (`string`): The name of the input field. Used for form submission and validation.
- `autocomplete` (`string`): The autocomplete attribute for the input field. Used for form submission and validation.
- `loading` (`boolean`, default: `false`): Loading state for the input field. Used to show a loading spinner.
### Events
- `@update:model-value` (payload: `value?: T | undefined`): Triggered when the input value changes, used for v-model two-way binding. This event is debounced if the debounce prop is enabled
- `@click` (payload: `event: Event`): Triggered when the user clicks on the input field
- `@blur` (payload: `event: Event`): Triggered when the input field loses focus (user clicks outside or tabs away)
- `@change` (payload: `event: Event`): Triggered when the input value changes and the field loses focus. Different from input event which fires on every keystroke
- `@focus` (payload: `event: Event`): Triggered when the input field gains focus (user clicks or tabs into the field)
- `@input` (payload: `event: Event`): Triggered on every keystroke or input interaction (real-time input changes). This is the raw input event, not debounced
### Slots
- `#start-icon`: Custom content for the inline-start edge of the input field (left in LTR, right in RTL).
- `#end-icon`: Custom content for the inline-end edge of the input field (right in LTR, left in RTL).
- `#loader`: Loader slot.
---
source: https://maz-ui.com/components/maz-input-code.md
---
---
title: "MazInputCode"
description: "This component creates a customizable input code field with features like dynamic code length, alpha character support, and styling based on states (error, success, warning). The code handles input events, keydown actions, and pasting. Overall, it offers a responsive and visually appealing solution for entering verification codes."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-input-code"
---
# MazInputCode
> This component creates a customizable input code field with features like dynamic code length, alpha character support, and styling based on states (error, success, warning). The code handles input events, keydown actions, and pasting. Overall, it offers a responsive and visually appealing solution for entering verification codes.
- Package: `maz-ui`
- Import: `import MazInputCode from 'maz-ui/components/MazInputCode'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-input-code
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
`v-model=""`
```vue
```
## Size
```html
```
## Disabled
```html
```
## MazInputCode API
`import MazInputCode from 'maz-ui/components/MazInputCode'`
### Props
- `model-value` (`T`, `v-model`): The value of the component (v-model).
- `code-length` (`number`, default: `4`): The length of the code.
- `type` (`"number" | "text"`, default: `"text"`): The type of the input field.
- `accept-alpha` (`boolean`, default: `false`): Whether to accept alpha characters.
- `required` (`boolean`, default: `false`): Whether the input is required.
- `disabled` (`boolean`, default: `false`): Whether the input is disabled.
- `error` (`boolean`, default: `false`): Whether there is an error with the input.
- `success` (`boolean`, default: `false`): Whether the input is successful.
- `warning` (`boolean`, default: `false`): Whether there is a warning with the input.
- `size` (`MazInputCodeSize`, default: `"md"`): The size of the component.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the component.
- `hint` (`string`): The hint text to display below the input.
### Events
- `@update:model-value` (payload: `value?: T | undefined`): Update the model value.
- `@completed` (payload: `value: void`): Emitted when all inputs are set.
---
source: https://maz-ui.com/components/maz-input-number.md
---
---
title: "MazInputNumber"
description: "MazInputNumber is a number input component with increment and decrement buttons for user-friendly input. Customizable size, disabled state, and limit values."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-input-number"
---
# MazInputNumber
> MazInputNumber is a number input component with increment and decrement buttons for user-friendly input. Customizable size, disabled state, and limit values.
- Package: `maz-ui`
- Import: `import MazInputNumber from 'maz-ui/components/MazInputNumber'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-input-number
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
```
## No buttons
You can remove the buttons with the props `hide-buttons`
```html
```
## MazInputNumber API
`import MazInputNumber from 'maz-ui/components/MazInputNumber'`
### Props
- `id` (`string`): The id of the input.
- `model-value` (`number`, `v-model`): The value of the component (v-model).
- `disabled` (`boolean`, default: `false`): Whether the input number is disabled or not.
- `max` (`number`, default: `Number.POSITIVE_INFINITY`): The maximum value allowed for the input number.
- `min` (`number`, default: `Number.NEGATIVE_INFINITY`): The minimum value allowed for the input number.
- `step` (`number`, default: `1`): The step value for incrementing or decrementing the input number.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): The size of the input number component.
- `hide-buttons` (`boolean`, default: `false`): Whether to hide the increment and decrement buttons or not.
- `text-center` (`boolean`, default: `true`): Whether to center the text inside the input or not.
- `inputmode` (`"none" | "text" | "search" | "email" | "tel" | "url" | "numeric" | "decimal"`, default: `"numeric"`): The inputmode attribute for the input.
- `block` (`boolean`): The input will be displayed in full width.
- `error` (`boolean`, default: `false`): Will display the input in error state.
- `hint` (`string`): The hint text to display below the input.
- `success` (`boolean`, default: `false`): Will display the input in success state.
- `warning` (`boolean`, default: `false`): Will display the input in warning state.
- `input-props` (`MazInputProps`): The props for the input component.
- `top-label` (`string`): Static label displayed above the input field. Unlike the floating label, this remains fixed.
### Events
- `@update:model-value` (payload: `value?: number | undefined`): Emitted when the input value change
- `@click` (payload: `value: Event`): Emitted input is clicked
- `@blur` (payload: `value: Event`): Emitted when the input is blurred
- `@change` (payload: `value: Event`): Emitted when the value change
- `@focus` (payload: `value: Event`): Emitted when the input is focused
---
source: https://maz-ui.com/components/maz-input-phone-number.md
---
---
title: "MazInputPhoneNumber"
description: "MazInputPhoneNumber is a powerful and user-friendly component that helps users enter and validate phone numbers from any country with automatic formatting and validation"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-input-phone-number"
---
# MazInputPhoneNumber
> MazInputPhoneNumber is a powerful and user-friendly component that helps users enter and validate phone numbers from any country with automatic formatting and validation
- Package: `maz-ui`
- Import: `import MazInputPhoneNumber from 'maz-ui/components/MazInputPhoneNumber'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-input-phone-number
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
**Tip: ✨ What makes this component special?**
- **Smart country detection** - Automatically detects country from browser locale or IP
- **Real-time validation** - Visual feedback as you type
- **Auto-formatting** - Formats numbers according to country standards
- **Search countries** - Find countries quickly in the dropdown
- **Customizable** - Full control over appearance and behavior
- **Accessible** - Keyboard navigation and screen reader support
- **International** - Supports all countries and phone formats
## Basic Usage
The simplest way to use MazInputPhoneNumber - just add it and it works!
```vue
```
## Country Management
Control which countries appear in the dropdown and their order.
```vue
```
## Layout Orientations
Choose how the country selector and phone input are arranged.
```vue
```
## Display Options
Customize what information is shown to users.
```vue
```
### Flags source
By default, the flags come from the [flagcdn.com](https://flagcdn.com) CDN. The `flag-src` prop, passed to the country selector, takes:
- `loadCountryFlag` from `maz-ui/country-flags`: the flags of `@maz-ui/icons`, without any request to a third party, offline (hybrid apps with Capacitor or Cordova, PWAs);
- a URL template of your own files: `'/flags/{code}.svg'` (`{CODE}` for uppercase codes);
- your own function: `(code) => string | undefined | Promise`.
Each flag is loaded only when visible, and a code without flag displays a badge. Set it once for the whole app with `defaults.global.flagSrc` of the MazUi plugin, or `mazUi.flags` of the Nuxt module (`'local'` or a URL template):
```ts
import { loadCountryFlag } from 'maz-ui/country-flags'
app.use(MazUi, { theme: { preset: mazUi }, defaults: { global: { flagSrc: loadCountryFlag } } })
```
See [MazSelectCountry](./maz-select-country.md#flags-source) for the details (bundle, Content Security Policy, PWA precache).
## Smart Country Detection
Let the component automatically detect the user's country.
```vue
```
## Phone Number Formatting
Control how phone numbers are automatically formatted as users type.
```vue
```
## Validation States
Control the visual validation feedback and success/error indicators.
```vue
```
## Internationalization
Make the component speak your users' language.
```vue
```
## Custom Flag Styling
Replace the default flag emojis with your own design.
```vue
{{ countryCode }}
{{ countryCode }}
{{ countryCode?.charAt(0) }}
{{ countryCode?.charAt(0) }}
```
## Advanced Configuration
Fine-tune the component for specific use cases.
```vue
```
## Real-world Examples
See how to use the component in common scenarios.
```vue
Create Account
```
## Data Handling
Understanding what data the component provides.
```vue
```
## Troubleshooting
Common issues and solutions:
### ⚠️ Auto-formatting Issues
For countries like Anguilla (AI) with multiple valid number lengths, disable auto-formatting:
```vue
```
### 🌐 Country Detection Not Working
Make sure to enable the right detection method:
```vue
```
## Types
**Results object emitted by `@data` event:**
```ts
interface MazInputPhoneNumberData {
isValid: boolean
isPossible?: boolean
countryCode?: CountryCode
countryCallingCode?: CountryCallingCode
nationalNumber?: NationalNumber
type?: NumberType
formatInternational?: string
formatNational?: string
uri?: string
e164?: string
rfc3966?: string
possibleCountries?: CountryCode[]
phoneNumber?: string
}
```
## MazInputPhoneNumber API
`import MazInputPhoneNumber from 'maz-ui/components/MazInputPhoneNumber'`
### Props
- `model-value` (`string | null`, `v-model`): The current value of the input field in international format (e.g. +33612345678).
- `country-code` (`CountryCode | null`, `v-model:country-code`): The selected country code (e.g. "FR").
- `id` (`string`): Unique identifier for the component.
- `placeholder` (`string`): Text displayed when the input is empty.
- `top-label` (`string`): Static label displayed above the input field. Unlike the floating label, this remains fixed.
- `label` (`string`): Label displayed above the input.
- `preferred-countries` (`CountryCode[]`): List of country codes to place first in the select list.
- `ignored-countries` (`CountryCode[]`): List of country codes to be removed from the select list.
- `only-countries` (`CountryCode[]`): List of country codes to only have the countries selected in the select list.
- `translations` (`Partial<{ countrySelect: { placeholder: string; error: string; searchPlaceholder: string; }; phoneInput: { placeholder: string; example: string; }; }>`, default: `{ countrySelect: { error: 'Choose country', placeholder: 'Country code', searchPlaceholder: 'Search the country', }, phoneInput: { placeholder: 'Phone number', example: 'Example: {example}', }, }`): Locale strings of the component The default values are the translations of the MazUiTranslations plugin.
- `list-position` (`MazPopoverPosition`, default: `"bottom-start"`): Position where the list of countries will be opened. Values: `'top'`, `'left'`, `'right'`, `'bottom'` (non exhaustive).
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Component color applied.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `"md"`): Component size applied.
- `hide-flags` (`boolean`, default: `false`): Remove flags in country list.
- `flag-src` (`MazCountryFlagSrc`, default: `undefined (flags from flagcdn.com)`): Source of the flags, instead of the flagcdn.com CDN: a URL template (`/flags/{code}.svg`, `{CODE}` for uppercase) or a function giving the image source of a code. Use `loadCountryFlag` from `maz-ui/country-flags` for the flags of `@maz-ui/icons`. Can be set for the whole app with the `defaults.global.flagSrc` option of the MazUi plugin.
- `disabled` (`boolean`, default: `false`): Make the input disabled.
- `required` (`boolean`, default: `false`): Make the input required.
- `example` (`boolean`, default: `true`): Show the phone number example.
- `search` (`boolean`, default: `true`): Disable search input in country list.
- `search-threshold` (`number`, default: `0.75`): Threshold of the search input in country list where 1 is a perfect match and 0 is a match with any character.
- `use-browser-locale` (`boolean`, default: `true`): If true, the browser locale will be used.
- `fetch-country` (`boolean`, default: `false`): The component will make a request (https://ipwho.is) to get the location of the user and use it to set the default country code.
- `hide-country-select` (`boolean`, default: `false`): Hide the country selector.
- `show-code-in-list` (`boolean`, default: `false`): Show country calling code in the country list.
- `custom-countries-list` (`Record`): Replace country names.
- `auto-format` (`false | "disabled" | "blur" | "typing"`, default: `"blur"`): Disabled auto-format when phone is valid.
- `country-locale` (`string`): Locale of country list.
- `validation-error` (`boolean`, default: `true`): Disable validation error UI.
- `validation-success` (`boolean`, default: `true`): Disable validation success UI.
- `success` (`boolean`, default: `false`): Add success UI.
- `error` (`boolean`, default: `false`): Add error UI.
- `warning` (`boolean`, default: `false`): Add warning UI.
- `display-country-name` (`boolean`, default: `false`): Will replace the calling code by the country name in the country selector.
- `block` (`boolean`, default: `false`): The input will be displayed in full width.
- `orientation` (`"row" | "col" | "responsive"`, default: `"responsive"`): Orientation of the inputs in the component.
- `country-select-attributes` (`Record`, default: `{ name: "country", autocomplete: "off", style: { width: "14rem", }, }`): Meta attributes of the country input.
- `phone-input-attributes` (`(Record & { name: string; inputmode: "none" | "text" | "search" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined; autocomplete: string; })`, default: `{ name: "phone", autocomplete: "tel", inputmode: "tel", }`): Meta attributes of the phone number input.
- `assistive-text` (`string`): Helper text displayed below the input to provide additional context or validation feedback.
- `hint` (`string`): Alternative text that replaces the label when provided. Useful for contextual hints.
### Events
- `@update:model-value` (payload: `value: string | null | undefined`): Emitted when country or phone number changes
- `@data` (payload: `results: MazInputPhoneNumberData`): Emitted when country or phone number changes
- `@country-code` (payload: `countryCode?: CountryCode | null | undefined`): Emitted when selected country changes
- `@update:country-code` (payload: `countryCode?: CountryCode | null | undefined`): Emitted when country changes
### Slots
- `#no-results`: Replace the "no results" icon in the country selector list
- `#selector-flag`: Country selector flag Bindings: `countryCode: CountryCode` (current selected country code Ex: `"FR"`).
- `#country-list-flag`: Country list flag Bindings: `countryCode: CountryCode` (country code of option Ex: `"FR"`), `option: CountryOption` (country data), `isSelected: boolean` (`true` if option is selected).
---
source: https://maz-ui.com/components/maz-input-price.md
---
---
title: "MazInputPrice"
description: "MazInputPrice is a standalone component that replaces the standard html input text and formats the text enter according to the currency provided"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-input-price"
---
# MazInputPrice
> MazInputPrice is a standalone component that replaces the standard html input text and formats the text enter according to the currency provided
- Package: `maz-ui`
- Import: `import MazInputPrice from 'maz-ui/components/MazInputPrice'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-input-price
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
```
## MazInputPrice API
`import MazInputPrice from 'maz-ui/components/MazInputPrice'`
### Props
- `model-value` (`number`, `v-model`): The value of the input.
- `currency` (`string`, default: `"EUR"`): The currency to use.
- `locale` (`string`, default: `"fr-FR"`): The locale to use.
- `min` (`number`, default: `Number.NEGATIVE_INFINITY`): The minimum value that the input can accept.
- `max` (`number`, default: `Number.POSITIVE_INFINITY`): The maximum value that the input can accept.
- `no-icon` (`boolean`, default: `false`): The input will be displayed without icon.
- `block` (`boolean`): The input will be displayed in full width.
- `error` (`boolean`): Will display the input in error state.
- `hint` (`string`): The hint text to display below the input.
- `success` (`boolean`): Will display the input in success state.
- `warning` (`boolean`): Will display the input in warning state.
- `currency-options` (`Omit`): Options for the currency helper - [see](../ecosystem/utils/currency.md).
### Events
- `@update:model-value` (payload: `value: number | undefined`)
- `@blur` (payload: `value: Event`)
- `@focus` (payload: `value: Event`)
- `@input` (payload: `value: number | undefined`)
- `@formatted` (payload: `value: string | undefined`)
---
source: https://maz-ui.com/components/maz-input-tags.md
---
---
title: "MazInputTags"
description: "MazInputTags is a standalone component like free inputs to help user select many values and return an Array of strings. Color options are also available."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-input-tags"
---
# MazInputTags
> MazInputTags is a standalone component like free inputs to help user select many values and return an Array of strings. Color options are also available.
- Package: `maz-ui`
- Import: `import MazInputTags from 'maz-ui/components/MazInputTags'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-input-tags
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
**Returned value**
```vue
```
## Sizing
```vue
```
```vue
```
## MazInputTags API
`import MazInputTags from 'maz-ui/components/MazInputTags'`
### Props
- `model-value` (`(string | number)[]`, `v-model`): The modelValue of the input.
- `placeholder` (`string`): The placeholder of the input.
- `label` (`string`): The label of the input.
- `disabled` (`boolean`, default: `false`): Disable the input.
- `error` (`boolean`, default: `false`): Display the input with error style.
- `success` (`boolean`, default: `false`): Display the input with success style.
- `warning` (`boolean`, default: `false`): Display the input with warning style.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): The size of the input.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the input.
- `block` (`boolean`): The input will be displayed in full width.
- `add-tags-on-blur` (`boolean`, default: `true`): Add tags on blur.
- `hint` (`string`): The hint text to display below the input.
### Events
- `@update:model-value` (payload: `value?: (string | number)[] | undefined`)
---
source: https://maz-ui.com/components/maz-lazy-img.md
---
---
title: "MazLazyImg"
description: "MazLazyImg is a standalone component to display images and svgs with lazy loading"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-lazy-img"
---
# MazLazyImg
> MazLazyImg is a standalone component to display images and svgs with lazy loading
- Package: `maz-ui`
- Import: `import MazLazyImg from 'maz-ui/components/MazLazyImg'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-lazy-img
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
```vue
```
**Tip: Performance**
`MazLazyImg` relies on the [`vLazyImg`](../directives/lazy-img.md) directive, whose `IntersectionObserver`s are pooled and shared across every instance - rendering many images (galleries, lists, avatars) stays cheap.
## Responsive sources
Pass an object with `sources` to serve different images depending on the media query (like a native ``).
```vue
```
## Image height full
By default the image is displayed with `width: 100%`. Enable `image-height-full` to fill the **height** instead: the image keeps its aspect ratio, fills 100% of the height and overflows/crops horizontally. Handy for wide images or SVGs inside a fixed-height container.
```vue
```
## Fallback on error
Provide `fallback-src` to swap the image when it fails to load.
```vue
```
## Without loader
Hide the spinner shown while the image is loading with `hide-loader`.
```vue
```
## MazLazyImg API
`import MazLazyImg from 'maz-ui/components/MazLazyImg'`
### Props
- `src` (`MazImage | null`): The source of the image.
- `alt` (`string`): The alt of the image.
- `hide-loader` (`boolean`): Remove the loader.
- `observer-once` (`boolean`, default: `true`): Remove the observer once the image is loaded.
- `load-once` (`boolean`): Remove the observer once the image is loaded.
- `image-height-full` (`boolean`): Make the image height full.
- `observer-options` (`{ root?: HTMLElement | null | undefined; threshold: number; rootMargin?: string | undefined; }`): The options of the observer.
- `fallback-src` (`string`): The fallback src to replace the src on loading error.
- `img-class` (`ClassValue`): The classes of the image element.
- `block` (`boolean`): The image will be displayed in full width.
### Events
- `@loading` (payload: `el: Element`): Emitted when the image is loading
- `@intersecting` (payload: `el: Element`): Emitted when the image is intersecting
- `@loaded` (payload: `el: Element`): Emitted when the image is loaded
- `@error` (payload: `el: Element`): Emitted when the image is in error
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-link.md
---
---
title: "MazLink"
description: "MazLink is a standalone component to create links and buttons."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-link"
---
# MazLink
> MazLink is a standalone component to create links and buttons.
- Package: `maz-ui`
- Import: `import MazLink from 'maz-ui/components/MazLink'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-link
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
View product detail
```
## Color
```html
View product detail (primary)
View product detail (secondary)
View product detail (info)
View product detail (success)
View product detail (warning)
View product detail (destructive)
View product detail (accent)
View product detail (contrast)
View product detail (surface)
View product detail (muted)
```
## RouterLink
When you use the `to` prop, the component will be a `router-link` and will use the `router` to navigate.
```html
View product detail
```
## Icons
You can add an icon on the left and right to the link text with the `start-icon` and `end-icon` props.
For more information about the icons, please check the [MazBtn](./maz-btn.md#icons) page.
```vue
View product detail
View product detail
```
`startIcon` and `endIcon` also accept a full `MazIconProps` object - pass the same shape `` accepts to override the icon size, add a `` for screen readers, etc.
```vue
Read more
```
## External icon (true by default)
When you use the `autoExternal` prop, the component will have an external icon if the link has the target `_blank`.
```html
View product detail
```
## As button
If no `to` or `href` is provided, the component will be a `button` by default. You can force the component to be a `button`, `a`, `router-link` or `nuxt-link` with the `as` prop.
```vue
View product detail
View product detail
```
## MazLink API
`import MazLink from 'maz-ui/components/MazLink'`
### Props
- `as` (`string`, default: `depends on the provided props`): The component to use for the link - if not provided, it will be `router-link` or `nuxt-link` if `to` is provided, will be `a` if `href` is provided, otherwise it will be `button`, you can force the component to be used with `as` prop. Values: `'router-link'`, `'nuxt-link'`, `'button'` (non exhaustive).
- `id` (`string`): The id of the link.
- `title` (`string`): The title of the link.
- `href` (`string`): The href of the link.
- `to` (`string | et | X`): The route location (router-link) of the link.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent" | "muted" | "surface" | "inherit"`, default: `"primary"`): The color of the link.
- `target` (`string`, default: `"_self"`): The target of the link. Values: `'_blank'`, `'_self'`, `'_parent'`, `'_top'` (non exhaustive).
- `download` (`string`): The download of the link.
- `rel` (`string`): The rel of the link.
- `aria-label` (`string`): The aria-label of the link.
- `underline` (`boolean`, default: `false`): Add an underline to the link.
- `underline-hover` (`boolean`, default: `true`): Add an underline only on hover.
- `auto-external` (`boolean`, default: `true`): Add an external icon to the link if target is '_blank'.
- `start-icon` (`MazIconLike`): Icon displayed on the inline-start edge (left in LTR, right in RTL). Accepts a bare value (Vue component, raw SVG string, URL or `data:` URI) or a full `MazIconProps` object for fine-grained control.
- `end-icon` (`MazIconLike`): Icon displayed on the inline-end edge (right in LTR, left in RTL). Accepts a bare value or a full `MazIconProps` object.
- `disabled` (`boolean`, default: `false`): The disabled state of the link if the component is a button.
### Slots
- `#start-icon`: The icon to display on the inline-start edge of the text (left in LTR, right in RTL)
- `#default`: Text of the link
- `#end-icon`: The icon to display on the inline-end edge of the text (right in LTR, left in RTL)
- `#external-icon`: Replace the default external icon
---
source: https://maz-ui.com/components/maz-loading-bar.md
---
---
title: "MazLoadingBar"
description: "MazLoadingBar is an indeterminate progress bar to show that something is loading, typically at the top of a page or a container"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-loading-bar"
---
# MazLoadingBar
> MazLoadingBar is an indeterminate progress bar to show that something is loading, typically at the top of a page or a container
- Package: `maz-ui`
- Import: `import MazLoadingBar from 'maz-ui/components/MazLoadingBar'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-loading-bar
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
```
## MazLoadingBar API
`import MazLoadingBar from 'maz-ui/components/MazLoadingBar'`
### Props
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the component.
- `height` (`string`): The height of the component.
---
source: https://maz-ui.com/components/maz-markdown-editor.md
---
---
title: "MazMarkdownEditor"
description: "MazMarkdownEditor is a GitHub-style markdown editor with Write/Preview/Split tabs, a configurable formatting toolbar, optional line numbers, and a sanitized preview. It shares the same states, labels and theming as MazTextarea, is SSR-friendly, and supports custom renderers."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-markdown-editor"
---
# MazMarkdownEditor
> MazMarkdownEditor is a GitHub-style markdown editor with Write/Preview/Split tabs, a configurable formatting toolbar, optional line numbers, and a sanitized preview. It shares the same states, labels and theming as MazTextarea, is SSR-friendly, and supports custom renderers.
- Package: `maz-ui`
- Import: `import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-markdown-editor
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Installation requirement
The preview relies on [`marked`](https://marked.js.org) for parsing and [`dompurify`](https://github.com/cure53/DOMPurify) for sanitization. Both are loaded lazily (only when the preview is rendered), so install them in your project:
```bash [pnpm]
pnpm add marked dompurify
```
```bash [npm]
npm install marked dompurify
```
```bash [yarn]
yarn add marked dompurify
```
If they are not installed, the preview falls back to a safe, escaped plain-text block. You can also provide your own renderer with the `renderFunction` prop to avoid these dependencies entirely.
## Basic usage
The component exposes a `v-model` bound to the raw markdown string and two tabs: **Write** (textarea) and **Preview** (rendered, sanitized HTML).
```vue
```
## Toolbar
The formatting toolbar is opt-in. Set `toolbar` to `true` to display the full toolbar. Buttons act on the current textarea selection and preserve the native undo/redo history (`Cmd/Ctrl + Z`).
```vue
```
### Available actions
The full toolbar exposes the following action keys:
| Key | Result |
| --- | --- |
| `heading` | Heading dropdown (`#`, `##`, `###`) |
| `bold` | `**bold**` |
| `italic` | `_italic_` |
| `strikethrough` | `~~strikethrough~~` |
| `quote` | `> quote` |
| `code` | `` `inline code` `` |
| `codeBlock` | fenced ` ``` ` code block |
| `link` | `[text](url)` |
| `image` | `` |
| `bulletList` | `- item` |
| `orderedList` | `1. item` |
| `checkList` | `- [ ] task` |
| `table` | markdown table skeleton |
### Configure the toolbar
Pass an **ordered array of action keys** to display only a subset (and control their order):
```vue
```
## Keyboard shortcuts
Classic markdown shortcuts are enabled by default and work whenever the textarea is focused. They preserve the native undo/redo history. The toolbar buttons also display their shortcut in the tooltip. Use `mod` for `Cmd` on macOS and `Ctrl` elsewhere.
| Shortcut | Action |
| --- | --- |
| `mod + B` | Bold |
| `mod + I` | Italic |
| `mod + Shift + X` | Strikethrough |
| `mod + K` | Link |
| `mod + E` | Inline code |
| `mod + Shift + E` | Code block |
| `mod + Shift + .` | Quote |
| `mod + Shift + 8` | Bulleted list |
| `mod + Shift + 7` | Numbered list |
| `mod + Shift + L` | Task list |
| `mod + Alt + 1/2/3` | Heading 1/2/3 |
Disable them with `:shortcuts="false"`:
```vue
```
**Tip:**
Image and table insertions have no default shortcut (to avoid clashing with browser shortcuts). Use the toolbar buttons or the `toolbar` slot helpers for those.
## List continuation
Pressing Enter inside a list automatically inserts the next marker, just like a desktop markdown editor:
- Bulleted lists (`-`, `*`, `+`) repeat the marker.
- Numbered lists increment the index (`1.` → `2.`).
- Task lists insert a fresh unchecked box (`- [ ] `).
- Indentation is preserved.
Pressing Enter again on an empty item removes the marker and exits the list. This works out of the box, no configuration required.
## Label & assistive text
Like `MazTextarea`, the editor supports a static `top-label` (or `label`), the `required` asterisk and an `assistive-text` displayed below the editor.
```vue
```
## States
Use `error`, `success`, `warning`, `disabled` and `readonly` to reflect validation states, consistent with the other form components.
```vue
```
## Split mode
A third tab displays the editor and the preview side by side. Switch to it from the toolbar tabs, or control it with `v-model:mode` (`'write' | 'preview' | 'split'`). On small screens the two panes stack vertically.
```vue
```
## Line numbers
Enable the `line-numbers` prop to display a gutter on the left of the editor. Numbers reflect logical lines and stay in sync with the textarea scroll.
```vue
```
## Custom renderer
Provide a `render-function` to use your own markdown engine (e.g. `markdown-it`, a Nuxt Content renderer, or a server-side pipeline). It receives the raw markdown and returns an HTML string (sync or async). The result is still sanitized when `sanitize` is enabled.
```vue
```
## Sanitization
By default, the rendered HTML is sanitized with DOMPurify to prevent XSS. Disabling it (`:sanitize="false"`) renders the raw output of the renderer; only do this when the markdown source is fully trusted.
```vue
```
## Controlled mode
The active tab is available through `v-model:mode` (`'write' | 'preview' | 'split'`).
```vue
Current tab: {{ mode }}
```
## Custom translations
The tab labels, the empty-preview text and the toolbar button labels come from the `@maz-ui/translations` package (`markdownEditor.*`). You can override any key per-instance with the `translations` prop without touching the global locale:
```vue
```
For app-wide translations, set up the [maz-ui translations plugin](../ecosystem/translations.md) and the component will pick up your locale automatically.
## Accessibility
The write / preview / split switcher follows the [WAI-ARIA tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/): it is a `tablist` named by the `name` prop, the editor and the preview are its `tabpanel`s. Only the selected mode is in the tab sequence, ← / → (reversed in RTL), Home and End switch the mode.
## MazMarkdownEditor API
`import MazMarkdownEditor from 'maz-ui/components/MazMarkdownEditor'`
### Props
- `model-value` (`string`, `v-model`): The markdown value of the editor.
- `id` (`string`): The id of the textarea.
- `name` (`string`, default: `"MazMarkdownEditor"`): The name of the textarea.
- `label` (`string`): Static label displayed above the editor.
- `placeholder` (`string`): The placeholder of the textarea.
- `required` (`boolean`, default: `false`): If the editor is required.
- `disabled` (`boolean`, default: `false`): If the editor is disabled.
- `readonly` (`boolean`, default: `false`): If the editor is readonly.
- `error` (`boolean`, default: `false`): If the editor has an error.
- `success` (`boolean`, default: `false`): If the editor has a success.
- `warning` (`boolean`, default: `false`): If the editor has a warning.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the editor.
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Size radius of the component's border.
- `top-label` (`string`): Static label displayed above the editor. Unlike a floating label, this remains fixed.
- `assistive-text` (`string`): Helper text displayed below the editor to provide additional context or validation feedback.
- `toolbar` (`boolean | MazMarkdownEditorToolbarAction[]`, default: `false`): Show the formatting toolbar. Pass `true` for the full toolbar, or an ordered array of action keys to display only a subset (and control their order).
- `line-numbers` (`boolean`, default: `false`): Display line numbers in a gutter on the left of the editor.
- `shortcuts` (`boolean`, default: `true`): Enable keyboard shortcuts for the toolbar actions (e.g. Cmd/Ctrl+B for bold).
- `sanitize` (`boolean`, default: `true`): Sanitize the rendered preview HTML with DOMPurify.
- `render-function` (`((markdown: string) => string | Promise)`): Custom markdown renderer. Receives the raw markdown and returns an HTML string (sync or async). Falls back to `marked` when omitted. The result is still sanitized when `sanitize` is enabled.
- `marked-options` (`Record`): Options forwarded to `marked` when using the default renderer.
- `rows` (`number`, default: `6`): Minimum number of visible rows of the editor textarea.
- `translations` (`{ write?: string | undefined; preview?: string | undefined; split?: string | undefined; emptyPreview?: string | undefined; toolbar?: { heading?: string | undefined; bold?: string | undefined; italic?: string | undefined; strikethrough?: ...`): Custom translations for the component. Override any key independently.
- `mode` (`MazMarkdownEditorMode`, default: `"write"`, `v-model:mode`)
### Events
- `@update:model-value` (payload: `value?: string | undefined`): Emitted when the markdown value changes
- `@blur` (payload: `value: FocusEvent`): Emitted when the textarea is blurred
- `@change` (payload: `value: Event`): Emitted when the textarea value changes
- `@focus` (payload: `value: FocusEvent`): Emitted when the textarea is focused
- `@input` (payload: `value?: string | undefined`): Emitted when the markdown value changes
- `@update:mode` (payload: `value: MazMarkdownEditorMode`)
### Slots
- `#label`: Replace the static label above the editor
- `#toolbar`: Replace the toolbar content (only rendered when the toolbar is enabled and not in preview mode) Bindings: `mode: MazMarkdownEditorMode` (The current editor mode), `wrapSelection: (before: string, after?: string) => void` (Wrap the current selection with the given markers), `prefixLines: (prefix: string) => void` (Prefix every selected line with the given string), `applyHeading: (level: number) => void` (Apply a heading of the given level to the selected lines), `insertLink: () => void` (Insert a markdown link at the selection), `insertImage: () => void` (Insert a markdown image at the selection), `insertCodeBlock: () => void` (Insert a fenced code block at the selection), `insertTable: () => void` (Insert a markdown table at the selection).
- `#empty-preview`: Content displayed in the preview pane when there is nothing to render
### Exposed (template ref)
- `textarea`: The underlying textarea element
- `renderPreview`: Programmatically re-render the markdown preview
- `focus`: Focus the editor textarea
---
source: https://maz-ui.com/components/maz-pagination.md
---
---
title: "MazPagination"
description: "MazPagination lets users navigate between the pages of a list or a table, with first, previous, next and last buttons and the current page in v-model"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-pagination"
---
# MazPagination
> MazPagination lets users navigate between the pages of a list or a table, with first, previous, next and last buttons and the current page in v-model
- Package: `maz-ui`
- Import: `import MazPagination from 'maz-ui/components/MazPagination'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-pagination
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
## Basic usage
`v-model=""`
```vue
```
## Sizes
```html
```
## Colors
## MazPagination API
`import MazPagination from 'maz-ui/components/MazPagination'`
### Props
- `model-value` (`number`, default: `1`, `v-model`): The current page number.
- `button-props` (`Partial`): Props apply to the MazBtn components.
- `active-color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent" | "surface"`, default: `"surface"`): Color of the active button.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): Size of the buttons.
- `total-pages` (`number`, required, default: `10`): Total number of pages.
- `page-range` (`number`, default: `1`): Number of buttons to display before and after the current page.
- `loading` (`boolean`, default: `false`): Enable loading state of current button.
### Events
- `@update:model-value` (payload: `value: number`)
### Slots
- `#first-page-sr`: Accessible text for screen reader of the previous page button Bindings: `page: number` (first page number).
- `#previous-page-sr`: Accessible text for screen reader of the first page button Bindings: `page: number` (previous page number).
- `#page-sr`: Accessible text for screen reader of the current page button Bindings: `page: number` (current page number).
- `#next-page-sr`: Accessible text for screen reader of the next page button Bindings: `page: number` (next page number).
- `#last-page-sr`: Accessible text for screen reader of the last page button Bindings: `page: number` (last page number).
---
source: https://maz-ui.com/components/maz-popover.md
---
---
title: "MazPopover"
description: "MazPopover is a versatile Vue component for displaying content in overlays that bypass overflow constraints of parent elements"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-popover"
---
# MazPopover
> MazPopover is a versatile Vue component for displaying content in overlays that bypass overflow constraints of parent elements
- Package: `maz-ui`
- Import: `import MazPopover from 'maz-ui/components/MazPopover'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-popover
## Basic usage
```vue
Click me
Popover Content
This is the content inside the popover.
Hover me
This popover appears on hover!
```
## Adaptive trigger
The `adaptive` trigger mode automatically adapts to the user's device:
- **Desktop**: Uses hover behavior (mouseenter/mouseleave)
- **Mobile/Touch devices**: Uses click behavior
This provides the best user experience across all devices without requiring manual configuration.
```vue
Adaptive Trigger
Smart Behavior
On desktop: Hover to open, move away to close
On mobile: Tap to open, tap outside to close
Adaptive Menu
Perfect for dropdown menus that work on all devices
Menu Item 1
Menu Item 2
```
## Positions
**Tip:**
The position prop is used to position the popover relative to the trigger. The chosen position will force the popover to be displayed in the chosen position.
```vue
Top
Bottom
Bottom positioned popover
Left
Right
```
## Advanced positions
```vue
Top Start
Top End
Bottom Start
Bottom End
Left Start
Left End
Right Start
Right End
Auto Position
Automatically positioned based on available space
```
## Prefer position and fallback position
**Tip:**
The prefer-position and fallback-position props are used to position the popover relative to the trigger. The prefer-position is the position that will be used if it's available, and the fallback-position is the position that will be used if the prefer-position is not available.
When you not specify a fallback position, the popover will fallback on the best position available.
```html
Prefer position and fallback position
This popover will prefer the top position, but if it's not available, it will fallback to the bottom position.
```
## Colors
```vue
Background
This popover has a default color!
Primary
This popover has a primary color!
Secondary
This popover has a secondary color!
Accent
This popover has a accent color!
Contrast
This popover has a contrast color!
Success
This popover has a success color!
Info
This popover has a info color!
Destructive
This popover has a destructive color!
Warning
This popover has a warning color!
```
## Tooltip role
A directive is available to more easily add a tooltip to an element, see [vTooltip](../directives/tooltip.md) for more information.
```vue
Hover for tooltip
This is a tooltip with proper ARIA attributes
Hover this text
This tooltip has a 1000ms delay before showing
```
## Controlled popover
```vue
Controlled Trigger
Controlled Popover
This popover is controlled externally.
Close
{{ isOpen ? 'Close' : 'Open' }} Popover
Popover is {{ isOpen ? 'open' : 'closed' }}
{{ isOpen ? 'Close' : 'Open' }} Popover
```
## Menu example
```vue
Settings
{{ item.label }}
Edit
Share
Delete
```
## Keep open on hover
> With this option, the popover will stay open when you hover over it (a timeout is used to close the popover after a certain time).
```vue
Keep open on hover
Edit
Share
Delete
```
## Form example
```vue
Add Item
```
## Configuration options
```vue
Persistent Popover
This popover won't close on click outside or ESC.
Close manually
Large Offset
Styled Popover
Beautiful gradient background!
Disabled Popover
```
## Events
```vue
Event Example
Check the console for events!
```
## Position values
- `auto` - Automatically choose best position
- `top`, `bottom`, `left`, `right` - Basic positions
- `top-start`, `top-end` - Top with start/end alignment
- `bottom-start`, `bottom-end` - Bottom with start/end alignment
- `left-start`, `left-end` - Left with start/end alignment
- `right-start`, `right-end` - Right with start/end alignment
## Accessibility
MazPopover follows WAI-ARIA guidelines:
- **Focus management**: Automatically manages focus when opening/closing
- **Keyboard navigation**: Supports Escape key and Tab navigation
- **ARIA attributes**: Proper `role`, `aria-modal`, `aria-labelledby`, etc.
- **Screen reader support**: Appropriate roles for different use cases
- **Trigger ARIA on the real control**: `aria-expanded`, `aria-haspopup` and `aria-controls` are set on the interactive element of the `trigger` slot (your button, link...), never on a wrapper around it. ARIA attributes you set yourself on that element are kept, and a `combobox` keeps managing its own state. When the slot has no interactive element, the wrapper becomes a focusable `button` (Enter / Space toggle the popover).
### Best practices
- Use `role="tooltip"` for simple informational overlays
- Use `role="dialog"` for interactive content
- Provide meaningful `aria-labelledby` or `aria-describedby` attributes
- Ensure trigger elements are focusable and have proper labels
## MazPopover API
`import MazPopover from 'maz-ui/components/MazPopover'`
### Props
- `model-value` (`boolean`, default: `false`, `v-model`): Controls the popover open state.
- `position` (`MazPopoverPosition`, default: `"auto"`): Position of the popover relative to trigger - Position of the popover relative to trigger. Values: `'auto'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-start'`, `'top-end'`, `'bottom-start'`, `'bottom-end'`, `'left-start'`, `'left-end'`, `'right-start'`, `'right-end'` (non exhaustive).
- `prefer-position` (`MazPopoverPreferPosition`, default: `'bottom-start'`): Preferred position of the popover relative to trigger when auto position is used - Preferred position of the popover relative to trigger. Values: `'auto'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-start'`, `'top-end'`, `'bottom-start'`, `'bottom-end'`, `'left-start'`, `'left-end'`, `'right-start'`, `'right-end'` (non exhaustive).
- `fallback-position` (`MazPopoverFallbackPosition`, default: `auto`): Fallback position of the popover relative to trigger when prefer position is not visible - Fallback position of the popover relative to trigger. Values: `'auto'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-start'`, `'top-end'`, `'bottom-start'`, `'bottom-end'`, `'left-start'`, `'left-end'`, `'right-start'`, `'right-end'` (non exhaustive).
- `trigger` (`MazPopoverTrigger`, default: `"click"`): How the popover is triggered - How the popover is triggered. 'adaptive' uses hover on desktop and click on mobile. Values: `'click'`, `'hover'`, `'manual'`, `'adaptive'` (non exhaustive).
- `role` (`MazPopoverRole`, default: `"dialog"`): ARIA role for accessibility - ARIA role for accessibility. Values: `'dialog'`, `'tooltip'` (non exhaustive).
- `aria-label` (`string`): ARIA label for the popover.
- `announce-changes` (`boolean`, default: `false`): Announce content changes to screen readers.
- `disabled` (`boolean`, default: `false`): Disables the popover - Disables the popover.
- `offset` (`number`, default: `8`): Distance between trigger and popover in pixels.
- `delay` (`number`, default: `0`): Delay before showing/hiding in milliseconds.
- `hover-delay` (`number`, default: `150`): Delay before closing on hover in milliseconds.
- `transition` (`string`, default: `"scale-pop"`): CSS transition name for animations - 'scale-pop' | 'scale-fade' for default transitions. 'scale-pop' is a pop effect, 'scale-fade' is a fade effect. Values: `'scale-pop'`, `'scale-fade'`, `'string'` (non exhaustive).
- `teleport-to` (`string`, default: `"body"`): Teleport target selector.
- `overlay-class` (`ClassValue`): Additional CSS classes for the overlay wrapper.
- `panel-class` (`ClassValue`): Additional CSS classes for the popover panel.
- `panel-style` (`StyleValue`): Inline styles for the popover panel.
- `close-on-click-outside` (`boolean`, default: `true`): Close popover when clicking outside.
- `close-on-escape` (`boolean`, default: `true`): Close popover when pressing Escape key.
- `persistent` (`boolean`, default: `false`): Prevent auto-close (ignores click outside and escape key).
- `id` (`string`): Custom ID for the popover element.
- `aria-labelledby` (`string`): ARIA labelledby attribute for accessibility.
- `aria-describedby` (`string`): ARIA describedby attribute for accessibility.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent" | "surface"`, default: `"surface"`): Color variant of the popover.
- `trap-focus` (`boolean`, default: `true`): Trap focus inside the popover.
- `keep-open-on-hover` (`boolean`, default: `false`): Keep popover open when hovering over the panel.
- `block` (`boolean`, default: `false`): The popover will be full width of the trigger.
- `position-reference` (`string | HTMLElement`): CSS selector or element reference to use for positioning calculations - When provided, the popover will position relative to this element instead of the trigger Useful for components with labels where you want to position relative to the actual input.
### Events
- `@update:model-value` (payload: `value: boolean`): Emitted when popover state changes
- `@open`: Emitted when popover opens
- `@close`: Emitted when popover closes
- `@toggle` (payload: `value: boolean`): Emitted when popover toggles
- `@update:modelValue` (payload: `value: boolean`)
- `@after-close-animation`: Emitted after the close animation
### Slots
- `#trigger`: Trigger element content Bindings: `open: () => void` (Function to open the popover), `close: () => void` (Function to close the popover), `toggle: () => void` (Function to toggle the popover), `isOpen: boolean` (Current open state of the popover), `trigger: "click" | "hover" | "manual"` (The trigger type).
- `#default`: Popover content Bindings: `open: () => void` (Function to open the popover), `close: () => void` (Function to close the popover), `toggle: () => void` (Function to toggle the popover), `isOpen: true` (Current open state of the popover).
### Exposed (template ref)
- `open`: Open the popover
- `close`: Close the popover
- `toggle`: Toggle the popover
- `isOpen`: Check if the popover is open
- `updatePosition`: Update the popover position
- `panelRef`: Panel reference
- `onTransitionAfterLeave`
---
source: https://maz-ui.com/components/maz-pull-to-refresh.md
---
---
title: "MazPullToRefresh"
description: "MazPullToRefresh adds a native-feeling pull to refresh gesture to your app or to any scroll container, with a progress ring, haptic feedback and translated, accessible feedback."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-pull-to-refresh"
---
# MazPullToRefresh
> MazPullToRefresh adds a native-feeling pull to refresh gesture to your app or to any scroll container, with a progress ring, haptic feedback and translated, accessible feedback.
- Package: `maz-ui`
- Import: `import MazPullToRefresh from 'maz-ui/components/MazPullToRefresh'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-pull-to-refresh
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Key Features
- Works on the window **and on any scroll container**: the closest scrollable ancestor is detected automatically, so it fits app shells with a fixed layout and a scrolling ``
- Starts only when the container is scrolled to the top, never in the middle of a list
- Rubber band resistance beyond the trigger distance, and a progress ring that fills while pulling
- Ignores horizontal swipes and multi-touch gestures, and prevents the native bounce (and the browser's own pull to refresh) while pulling
- Haptic feedback when the trigger distance is reached (devices supporting `navigator.vibrate`)
- Texts from [@maz-ui/translations](../ecosystem/translations.md), overridable with the `translations` prop or the slots
- Accessible: the refresh is announced to screen readers, `aria-busy` is set while refreshing, and `refresh()` is exposed for a button usable with a keyboard or a mouse
- Optional `standalone-mode` to enable it only in an installed PWA (browsers already have their own pull to refresh)
- Built on the headless [usePullToRefresh](../composables/use-pull-to-refresh.md) composable
## Demo
## Basic usage
Wrap your app (or a page) inside the component and give it the function that reloads your data. The spinner stays visible until the returned promise settles.
```vue
App content
```
With Nuxt, `refreshNuxtData` reloads every `useFetch` / `useAsyncData` of the page:
```vue
```
## Inside a scroll container
The pull can only start when its scroll container is at the top. By default, the component uses its **closest scrollable ancestor** (`overflow-y: auto | scroll`), or the window if there is none. Typical app shells with a fixed layout and a scrolling `` work without configuration:
```vue
```
Use `container-selector` when the scroll container is not an ancestor of the component:
```vue
…
```
## Installed apps only
Browsers already provide their own pull to refresh. With `standalone-mode`, the component is only active when the app runs as an installed PWA (`display-mode: standalone`):
```vue
…
```
## Tuning the gesture
| Prop | Default | Effect |
| -------------- | ---------------- | --------------------------------------------------------------------------------------- |
| `distance` | `80` | Pull distance (px, after resistance) needed to trigger a refresh |
| `max-distance` | `distance * 1.6` | Upper bound of the rubber band beyond `distance` |
| `resistance` | `0.5` | Ratio between the finger movement and the pull distance (lower is stiffer) |
| `min-duration` | `400` | Minimum duration (ms) of the refreshing state, so fast refreshes still show the feedback |
| `haptic` | `true` | Short vibration when `distance` is reached |
## Customize the indicator
The three states have their own slot. Each one receives the pull `progress` (0 to 1) and the current `distance` in px.
```vue
{{ Math.round(progress * 100) }}%
Let go!
App content
```
`spinner-color` sets the color of the progress ring, the ready arrow and the default spinner (`primary` by default).
## Translations
Texts come from [@maz-ui/translations](../ecosystem/translations.md) (`pullToRefresh.pull`, `pullToRefresh.release`, `pullToRefresh.refreshing`). Override them per instance with the `translations` prop:
```vue
…
```
## Accessibility
The gesture is touch only. To give keyboard and mouse users the same action, call the exposed `refresh()` from a button: the indicator and the events behave exactly as with the gesture.
```vue
Refresh
…
```
While refreshing, the root element has `aria-busy="true"` and the refreshing text is announced through a polite live region. The visual indicator is hidden from assistive technologies.
## Events
The events follow the life of a refresh: `start`, then `loaded` and `response` (with the value resolved by `on-refresh`) or `error`, and always `finish`. An error thrown by `on-refresh` is emitted, never thrown again.
## Headless usage
Need a different indicator, or a gesture on an element without wrapping it? Use the [usePullToRefresh](../composables/use-pull-to-refresh.md) composable.
## MazPullToRefresh API
`import MazPullToRefresh from 'maz-ui/components/MazPullToRefresh'`
### Props
- `on-refresh` (`(() => unknown)`): Function called when the user releases after pulling far enough. The spinner stays visible until the returned promise settles. Without it, the component does nothing.
- `distance` (`number`, default: `80`): Pull distance (in px, after resistance) required to trigger a refresh.
- `max-distance` (`number`, default: `distance * 1.6`): Maximum pull distance (in px), reached with a rubber band effect beyond `distance`.
- `resistance` (`number`, default: `0.5`): Ratio between the finger movement and the pull distance, between 0 and 1. Lower is stiffer.
- `min-duration` (`number`, default: `400`): Minimum duration (in ms) of the refreshing state, so the feedback stays visible on fast refreshes.
- `container-selector` (`string`): CSS selector of the scroll container. By default, the closest scrollable ancestor of the component, or the window. The pull only starts when this container is scrolled to the top.
- `header-class` (`ClassValue`): Class of the header that holds the indicator.
- `spinner-color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Color of the progress ring and the spinner.
- `disabled` (`boolean`, default: `false`): Disable the pull to refresh.
- `standalone-mode` (`boolean`, default: `false`): Only enable the pull to refresh when the app runs as an installed PWA (standalone display mode), browsers already provide their own pull to refresh.
- `haptic` (`boolean`, default: `true`): Vibrate briefly when the pull reaches `distance` (devices supporting `navigator.vibrate`).
- `translations` (`{ pull?: string | undefined; release?: string | undefined; refreshing?: string | undefined; }`, default: `Translations from`): Translations of the pull to refresh.
- `offset` (`number`)
### Events
- `@start`: Emitted when the refresh starts
- `@loaded`: Emitted when `onRefresh` resolved
- `@error` (payload: `error: unknown`): Emitted when `onRefresh` threw or rejected
- `@response` (payload: `response: unknown`): Emitted with the value resolved by `onRefresh`
- `@finish`: Emitted when the refresh ends, after `loaded` or `error`
### Slots
- `#pull-before`: Content shown while pulling, before the threshold Bindings: `progress: number`, `distance: number`.
- `#pull-ready`: Content shown once releasing triggers a refresh Bindings: `progress: number`, `distance: number`.
- `#pull-loading`: Content shown while refreshing Bindings: `progress: number`, `distance: number`.
- `#default`: Content of the page
### Exposed (template ref)
- `refresh`: Run the refresh programmatically (a "refresh" button for keyboard and mouse users)
- `isRefreshing`: `onRefresh` is running
- `progress`: Pull progress towards `distance`, from 0 to 1
---
source: https://maz-ui.com/components/maz-radio.md
---
---
title: "MazRadio"
description: "MazRadio is a radio input with a label, colors and sizes to pick one value among several options; see MazRadioButtons for a ready-made group"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-radio"
---
# MazRadio
> MazRadio is a radio input with a label, colors and sizes to pick one value among several options; see MazRadioButtons for a ready-made group
- Package: `maz-ui`
- Import: `import MazRadio from 'maz-ui/components/MazRadio'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-radio
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
`v-model=""`
**Details: View code**
```vue
{{ color }}
```
## Sizing
`v-model=""`
**Details: View code**
```vue
```
## Disabled
## MazRadio API
`import MazRadio from 'maz-ui/components/MazRadio'`
### Props
- `id` (`string`): The id of the radio.
- `model-value` (`T`, `v-model`): The value of the radio.
- `value` (`T`, required): The value of the radio.
- `name` (`string`, required): The name of the radio.
- `label` (`string`): The label of the radio.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the radio.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): The size of the radio.
- `disabled` (`boolean`, default: `false`): The disabled state of the radio.
- `error` (`boolean`): Whether there is an error with the input.
- `success` (`boolean`): Whether the input is successful.
- `warning` (`boolean`): Whether there is a warning with the input.
- `hint` (`string`): The hint text to display below the input.
### Events
- `@update:model-value` (payload: `value: T`): Event emitted when value change
- `@blur` (payload: `value: FocusEvent`): Emitted when the radio lost focus
- `@change` (payload: `value: T`): Event emitted when value change
- `@focus` (payload: `value: FocusEvent`): Emitted when the radio is focused
### Slots
- `#default` Bindings: `isSelected: boolean`, `value: T`.
---
source: https://maz-ui.com/components/maz-radio-buttons.md
---
---
title: "MazRadioButtons"
description: "MazRadioButtons is a standalone component to select a value in a list. Made with native HTMLInputElement type radio"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-radio-buttons"
---
# MazRadioButtons
> MazRadioButtons is a standalone component to select a value in a list. Made with native HTMLInputElement type radio
- Package: `maz-ui`
- Import: `import MazRadioButtons from 'maz-ui/components/MazRadioButtons'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-radio-buttons
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
```
## Custom slot template
```html
{{ option.label }}
{{ option.areaName }}
```
## Orientation - Column
```vue
{{ option.label }}
{{ option.areaName }}
```
## Selector icon with options equal-size
This option will display a select icon on the left of the label
```vue
{{ option.label }}
{{ option.description }}
```
## Types
### options
The options prop is an array of `ButtonsRadioOption` type
```ts
export type ButtonsRadioOption = {
/** The label of the option */
label: string
/** The value of the option */
value: string | number | boolean
/** The classes to apply to the option */
classes?: any
/** The style to apply to the option */
style?: StyleValue
} & Record
```
## Accessibility
The root element is a `radiogroup` of native radio inputs: pass an `aria-label` (or `aria-labelledby`) to name it. The `hint` describes the group (`aria-describedby`) and `error` sets `aria-invalid`. The arrows move between the options natively.
When no `name` is provided, each instance gets a unique one, so two groups of the same page never share their radios.
## MazRadioButtons API
`import MazRadioButtons from 'maz-ui/components/MazRadioButtons'`
### Props
- `model-value` (`T`, `v-model`): The value of the selected option.
- `options` (`Option[]`, required): The options to display.
- `name` (`string`, default: `a unique name per instance`): The name of the radio group.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent" | "surface"`, default: `"primary"`): The color of the selected radio buttons.
- `elevation` (`boolean`, default: `false`): Add elevation to the radio buttons.
- `orientation` (`"row" | "col"`, default: `"row"`): The orientation of the radio buttons.
- `wrap` (`boolean`, default: `true`): Disable the wrap of the radio buttons.
- `equal-size` (`boolean`, default: `false`): Make all radio buttons the same size.
- `selector` (`boolean`, default: `false`): Display a selector icon.
- `block` (`boolean`, default: `false`): The component will be displayed in full width.
- `error` (`boolean`): Whether there is an error with the input.
- `success` (`boolean`): Whether the input is successful.
- `warning` (`boolean`): Whether there is a warning with the input.
- `hint` (`string`): The hint text to display below the input.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): The size of the radio buttons.
### Events
- `@update:model-value` (payload: `value: Option["value"]`): Emitted when the selected option change
- `@blur` (payload: `value: FocusEvent`): Emitted when the a radio button lost focus
- `@change` (payload: `value: Option["value"]`): Emitted when the selected option change
- `@focus` (payload: `value: FocusEvent`): Emitted when the a radio button is focused
### Slots
- `#default`: Label of the radio Bindings: `option: Option` (The value of the option), `selected: boolean` (If the option is selected).
---
source: https://maz-ui.com/components/maz-read-more.md
---
---
title: "MazReadMore"
description: "MazReadMore is a standalone component to truncate long text with a \"Read more\" / \"Read less\" toggle functionality"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-read-more"
---
# MazReadMore
> MazReadMore is a standalone component to truncate long text with a "Read more" / "Read less" toggle functionality
- Package: `maz-ui`
- Import: `import MazReadMore from 'maz-ui/components/MazReadMore'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-read-more
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
## Basic usage
Use the `text` prop or the default slot to provide the content to truncate. By default, the component uses line-clamp with 4 lines.
### With text prop
```vue
```
### With default slot
```vue
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
```
## Truncation with max lines
Control the number of visible lines using the `max-lines` prop.
```vue
```
## Truncation with max characters
Use the `max-chars` prop to truncate based on character count instead of lines.
```vue
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
```
## Using slot for content
You can use the default slot to provide rich content instead of plain text.
```vue
Rich content example: Lorem ipsum dolor sit amet,
consectetur adipiscing elit . Sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.
```
## Colors
Customize the color of the toggle link using the `color` prop.
```vue
```
## Custom toggle text
Customize the "Read more" and "Read less" text using the `expand-text` and `collapse-text` props.
```vue
```
## Short content (no button)
When the content is shorter than the truncation limit, the toggle button is automatically hidden.
```vue
```
## MazReadMore API
`import MazReadMore from 'maz-ui/components/MazReadMore'`
### Props
- `text` (`string`): The text to be truncated.
- `max-lines` (`number`, default: `4`): The maximum number of lines to be displayed.
- `max-chars` (`number`): The maximum number of characters to be displayed.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent" | "muted" | "surface" | "inherit"`, default: `"primary"`): The color of the link (MazLink).
- `collapse-text` (`string`, default: `'readMore.collapse' (translations)`): The text of the link when the content is collapsed.
- `expand-text` (`string`, default: `'readMore.expand' (translations)`): The text of the link when the content is expanded.
- `id` (`string`): Unique identifier for accessibility linking.
- `aria-label` (`string`, default: `'readMore.ariaLabel' (translations)`): Accessibility label for the content region.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-reading-progress-bar.md
---
---
title: "MazReadingProgressBar"
description: "MazReadingProgressBar is a standalone component to display a reading progress bar"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-reading-progress-bar"
---
# MazReadingProgressBar
> MazReadingProgressBar is a standalone component to display a reading progress bar
- Package: `maz-ui`
- Import: `import MazReadingProgressBar from 'maz-ui/components/MazReadingProgressBar'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-reading-progress-bar
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
This component use the ` ` component to move the progress bar to the top of the page. You can set the `teleport-selector` prop to change the target of the teleportation.
## Basic usage
Look at the top of the page to see the component in action (scroll in page to inscrease progress bar width).
```vue
```
## Types
### Props
```ts
export interface Props {
/**
* Height of the progress bar
* @default 4px
*/
height?: string
/**
* Color of the progress bar
* @default primary
*/
color?: Color
/**
* Selector of the element to teleport the progress bar
* @default body
*/
teleportSelector?: string
/**
* Selector of the element to get the height
* @default body
*/
contentSelector?: string
/**
* Offset of the progress bar
* @default 0
*/
offset?: number
/**
* Class of the progress bar
* @default undefined
*/
barClass?: HTMLAttributes['class']
/**
* Instead of using the height of the content with a selector, you can set a scroll distance
* @default undefined
*/
distance?: number
}
```
## MazReadingProgressBar API
`import MazReadingProgressBar from 'maz-ui/components/MazReadingProgressBar'`
### Props
- `height` (`string`, default: `"4px"`): Height of the progress bar.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Color of the progress bar.
- `teleport-selector` (`string`, default: `"body"`): Selector of the element to teleport the progress bar.
- `content-selector` (`string`, default: `"body"`): Selector of the element to get the height.
- `offset` (`number`, default: `0`): Offset of the progress bar.
- `bar-class` (`ClassValue`): Class of the progress bar.
- `distance` (`number`): Instead of using the height of the content with a selector, you can set a scroll distance.
### Events
- `@begin`
- `@complete`
---
source: https://maz-ui.com/components/maz-select.md
---
---
title: "MazSelect - with \"multiple\" options"
description: "MazSelect is a standalone component that replaces the standard html input select with a beautiful design system. There are many options like multiple values, search text field, custom templates options, colors, sizes, disabled, loading, error, warning, valid states, error messages, and icons."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-select"
---
# MazSelect - with "multiple" options
> MazSelect is a standalone component that replaces the standard html input select with a beautiful design system. There are many options like multiple values, search text field, custom templates options, colors, sizes, disabled, loading, error, warning, valid states, error messages, and icons.
- Package: `maz-ui`
- Import: `import MazSelect from 'maz-ui/components/MazSelect'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-select
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
## Basic usage
```vue
selectedValue: {{ selectedValue }}
```
## Multiple
```html
```
## Search
Use `search` property to add a search input in the options list
**Tip:**
You can use your own template to replace the empty icon when no results are found
**Details: View code**
```html
No result
```
**Note:**
You can adjust the search results by using `search-threshold` where 1 is a perfect match and 0 is a match with any character
```html
```
```html
```
### Custom search function
You can provide your own search function to customize the search behavior
```vue
```
## Opt Group
Group your options like a native optgroup
```vue
```
## Disabled
```html
```
## Size
```vue
```
## Custom template options
Customize the options list with your own template
```vue{6}
{{ option.label }}
```
## Custom options model
By default, the options should be an array of `{ value: any, label: string }`
If you want custom keys of these options, you can use:
- `option-value-key` to override the key of the value in your option
- `option-label-key` to override the key of the label to show in the option list
- `option-input-value-key` to override the key of the value to show in the input
### Example
```vue
```
### Types
```ts
type ModelValueSimple = string | number | null | undefined | boolean
```
## Accessibility
`MazSelect` follows the [WAI-ARIA combobox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) with a listbox popup:
- The input is a `combobox` (`aria-haspopup="listbox"`, `aria-expanded`, `aria-controls`).
- The list is a `listbox` (`aria-multiselectable` in multiple mode) labelled by the `label`, `top-label` or `placeholder`, each option is an `option` with `aria-selected`.
- **Keyboard**: ↓ / ↑ / Space or a letter open the list, the arrows move between options, Home / End go to the first / last option, Enter selects, Esc closes.
- The labels read by screen readers (toggle button, empty results) come from `@maz-ui/translations` (`aria` namespace).
## MazSelect API
`import MazSelect from 'maz-ui/components/MazSelect'`
### Props
- `id` (`string`): The id of the select.
- `label` (`string`): The label of the select.
- `top-label` (`string`): Static label displayed above the input field. Unlike the floating label, this remains fixed.
- `placeholder` (`string`): The placeholder of the select.
- `model-value` (`(Multiple extends true ? Value[] : Value)`, `v-model`): The value of the select.
- `options` (`Option[]`, required): The options of the select.
- `option-value-key` (`string`, default: `"value"`): The key of the option value.
- `option-label-key` (`string`, default: `"label"`): The key of the option label.
- `option-input-value-key` (`string`, default: `"label"`): The key of the option input value.
- `list-position` (`MazPopoverPosition`, default: `"auto"`): The position of the list (auto by default - will switch between bottom-start and top-start).
- `prefer-position` (`MazPopoverPreferPosition`, default: `"bottom-start"`): The prefer position of the list.
- `fallback-position` (`MazPopoverFallbackPosition`, default: `"top-start"`): The fallback position of the list.
- `item-height` (`number`): The height of the option list item.
- `max-list-height` (`number`, default: `240`): The max height of the option list.
- `max-list-width` (`number`): The max width of the option list.
- `min-list-height` (`number`): The min height of the option list.
- `min-list-width` (`number`): The min width of the option list.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): The size of the select.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the select.
- `search` (`boolean`): Display search input in option list.
- `search-function` (`((query: string, options: Option[]) => Option[] | undefined)`): Replace the default search function to provide a custom search function.
- `search-threshold` (`number`, default: `0.75`): The threshold for the search input where 1 is a perfect match and 0 is a match with any character.
- `multiple` (`Multiple`, default: `false`): Enable the multiple selection.
- `required` (`boolean`): Make the input required in the form.
- `disabled` (`boolean`): Disable the component.
- `block` (`boolean`): The input will be displayed in full width.
- `autocomplete` (`string`, default: `"off"`): The autocomplete attribute of the input.
- `translations` (`Partial<{ searchPlaceholder: string; }>`, default: `{ searchPlaceholder: 'Search in options', }`): The translations of the component.
- `format-input-value` (`((value: Multiple extends true ? Value[] : Value) => string)`): The function to format the input value.
- `transition` (`string`, default: `"scale-fade"`): The transition name of the panel list options.
- `open` (`boolean`, default: `false`, `v-model:open`)
### Events
- `@update:model-value` (payload: `value: Multiple extends true ? Value[] : Value`): On model value update, returns the new value
- `@open`: On list is opened
- `@close`: On list is closed
- `@blur` (payload: `value: Event`): On input blur
- `@change` (payload: `value: Event`): On input change value
- `@focus` (payload: `value?: Event | undefined`): On input focus
- `@input` (payload: `value: Event`): On input value
- `@selected-option` (payload: `value: Option`): On selected value, returns the option object
- `@update:open` (payload: `value: boolean`)
### Slots
- `#start-icon`: Add a custom inline-start icon (left in LTR, right in RTL) Bindings: `isOpen: false` (Current open state of the popover), `close: () => void` (Function to close the popover), `open: () => void` (Function to open the popover), `toggle: () => void` (Function to toggle the popover).
- `#end-icon`: Add and replace a custom inline-end icon (right in LTR, left in RTL) Bindings: `isOpen: false` (Current open state of the popover), `close: () => void` (Function to close the popover), `open: () => void` (Function to open the popover), `toggle: () => void` (Function to toggle the popover).
- `#no-results`: No results slot - Displayed when no results corresponding with search query
- `#optgroup`: Custom optgroup label Bindings: `label: string | number | true` (the label of the optgroup).
- `#default`: Custom option Bindings: `option: Option` (the option object), `isSelected: boolean` (if the option is selected), `isOpen: false` (if the popover is open), `close: () => void` (function to close the popover), `open: () => void` (function to open the popover), `toggle: () => void` (function to toggle the popover).
---
source: https://maz-ui.com/components/maz-select-country.md
---
---
title: "MazSelectCountry"
description: "MazSelectCountry is a versatile Vue component for selecting countries or languages with built-in internationalization support and customizable display options"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-select-country"
---
# MazSelectCountry
> MazSelectCountry is a versatile Vue component for selecting countries or languages with built-in internationalization support and customizable display options
- Package: `maz-ui`
- Import: `import MazSelectCountry from 'maz-ui/components/MazSelectCountry'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-select-country
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
## Basic usage
The most common use case is selecting a country. The component automatically displays country names in the user's locale with their respective flags.
```vue
```
## Language selection
Configure the component to display languages instead of countries by setting the appropriate `displayNamesOptions`.
```vue
```
## Sizes and colors
```vue
```
## Preferred countries
You can prioritize certain countries to appear at the top of the list using the `preferredCodes` prop.
```vue
```
## Filtering options
Control which countries are displayed using `onlyCodes` to show only specific countries, or `ignoredCodes` to exclude certain ones.
```vue
```
## Custom display options
Configure how country/language names are displayed using the `displayNamesOptions` prop, which leverages the browser's `Intl.DisplayNames` API.
```vue
```
## Flags source
By default, the flags are images of the [flagcdn.com](https://flagcdn.com) CDN: each user's browser requests them from this third party. The `flag-src` prop changes where they come from, in four ways:
| Source | `flag-src` | Network |
| --- | --- | --- |
| CDN (default) | not set | flagcdn.com |
| Flags of maz-ui | `loadCountryFlag` from `maz-ui/country-flags` | none (works offline) |
| Your own files | URL template: `'/flags/{code}.svg'` | your server |
| Your own function | `(code) => string \| undefined \| Promise` | yours |
In every case, a flag is only loaded when it becomes visible (the selected country, then the rows of the open list in view), and a code without flag displays the colored badge.
### For the whole app
Set it once instead of on every component: the `flag-src` of `MazSelectCountry` and `MazInputPhoneNumber` both default to `defaults.global.flagSrc` (see [Global component defaults](../guide/global-defaults.md)). A `flag-src` set on a component always wins.
```ts
// Vue: main.ts
import { loadCountryFlag } from 'maz-ui/country-flags'
import { MazUi } from 'maz-ui/plugins/maz-ui'
app.use(MazUi, {
theme: { preset: mazUi },
defaults: {
global: { flagSrc: loadCountryFlag }, // or a URL template: '/flags/{code}.svg'
},
})
```
```ts
// Nuxt: nuxt.config.ts
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt'],
mazUi: {
flags: 'local', // 'cdn' (default) | 'local' | a URL template: '/flags/{code}.svg'
},
})
```
### Flags of maz-ui, offline
`loadCountryFlag` gives the square flag of a code from the 256 flags of `@maz-ui/icons`, as a `data:image/svg+xml` URL: no request to a third party (nothing to allow for flagcdn.com in your Content Security Policy, the user's IP is not sent to it), and the component works offline (hybrid apps with Capacitor or Cordova, PWAs, intranets).
```vue
```
How it stays light:
- Nothing in maz-ui imports `maz-ui/country-flags`: an app that does not import it has **no flag file at all** in its build.
- Once imported, your bundler emits **one small chunk per flag** (256 files, from a few hundred bytes to a few kilobytes each). None is preloaded: only the flags displayed are downloaded.
- The loader itself (a table of 256 dynamic imports, about 4 kB gzipped) goes into the chunk that imports it. To keep it out of your entry chunk, import it on demand (the Nuxt option `flags: 'local'` does it for you):
```ts
const flagSrc = (code: string) => import('maz-ui/country-flags').then(({ loadCountryFlag }) => loadCountryFlag(code))
```
**Tip: Content Security Policy**
The flags are `data:` URLs: a strict CSP must allow `img-src data:` (already needed by the lazy images of maz-ui).
**Tip: PWA precache**
Once you use `loadCountryFlag`, the 256 flag chunks are part of your build, so a service worker that precaches every `**/*.js` downloads all of them at install. Keep them (every flag available offline) or exclude them and let them load on demand. With Vite, the chunks are named after their module, `MazFlagSquareFR-[hash].js`:
```ts
// vite-plugin-pwa
VitePWA({ workbox: { globIgnores: ['**/MazFlagSquare*.js'] } })
```
Nuxt names its chunks `_nuxt/[hash].js` only: name the flag chunks yourself to exclude them, e.g. `vite.build.rollupOptions.output.chunkFileNames: chunk => chunk.name.startsWith('MazFlagSquare') ? '_nuxt/flags/[name].[hash].js' : '_nuxt/[hash].js'`, then ignore `**/_nuxt/flags/**`.
### Your own files
A URL template, with `{code}` for the lowercase code and `{CODE}` for the uppercase code. The images are lazy loaded like the CDN ones. A missing image displays the badge.
```vue
```
### Your own function
A function receives the country code of each flag when it becomes visible, and returns the image source (URL or data URL), or `undefined` to display the badge. It can be async: only the flags displayed are loaded.
```vue
```
You can also replace the flags entirely with the `selector-flag` and `country-list-flag` slots.
## Without flags
Hide country flags using the `hideFlags` prop for a cleaner text-only interface.
```vue
```
## Custom locale
Override the default locale to display country/language names in a specific language.
```vue
```
## States and validation
The component supports all the standard form states for better user experience.
```vue
```
## Custom options
Provide your own list of options instead of using the built-in country/language codes.
```vue
```
## Display code instead of name
Show country/language codes in the input field instead of names using the `displayCode` prop.
```vue
```
## Advanced configuration
Combine multiple features for complex use cases, such as business applications requiring specific country lists with custom styling.
```vue
```
## How it works
The `MazSelectCountry` component is built on top of `MazSelect` and leverages the powerful `useDisplayNames` composable, which uses the browser's native `Intl.DisplayNames` API for internationalization.
### Key features:
- **Automatic localization**: Country and language names are displayed in the user's locale
- **Built-in search**: Users can quickly find countries by typing
- **Flag integration**: Automatic flag display using country codes, from the flagcdn.com CDN, the flags of maz-ui (offline) or your own files
- **Flexible filtering**: Support for preferred, ignored, or specific country lists
- **Custom options**: Override default behavior with custom data
- **Accessibility**: Full keyboard navigation and screen reader support
### useDisplayNames composable
The component uses the `useDisplayNames` composable internally, which provides:
```typescript
// Get display name for a single code
const displayName = getDisplayName('FR', {
locale: 'en-US',
type: 'region'
})
// Get all display names with filtering
const allCountries = getAllDisplayNames({
locale: 'en-US',
codesType: 'country',
preferred: ['US', 'GB', 'FR'],
exclude: ['AQ']
})
```
This ensures consistent internationalization across your application while providing maximum flexibility for different use cases.
## MazSelectCountry API
`import MazSelectCountry from 'maz-ui/components/MazSelectCountry'`
### Props
- `id` (`string`): Id of the component.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Color of the component.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `md`): Size of the component.
- `preferred-codes` (`Option["code"][]`): Preferred countries to display.
- `ignored-codes` (`Option["code"][]`): Ignored countries to display.
- `only-codes` (`Option["code"][]`): Only countries to display.
- `list-position` (`MazPopoverPosition`, default: `'auto'`): Position of the list.
- `hide-flags` (`boolean`): Hide flags.
- `flag-src` (`MazCountryFlagSrc`, default: `undefined (flags from flagcdn.com)`): Source of the flags, instead of the flagcdn.com CDN: - a URL template with the code, `{code}` (lowercase) or `{CODE}` (uppercase): `/flags/{code}.svg` - a function giving the image source of a code (URL or data URL), called when the flag becomes visible, or `undefined` to display the code in a badge Use `loadCountryFlag` from `maz-ui/country-flags` for the flags of `@maz-ui/icons`, without any request to a third party. Can be set for the whole app with the `defaults.global.flagSrc` option of the MazUi plugin.
- `search` (`boolean`, default: `true`): Display search input in options list.
- `show-code-in-list` (`boolean`, default: `false`): Show code on list.
- `locale` (`string`, default: `locale defined within the maz-ui plugin or browser locale or en-US`): Locale.
- `success` (`boolean`): Success state.
- `error` (`boolean`): Error state.
- `warning` (`boolean`): Warning state.
- `display-code` (`boolean`)
- `search-threshold` (`number`, default: `0.75`): Search threshold.
- `translations` (`Partial<{ searchPlaceholder: string; }>`, default: `MazUiTranslationsNestedSchema['selectCountry']`): Translations.
- `hint` (`string`): Hint message displayed.
- `options` (`Option[]`): Options.
- `display-names-options` (`DisplayNamesOptions`, default: `{ type: "region", languageDisplay: "standard", fallback: "code", style: "long" }`): Display name type.
- `codes-type` (`CodesType`, default: `defined by displayNamesOptions.type (if 'region', 'country' is used, otherwise 'iso')`): Codes type. Values: `'iso'`, `'bcp'`, `'country'`, `'all'` (non exhaustive).
- `open` (`boolean`, default: `false`): Open the select.
- `model-value` (`Option["code"]`, `v-model`): The value of the select.
- `block` (`boolean`): The input will be displayed in full width.
- `disabled` (`boolean`): Disable the component.
- `required` (`boolean`): Make the input required in the form.
- `label` (`string`): The label of the select.
- `placeholder` (`string`): The placeholder of the select.
- `search-function` (`((query: string, options: Option[]) => Option[] | undefined)`): Replace the default search function to provide a custom search function.
- `transition` (`string`, default: `'scale-fade'`): The transition name of the panel list options.
- `prefer-position` (`MazPopoverPreferPosition`, default: `'bottom-start'`): The prefer position of the list.
- `fallback-position` (`MazPopoverFallbackPosition`, default: `'top-start'`): The fallback position of the list.
- `top-label` (`string`): Static label displayed above the input field. Unlike the floating label, this remains fixed.
- `autocomplete` (`string`, default: `'off'`): The autocomplete attribute of the input.
- `option-value-key` (`string`, default: `"code"`): The key of the option value.
- `option-label-key` (`string`, default: `"name"`): The key of the option label.
- `option-input-value-key` (`string`, default: `"name"`): The key of the option input value.
- `item-height` (`number`): The height of the option list item.
- `max-list-height` (`number`, default: `240`): The max height of the option list.
- `max-list-width` (`number`, default: `250`): The max width of the option list.
- `min-list-height` (`number`): The min height of the option list.
- `min-list-width` (`number`, default: `200`): The min width of the option list.
- `format-input-value` (`((value: Option["code"]) => string)`): The function to format the input value.
### Events
- `@update:model-value` (payload: `value?: Option["code"] | undefined`): Emitted when the model value changes
### Slots
- `#selector-flag`: Country selector flag Bindings: `countryCode: Option["code"]` (current selected country code - Ex: `"FR"`).
- `#no-results`
- `#country-list-flag`: Country list flag Bindings: `option: Option` (country data), `isSelected: boolean` (`true` if option is selected).
- `#country-list-code` Bindings: `option: Option`, `isSelected: boolean`.
- `#country-list-name` Bindings: `option: Option`, `isSelected: boolean`.
---
source: https://maz-ui.com/components/maz-sidebar.md
---
---
title: "MazSidebar"
description: "MazSidebar is a composable sidebar system for dashboard, admin, and SaaS applications. It provides a fully accessible, collapsible navigation with multiple display modes."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-sidebar"
---
# MazSidebar
> MazSidebar is a composable sidebar system for dashboard, admin, and SaaS applications. It provides a fully accessible, collapsible navigation with multiple display modes.
- Package: `maz-ui`
- Import: `import MazSidebar from 'maz-ui/components/MazSidebar'` or `import MazSidebarMenuButton from 'maz-ui/components/MazSidebarMenuButton'` or `import MazSidebarMenuSub from 'maz-ui/components/MazSidebarMenuSub'` or `import MazSidebarGroup from 'maz-ui/components/MazSidebarGroup'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-sidebar
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
`MazSidebar` shares its state with all sub-components via Vue's `provide`/`inject`. No separate Provider component is needed. All sub-components must be descendants of `MazSidebar`.
**Warning: Deferred features (v1.1)**
The following features are planned for a future release and are **not yet available**:
- `localStorage` state persistence
- `Cmd/Ctrl+B` keyboard shortcut
- Automatic mobile drawer under a breakpoint
## Sub-components
| Component | Role |
| ---------------------- | --------------------------------------------------------------------- |
| `MazSidebar` | Root container - provides state context |
| `MazSidebarHeader` | Fixed top area |
| `MazSidebarContent` | Scrollable central area |
| `MazSidebarFooter` | Fixed bottom area |
| `MazSidebarGroup` | Item grouping with optional label |
| `MazSidebarSeparator` | Visual divider (` `) |
| `MazSidebarMenu` | `` wrapper with `role="menu"` |
| `MazSidebarMenuItem` | `` item wrapper |
| `MazSidebarMenuButton` | Clickable item (link or button), supports icon, label, badge, tooltip |
| `MazSidebarMenuSub` | Collapsible sub-menu |
| `MazSidebarTrigger` | Toggle button (must be a descendant of `MazSidebar`) |
## Basic usage
```html
My App
Footer
Main content
```
## Groups & dividers
```html
```
## Sub-menus
```html
```
## Icon mode with tooltips
When `collapsible="icon"` and the sidebar is collapsed, labels fade out and only the icons stay visible. To help users identify items in collapsed state, provide a `tooltip` prop on each `MazSidebarMenuButton`: it uses the `v-tooltip` directive and is only shown on hover when the sidebar is collapsed by default.
### Controlling when the tooltip appears
Both `MazSidebar` and `MazSidebarMenuButton` accept a `tooltip-mode` prop:
- `closed` (default on the sidebar) - tooltip only shows on hover when the sidebar is collapsed
- `always` - tooltip shows on hover regardless of the sidebar state
Set it on the sidebar to apply to every descendant button, or override per-button:
```html
```
**Tip: Performance**
When no `tooltip` prop is provided on a button, the `v-tooltip` directive is not attached at all - no listeners, no popover instance.
```html
```
## Hover mode
`collapsible="hover"` displays the sidebar in icon-only mode and **automatically expands it when the mouse enters the sidebar (or any descendant) and collapses it when the mouse leaves**. Keyboard focus also expands the sidebar, so users navigating with `Tab` see the full labels.
**Tip:**
This is a **purely visual** state. The `v-model:open` value is not updated and the persistence cookie is not written when the sidebar expands or collapses through hover. Use this mode when you want the rail-style sidebar of `collapsible="icon"` without exposing a toggle.
```html
```
## Offcanvas mode
```html
```
## Overlay vs push mode
In `mode="push"` (default), the sidebar is part of the document flow and pushes the main content.
In `mode="overlay"`, the sidebar floats over the content with a backdrop, escape key support and focus trapping.
```html
```
## Side end (right)
```html
Main content
```
## Badges
`badge` accepts a `string`, a `number`, or a full `MazBadgeProps` object (with an optional `text`) to fine-tune color, size, outlined, etc.
```html
```
## User menu in footer
```html
Jane Doe
jane@example.com
```
## Mobile (static rendering)
**Note:**
Automatic mobile drawer (drawer auto under a breakpoint with backdrop) is a **deferred v1.1 feature**. For now, control the sidebar visibility programmatically based on viewport.
```html
```
## Programmatic control (v-model + composable)
Use `v-model:open` for two-way binding, or `useSidebar()` inside any descendant component.
```html
```
## Persistent open state
The sidebar persists its open/collapsed state in a cookie (`maz-sidebar-open`) so it survives page reloads. This is **enabled by default**.
```html
```
### How it works
- **In setup (server + client)**: the cookie is read and used to initialize the open state. On the server, the value is taken from the request `Cookie` header via Vue's `useSSRContext()`; on the client it comes from `document.cookie`.
- **On client mount**: `update:open` is emitted if the persisted value differs from the `:open` prop, so your parent `v-model` stays in sync.
- **On state change**: every transition between expanded/collapsed writes the new value to the cookie (1-year expiry, `SameSite=Lax`).
### SSR considerations
Persistence is **SSR-native** - the server reads the request cookie and renders the sidebar in its persisted state immediately, so there is no expand → collapse flash on hydration. This works out of the box in Nuxt and any Vue 3 SSR runtime that exposes the request headers through `useSSRContext()`.
If you prefer to manage the state yourself (e.g. to share it with other parts of your app), disable persistence and feed the cookie via your own ref:
```html
```
`:persist="false"` prevents the sidebar from also writing the cookie, leaving full control to your `useCookie` ref.
## With router (vue-router / NuxtLink)
`MazSidebarMenuButton` uses `resolveLinkComponent()` internally - it detects `RouterLink` (vue-router) or a provided `NuxtLink`. Pass the `to` prop for router navigation, `href` for plain anchor links.
```html
```
## CSS Variables
Customize the sidebar width using these CSS custom properties (also settable via `width` / `iconWidth` props):
```css
:root {
--maz-sidebar-width: 16rem; /* expanded width */
--maz-sidebar-icon-width: 3rem; /* icon-mode collapsed width */
}
```
## Accessibility
- The sidebar root element renders as ``
- `MazSidebarMenu` renders as ``
- `MazSidebarMenuItem` renders as ``
- `MazSidebarTrigger` has `aria-expanded` and `aria-controls` referencing the sidebar `id`
- `MazSidebarMenuButton` applies `aria-current="page"` on active items and exposes the label via `aria-label`
- `MazSidebarMenuSub` trigger has `aria-expanded` and `aria-controls`
- In `mode="overlay"`, pressing `Escape` closes the sidebar and focus is restored to the trigger element
- In `mode="overlay"`, `Tab`/`Shift+Tab` are trapped within the sidebar
- All transitions respect `prefers-reduced-motion`
## MazSidebar
## MazSidebar API
`import MazSidebar from 'maz-ui/components/MazSidebar'`
### Props
- `id` (`string`): Unique identifier for the sidebar (auto-generated if not provided).
- `open` (`boolean`, default: `true`, `v-model:open`): Whether the sidebar is open.
- `side` (`"end" | "start"`, default: `"start"`): Side of the sidebar.
- `collapsible` (`"icon" | "none" | "hover" | "offcanvas"`, default: `"offcanvas"`): How the sidebar collapses - offcanvas: completely hidden - icon: only icons visible - hover: only icons visible by default, expands on mouse hover or keyboard focus (transient visual state - does not update `v-model:open` nor the persistence cookie) - none: always fully visible.
- `mode` (`"push" | "overlay"`, default: `"push"`): How the sidebar affects layout - push: sidebar is in document flow - overlay: sidebar floats over content with a backdrop.
- `width` (`string`, default: `"16rem"`): Width of the expanded sidebar.
- `icon-width` (`string`, default: `"3rem"`): Width of the collapsed sidebar in icon mode.
- `tooltip-mode` (`MazSidebarTooltipMode`, default: `"closed"`): When descendant `MazSidebarMenuButton` components should display their tooltip. - `always`: tooltip shows on hover regardless of the sidebar state - `closed`: tooltip only shows on hover when the sidebar is collapsed Individual buttons can override this via their own `tooltipMode` prop.
- `persist` (`boolean`, default: `true`): Persist the open/collapsed state in a cookie so it survives reloads. Restoration happens on client mount (SSR-safe). For zero-flash SSR, read the cookie server-side and forward it via `v-model:open`.
- `persist-key` (`string`, default: `"maz-sidebar-open"`): Cookie key used when `persist` is enabled. Set a unique key per sidebar instance if you mount several sidebars on the same site.
### Events
- `@update:open` (payload: `value: boolean`): Emitted when open state changes
### Slots
- `#default`
### Exposed (template ref)
- `toggle`
- `setOpen`
## MazSidebarMenuButton
## MazSidebarMenuButton API
`import MazSidebarMenuButton from 'maz-ui/components/MazSidebarMenuButton'`
### Props
- `to` (`string | Record`): Route for router-link navigation.
- `href` (`string`): URL for anchor navigation.
- `icon` (`MazIconLike`): Icon to display before the label. Accepts a bare icon value (Vue component, raw SVG string, URL) or a full `MazIconProps` object for fine-grained control (size, title, fallback, …).
- `label` (`string`): Label text.
- `badge` (`MazSidebarMenuButtonBadge`): Badge content. Pass a `string`/`number` for a simple primary badge, or a full `MazBadgeProps` object (with optional `text`) to customise color, size, outlined, ….
- `tooltip` (`string`): Tooltip text. When provided, shows a tooltip on hover via the `v-tooltip` directive.
- `tooltip-mode` (`MazSidebarTooltipMode`): Controls when the tooltip should be displayed. - `always`: tooltip shows on hover regardless of the sidebar state - `closed`: tooltip only shows on hover when the sidebar is collapsed Overrides the parent `MazSidebar`'s `tooltipMode`. Falls back to the sidebar value (which defaults to `always`) when not provided.
- `active` (`boolean`): Whether the item is active (highlights with `aria-current="page"`).
- `disabled` (`boolean`): Whether the item is disabled.
- `size` (`"sm" | "md" | "lg"`, default: `"md"`): Size of the button.
### Events
- `@click` (payload: `event: MouseEvent`)
### Slots
- `#icon`
- `#default`
## MazSidebarMenuSub
## MazSidebarMenuSub API
`import MazSidebarMenuSub from 'maz-ui/components/MazSidebarMenuSub'`
### Props
- `label` (`string`): Label for the sub-menu trigger button.
- `icon` (`MazIconLike`): Icon to display before the label. Accepts a bare icon value (Vue component, raw SVG string, URL) or a full `MazIconProps` object for fine-grained control.
- `default-open` (`boolean`, default: `false`): Whether the sub-menu is open by default.
### Slots
- `#icon`
- `#label`
- `#chevron`
- `#default`
## MazSidebarGroup
## MazSidebarGroup API
`import MazSidebarGroup from 'maz-ui/components/MazSidebarGroup'`
### Props
- `label` (`string`): Optional label for the group.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-content.md
---
---
title: "MazSidebarContent"
description: "Scrollable main area of MazSidebar that holds the groups and the menus."
package: "maz-ui"
---
# MazSidebarContent
> Scrollable main area of MazSidebar that holds the groups and the menus.
- Package: `maz-ui`
- Import: `import MazSidebarContent from 'maz-ui/components/MazSidebarContent'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
## MazSidebarContent API
`import MazSidebarContent from 'maz-ui/components/MazSidebarContent'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-footer.md
---
---
title: "MazSidebarFooter"
description: "Bottom area of MazSidebar, for the user menu or secondary actions."
package: "maz-ui"
---
# MazSidebarFooter
> Bottom area of MazSidebar, for the user menu or secondary actions.
- Package: `maz-ui`
- Import: `import MazSidebarFooter from 'maz-ui/components/MazSidebarFooter'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
## MazSidebarFooter API
`import MazSidebarFooter from 'maz-ui/components/MazSidebarFooter'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-group.md
---
---
title: "MazSidebarGroup"
description: "Titled and optionally collapsible section of MazSidebar that groups menus."
package: "maz-ui"
---
# MazSidebarGroup
> Titled and optionally collapsible section of MazSidebar that groups menus.
- Package: `maz-ui`
- Import: `import MazSidebarGroup from 'maz-ui/components/MazSidebarGroup'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazSidebar](./maz-sidebar.md): read its page for complete examples.
## MazSidebarGroup API
`import MazSidebarGroup from 'maz-ui/components/MazSidebarGroup'`
### Props
- `label` (`string`): Optional label for the group.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-header.md
---
---
title: "MazSidebarHeader"
description: "Top area of MazSidebar, for the logo, the name of the app or a workspace switcher."
package: "maz-ui"
---
# MazSidebarHeader
> Top area of MazSidebar, for the logo, the name of the app or a workspace switcher.
- Package: `maz-ui`
- Import: `import MazSidebarHeader from 'maz-ui/components/MazSidebarHeader'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
## MazSidebarHeader API
`import MazSidebarHeader from 'maz-ui/components/MazSidebarHeader'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-menu.md
---
---
title: "MazSidebarMenu"
description: "List of navigation items of MazSidebar."
package: "maz-ui"
---
# MazSidebarMenu
> List of navigation items of MazSidebar.
- Package: `maz-ui`
- Import: `import MazSidebarMenu from 'maz-ui/components/MazSidebarMenu'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
## MazSidebarMenu API
`import MazSidebarMenu from 'maz-ui/components/MazSidebarMenu'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-menu-button.md
---
---
title: "MazSidebarMenuButton"
description: "Navigation button or link of a MazSidebar menu item, with icon, label, badge, and a tooltip when the sidebar is collapsed."
package: "maz-ui"
---
# MazSidebarMenuButton
> Navigation button or link of a MazSidebar menu item, with icon, label, badge, and a tooltip when the sidebar is collapsed.
- Package: `maz-ui`
- Import: `import MazSidebarMenuButton from 'maz-ui/components/MazSidebarMenuButton'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazSidebar](./maz-sidebar.md): read its page for complete examples.
## MazSidebarMenuButton API
`import MazSidebarMenuButton from 'maz-ui/components/MazSidebarMenuButton'`
### Props
- `to` (`string | Record`): Route for router-link navigation.
- `href` (`string`): URL for anchor navigation.
- `icon` (`MazIconLike`): Icon to display before the label. Accepts a bare icon value (Vue component, raw SVG string, URL) or a full `MazIconProps` object for fine-grained control (size, title, fallback, …).
- `label` (`string`): Label text.
- `badge` (`MazSidebarMenuButtonBadge`): Badge content. Pass a `string`/`number` for a simple primary badge, or a full `MazBadgeProps` object (with optional `text`) to customise color, size, outlined, ….
- `tooltip` (`string`): Tooltip text. When provided, shows a tooltip on hover via the `v-tooltip` directive.
- `tooltip-mode` (`MazSidebarTooltipMode`): Controls when the tooltip should be displayed. - `always`: tooltip shows on hover regardless of the sidebar state - `closed`: tooltip only shows on hover when the sidebar is collapsed Overrides the parent `MazSidebar`'s `tooltipMode`. Falls back to the sidebar value (which defaults to `always`) when not provided.
- `active` (`boolean`): Whether the item is active (highlights with `aria-current="page"`).
- `disabled` (`boolean`): Whether the item is disabled.
- `size` (`"sm" | "md" | "lg"`, default: `"md"`): Size of the button.
### Events
- `@click` (payload: `event: MouseEvent`)
### Slots
- `#icon`
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-menu-item.md
---
---
title: "MazSidebarMenuItem"
description: "Item of a MazSidebarMenu: wraps a MazSidebarMenuButton and its optional MazSidebarMenuSub."
package: "maz-ui"
---
# MazSidebarMenuItem
> Item of a MazSidebarMenu: wraps a MazSidebarMenuButton and its optional MazSidebarMenuSub.
- Package: `maz-ui`
- Import: `import MazSidebarMenuItem from 'maz-ui/components/MazSidebarMenuItem'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
## MazSidebarMenuItem API
`import MazSidebarMenuItem from 'maz-ui/components/MazSidebarMenuItem'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-menu-sub.md
---
---
title: "MazSidebarMenuSub"
description: "Nested submenu of a MazSidebar menu item."
package: "maz-ui"
---
# MazSidebarMenuSub
> Nested submenu of a MazSidebar menu item.
- Package: `maz-ui`
- Import: `import MazSidebarMenuSub from 'maz-ui/components/MazSidebarMenuSub'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazSidebar](./maz-sidebar.md): read its page for complete examples.
## MazSidebarMenuSub API
`import MazSidebarMenuSub from 'maz-ui/components/MazSidebarMenuSub'`
### Props
- `label` (`string`): Label for the sub-menu trigger button.
- `icon` (`MazIconLike`): Icon to display before the label. Accepts a bare icon value (Vue component, raw SVG string, URL) or a full `MazIconProps` object for fine-grained control.
- `default-open` (`boolean`, default: `false`): Whether the sub-menu is open by default.
### Slots
- `#icon`
- `#label`
- `#chevron`
- `#default`
---
source: https://maz-ui.com/components/maz-sidebar-separator.md
---
---
title: "MazSidebarSeparator"
description: "Divider between the sections of MazSidebar."
package: "maz-ui"
---
# MazSidebarSeparator
> Divider between the sections of MazSidebar.
- Package: `maz-ui`
- Import: `import MazSidebarSeparator from 'maz-ui/components/MazSidebarSeparator'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
## MazSidebarSeparator API
`import MazSidebarSeparator from 'maz-ui/components/MazSidebarSeparator'`
### Props
No props.
---
source: https://maz-ui.com/components/maz-sidebar-trigger.md
---
---
title: "MazSidebarTrigger"
description: "Button that opens, closes or collapses MazSidebar."
package: "maz-ui"
---
# MazSidebarTrigger
> Button that opens, closes or collapses MazSidebar.
- Package: `maz-ui`
- Import: `import MazSidebarTrigger from 'maz-ui/components/MazSidebarTrigger'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
## MazSidebarTrigger API
`import MazSidebarTrigger from 'maz-ui/components/MazSidebarTrigger'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-skeleton.md
---
---
title: "MazSkeleton"
description: "MazSkeleton is a standalone component to display loading placeholders with animated shimmer effect"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-skeleton"
---
# MazSkeleton
> MazSkeleton is a standalone component to display loading placeholders with animated shimmer effect
- Package: `maz-ui`
- Import: `import MazSkeleton from 'maz-ui/components/MazSkeleton'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-skeleton
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Tip:**
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
## Basic usage
The skeleton displays a loading placeholder with a shimmer animation by default.
```vue
```
## Shapes
Use the `shape` prop to change the skeleton shape: `rectangle` (default), `circle`, or `square`.
```vue
```
## Sizes
Use the `size` prop to set both width and height (for circle and square shapes), or use `width` and `height` props for more control.
```vue
```
## Custom dimensions
For rectangles, use `width` and `height` props for precise control.
```vue
```
## Rounded sizes
Control the border radius using the `rounded-size` prop.
```vue
```
## Disable animation
Use the `animated` prop set to `false` to disable the shimmer animation.
```vue
```
## Card skeleton example
Combine multiple skeletons to create loading placeholders for complex layouts.
```vue
```
## Article skeleton example
Create an article loading placeholder with various skeleton elements.
```vue
```
## List skeleton example
Create a list loading placeholder.
```vue
```
## Accessibility
The component includes proper accessibility attributes:
- `role="status"` to indicate loading state
- `aria-live="polite"` for screen reader announcements
- Customizable `aria-label` and `loading-text` props
```vue
```
## MazSkeleton API
`import MazSkeleton from 'maz-ui/components/MazSkeleton'`
### Props
- `shape` (`"square" | "circle" | "rectangle"`, default: `"rectangle"`): Skeleton shape type.
- `size` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``, default: `"1rem"`): Size with units (ex: '2rem', '40px', '3em').
- `width` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``): Custom width.
- `height` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``): Custom height.
- `animated` (`boolean`, default: `true`): Disable animation.
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Controls the border radius. Values: `'none'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'full'` (non exhaustive).
- `aria-label` (`string`, default: `'skeleton.ariaLabel' (translations)`): Accessibility label.
- `loading-text` (`string`, default: `'skeleton.loadingText' (translations)`): Loading text for accessibility.
---
source: https://maz-ui.com/components/maz-slider.md
---
---
title: "MazSlider"
description: "MazSlider is a standalone component that replaces the standard html input range with a beautiful design system. Many options like multiple cursors and values, colors, sizes and logarithmic/exponential values are available"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-slider"
---
# MazSlider
> MazSlider is a standalone component that replaces the standard html input range with a beautiful design system. Many options like multiple cursors and values, colors, sizes and logarithmic/exponential values are available
- Package: `maz-ui`
- Import: `import MazSlider from 'maz-ui/components/MazSlider'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-slider
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
```
## Options
### Step
```html
```
### Multiple sliders & labels
```vue
```
### Sizes & colors
```vue
```
### Logarithmic/exponential
```vue
```
## hide dividers & cursor animation
> Each sections between cursors has the same color
>
> Component don't have animation on cursor
```vue
```
## Accessibility
Each cursor is a `slider` with `aria-valuenow`, `aria-valuemin`, `aria-valuemax` and `aria-valuetext` when `labels` are set.
**Keyboard**: ← / ↓ and → / ↑ move by one `step`, Page Down / Page Up by ten steps, Home / End to the lowest / highest value allowed for the cursor (a cursor never passes its neighbours).
## MazSlider API
`import MazSlider from 'maz-ui/components/MazSlider'`
### Props
- `model-value` (`number | number[] | null`, required, `v-model`): Array of cursors values.
- `labels` (`string[]`): array of cursors label.
- `min` (`number`, default: `0`): min value of sliders.
- `max` (`number`, default: `100`): max value of sliders.
- `step` (`number`, default: `1`): step value for slider increments.
- `size` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``): height size of slider bar.
- `divider` (`boolean`, default: `true`): remove div in different colors.
- `log` (`boolean`, default: `false`): become a logarithmic slider (exponential).
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): main slider color.
- `cursor-anim` (`boolean`, default: `true`): disables cursor animation when active.
### Events
- `@update:model-value` (payload: `any[`)
---
source: https://maz-ui.com/components/maz-spinner.md
---
---
title: "MazSpinner"
description: "MazSpinner is an animated loading indicator with the colors and sizes of the theme, to show that a content or an action is loading"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-spinner"
---
# MazSpinner
> MazSpinner is an animated loading indicator with the colors and sizes of the theme, to show that a content or an action is loading
- Package: `maz-ui`
- Import: `import MazSpinner from 'maz-ui/components/MazSpinner'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-spinner
## Basic usage
```vue
```
## Options
### Colors
Choose the color of the spinner
By default the color is `theme`
```vue
```
### Sizes
Choose the size of the spinner
The default size is `2em`
```vue
```
## MazSpinner API
`import MazSpinner from 'maz-ui/components/MazSpinner'`
### Props
- `size` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``, default: `"2em"`): The size of the spinner.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"theme"`): The color of the spinner.
---
source: https://maz-ui.com/components/maz-stepper.md
---
---
title: "MazStepper"
description: "MazStepper is a standalone UI component customizable, reactive for intuitive step-by-step navigation. Ideal for guiding users through forms, workflows, or checkout processes."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-stepper"
---
# MazStepper
> MazStepper is a standalone UI component customizable, reactive for intuitive step-by-step navigation. Ideal for guiding users through forms, workflows, or checkout processes.
- Package: `maz-ui`
- Import: `import MazStepper from 'maz-ui/components/MazStepper'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-stepper
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
**Details: View code**
```vue
Sign-In
You should be signed in to continue
Required
Delivery address
Where should we deliver your package?
{{ address }}
Previous
Validate
Checkout
Provide credit card
Previous
Payment
```
## Use `step` property instead of slots
Instead of using slots, you can provide its data with the `steps` property
You can use html in all properties
```vue{3-8}
Subtitle 2', titleInfo: 'Info 2', content: 'Content 2' },
{ title: 'Title 3', subtitle: 'Subtitle 3', titleInfo: 'Info 3', content: 'Content 3' },
{ title: 'Title 4', subtitle: 'Subtitle 4', titleInfo: 'Info 4', content: 'Content 4' },
]"
/>
```
## Replace default step point
```vue{8-10}
{{ step }}
```
## Set step states programmatically
You can set differents state with its style to each step with the property `step`
States available: `'success' | 'warning' | 'error' | 'disabled'`
You should respect order of steps in the array:
```vue{4-9}
Title 1
Disabled
Content 1
Title 2
Success
Content 2
Title 3
Warning & Disabled
Content 3
Title 4
Error
Content 4
```
## Auto validate steps
You can use the prop option:
- `auto-validate-steps`
Then all previous steps then the current and then the validated state
**Tip:**
Click on the first or third step to see the validated steps changes:
```vue{4}
Step 1
Content 1
Step 2
Content 2
Step 3
Content 3
```
## Auto disabled next or/and previous steps
To not allow your users to go to the next steps, you can use the following prop options:
- `disabled-previous-steps`
- `disabled-next-steps`
**Tip:**
Try to click on first and third steps
```vue{4,5}
Step 1
Content 1
Step 2
Content 2
Step 3
Content 3
```
## All steps opened & success
To open and validate all steps, you can use the following prop options:
- `all-steps-validated`
- `all-steps-opened`
## Can close steps
Use the property `can-close-steps` to let the user be able to close each step on click
**Tip:**
Click on step titles to toggle content
## Types
`step` property model
```ts
type Steps = Array<{
title?: string
subtitle?: string
titleInfo?: string
disabled?: boolean
error?: boolean
success?: boolean
warning?: boolean
}>
```
## Accessibility
Each step header is a button exposing the current step (`aria-current="step"`) and its open state (`aria-expanded`), and controls its content (`aria-controls`), labelled by the header. The ids are unique per instance.
## MazStepper API
`import MazStepper from 'maz-ui/components/MazStepper'`
### Props
- `model-value` (`number`, `v-model`): The current step.
- `steps` (`MazStepperStep[]`): The steps.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the stepper.
- `disabled-next-steps` (`boolean`): Disable the next steps.
- `disabled-previous-steps` (`boolean`): Disable the previous steps.
- `auto-validate-steps` (`boolean`): Auto validate the steps.
- `all-steps-opened` (`boolean`): Open all steps.
- `all-steps-validated` (`boolean`): Validate all steps.
- `can-close-steps` (`boolean`): Allow to close the steps.
### Events
- `@update:model-value` (payload: `value: number`)
### Slots
- `#point` Bindings: `step: number`.
- `#icon-{step}`: One slot per `step`: `#icon-`.
- `#title-{step}`: One slot per `step`: `#title-`.
- `#subtitle-{step}`: One slot per `step`: `#subtitle-`.
- `#title-info-{step}`: One slot per `step`: `#title-info-`.
- `#content-{step}`: One slot per `step`: `#content-`.
---
source: https://maz-ui.com/components/maz-switch.md
---
---
title: "MazSwitch"
description: "MazSwitch is a standalone component that replaces the standard html input checkbox. Color options are available."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-switch"
---
# MazSwitch
> MazSwitch is a standalone component that replaces the standard html input checkbox. Color options are available.
- Package: `maz-ui`
- Import: `import MazSwitch from 'maz-ui/components/MazSwitch'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-switch
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
```vue
Disabled
{{ color }}
```
## MazSwitch API
`import MazSwitch from 'maz-ui/components/MazSwitch'`
### Props
- `model-value` (`boolean`, default: `false`, `v-model`): The model value of the switch.
- `id` (`string`): The id of the switch.
- `disabled` (`boolean`): If the switch is disabled.
- `name` (`string`): The name of the switch.
- `label` (`string`): Text label.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the switch.
- `error` (`boolean`): Whether there is an error with the input.
- `success` (`boolean`): Whether the input is successful.
- `warning` (`boolean`): Whether there is a warning with the input.
- `hint` (`string`): The hint text to display below the input.
### Events
- `@update:model-value` (payload: `value: boolean`): Emitted when the model value changes
- `@blur` (payload: `value: FocusEvent`): Emitted when the switch lost focus
- `@change` (payload: `value: boolean`): Emitted when the model value changes
- `@focus` (payload: `value: FocusEvent`): Emitted when the switch is focused
### Slots
- `#default`: The label of the switch Bindings: `value: boolean` (The value of the switch).
---
source: https://maz-ui.com/components/maz-table.md
---
---
title: "MazTable"
description: "MazTable is designed to be a reusable data table with advanced features. Pagination, Search, Column Sorting, Row Selection, UI options, Loading and Slots."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-table"
---
# MazTable
> MazTable is designed to be a reusable data table with advanced features. Pagination, Search, Column Sorting, Row Selection, UI options, Loading and Slots.
- Package: `maz-ui`
- Import: `import MazTable from 'maz-ui/components/MazTable'` or `import MazTableCell from 'maz-ui/components/MazTableCell'` or `import MazTableRow from 'maz-ui/components/MazTableRow'` or `import MazTableTitle from 'maz-ui/components/MazTableTitle'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-table
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Key Features
1. Pagination (prop `pagination`)
* The component supports pagination with buttons to go to the first, previous, next, and last page.
* You can display only the pagination elements (input and buttons) and make API calls to your server to get elements by using the prop `pagination` with `no-paginate-rows`.
2. Search (prop `search`): It includes a search feature with a search bar where users can enter a query to filter displayed data. You can choose the column where the search will be activated.
3. Column Sorting (prop: `sortable`): Columns are sortable, indicated by arrow icons. Sorting can be activated by clicking on the column header.
4. Row Selection (prop `select-value="key"`): There is a dedicated column for selection with a checkbox for each row. Users can individually or collectively select/deselect rows.
5. Customizable Page Size: Users can choose the number of items to display per page using a dropdown list.
6. Loading Indicator (prop `loading`): A loading indicator (MazLoadingBar) is displayed when data is being loaded.
7. Animated rows (props `animated-rows` + `row-key`): rows slide to their new position when the order changes (FLIP animation). Respects `prefers-reduced-motion`.
8. Virtualization (prop `virtualized`): render only the rows visible in the viewport (plus an overscan) so the table stays fast with thousands of rows.
## Available models
* v-model: `(string | boolean | number)[] | undefined` (list of selected key)
* v-model:search-query: `string | undefined`
* v-model:page: `number`
* v-model:page-size: `number`
## Basic usage
You can use MazTable and his child component to build a simple table and enjoy the style.
```vue
1
John
Doe
99
2
Doe
John
30
```
## Advanced data table
You can also provide all your data, the table is auto-generated and you can use the features listed on top
---
```vue
{{value}}
{{value}}
{{value}}
```
## Animated rows
Enable `animated-rows` to make rows slide to their new position when the order changes (FLIP animation) - perfect for live leaderboards or sortable lists. Provide a stable `row-key` (a field uniquely identifying each row) so every row keeps its identity across reorders. The animation is automatically disabled when the user prefers reduced motion.
```vue
Shuffle
```
## Virtualization
Enable `virtualized` to render only the rows inside the viewport (plus an overscan) instead of every row. This keeps the table fast and the DOM light even with tens of thousands of rows. It works in `rows` mode (data-driven), and `@tanstack/vue-virtual` is loaded on demand - pages that never virtualize a table never ship it.
The example below renders **10 000 rows** but only keeps ~20 `` in the DOM at any time.
```vue
```
### Options
| Prop | Default | Description |
| --- | --- | --- |
| `virtualized` | `false` | Turns virtualization on. |
| `max-height` | - | **Required.** Bounds the scroll viewport (any CSS length, e.g. `'400px'`, `'70vh'`). Scrolling is enabled automatically and the header stays sticky. |
| `estimated-row-height` | `44` | Fixed row height (in px) used to place rows and size the spacers. Set it to your real row height; virtualized rows should be uniform (single line). |
| `overscan` | `10` | Rows rendered outside the viewport on each side. |
### Good to know
* **Set a `width` (or `minWidth`) on your headers.** Virtualization forces `table-layout: fixed` so columns stay aligned across the rendered window; without widths the browser distributes them equally.
* **Accessibility:** the table exposes `aria-rowcount` and each rendered row an `aria-rowindex`, so screen readers still announce "row X of N".
* **Ignored** (with a dev warning) when `animated-rows` is enabled or when you provide a custom default slot - those paths render every row.
* **Rendered client-side:** the virtualized body is empty during SSR and fills in on hydration.
## Loading
Enable the loading state with the prop `loading`
```html{2}
...
```
## Sizing
Available sizes: `'mini' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'`
```html
...
...
...
```
```ts
type Row = Record & {
selected?: boolean
action?: (row: Row) => unknown
classes?: HTMLAttributes['class']
}
```
```ts
export interface MazTableHeadersEnriched {
label: string
key?: string
sortable?: boolean
hidden?: boolean
srOnly?: boolean
width?: string
maxWidth?: string
minWidth?: string
classes?: ThHTMLAttributes['class']
scope?: ThHTMLAttributes['scope']
align?: ThHTMLAttributes['align']
rowspan?: ThHTMLAttributes['rowspan']
colspan?: ThHTMLAttributes['colspan']
headers?: ThHTMLAttributes['headers']
}
```
---
source: https://maz-ui.com/components/maz-table-cell.md
---
---
title: "MazTableCell"
description: "Cell of a MazTableRow, with the size and padding of MazTable."
package: "maz-ui"
---
# MazTableCell
> Cell of a MazTableRow, with the size and padding of MazTable.
- Package: `maz-ui`
- Import: `import MazTableCell from 'maz-ui/components/MazTableCell'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazTable](./maz-table.md): read its page for complete examples.
## MazTableCell API
`import MazTableCell from 'maz-ui/components/MazTableCell'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-table-row.md
---
---
title: "MazTableRow"
description: "Row of MazTable, when you write the rows by hand in its default slot."
package: "maz-ui"
---
# MazTableRow
> Row of MazTable, when you write the rows by hand in its default slot.
- Package: `maz-ui`
- Import: `import MazTableRow from 'maz-ui/components/MazTableRow'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazTable](./maz-table.md): read its page for complete examples.
## MazTableRow API
`import MazTableRow from 'maz-ui/components/MazTableRow'`
### Props
- `hoverable` (`boolean`, default: `true`): Override hoverable of table props.
- `is-head` (`boolean`, default: `false`): If true, the row is a head row.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-table-title.md
---
---
title: "MazTableTitle"
description: "Header cell of MazTable, when you write the header by hand."
package: "maz-ui"
---
# MazTableTitle
> Header cell of MazTable, when you write the header by hand.
- Package: `maz-ui`
- Import: `import MazTableTitle from 'maz-ui/components/MazTableTitle'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazTable](./maz-table.md): read its page for complete examples.
## MazTableTitle API
`import MazTableTitle from 'maz-ui/components/MazTableTitle'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-table-virtualizer.md
---
---
title: "MazTableVirtualizer"
description: "Renderless provider loaded on demand by MazTable to virtualize long lists of rows."
package: "maz-ui"
---
# MazTableVirtualizer
> Renderless provider loaded on demand by MazTable to virtualize long lists of rows.
- Package: `maz-ui`
- Import: `import MazTableVirtualizer from 'maz-ui/components/MazTableVirtualizer'`
## MazTableVirtualizer API
`import MazTableVirtualizer from 'maz-ui/components/MazTableVirtualizer'`
### Props
- `count` (`number`, required): Total number of rows to virtualize.
- `scroll-element` (`HTMLElement | null`, default: `null`): Scrollable viewport element the virtualizer observes.
- `estimate-size` (`number`, default: `44`): Fixed per-row height used to place rows and size the spacers.
- `overscan` (`number`, default: `10`): Rows rendered outside the viewport on each side.
### Events
- `@change` (payload: `window: MazTableVirtualWindow`)
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-tabs.md
---
---
title: "MazTabs"
description: "MazTabs is a standalone component to display content in tabs with animations"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-tabs"
---
# MazTabs
> MazTabs is a standalone component to display content in tabs with animations
- Package: `maz-ui`
- Import: `import MazTabs from 'maz-ui/components/MazTabs'` or `import MazTabsBar from 'maz-ui/components/MazTabsBar'` or `import MazTabsContent from 'maz-ui/components/MazTabsContent'` or `import MazTabsContentItem from 'maz-ui/components/MazTabsContentItem'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-tabs
## Basic usage
```vue
Tab 1
Tab 2
Tab 3
```
## With model-value
**Details: View code**
```vue
Tab 1
Tab 2
Tab 3
Set model-value to {{ currentTab === 1 ? 2 : 1 }}
```
## Persistent tab
To keep the tab current when the page reloads, you can use the `persistent` props on the component ` `.
The component will save the current table index in the URL of the page via a query parameter.
You can choose the name of this query parameter with the props `query-param` `@default 'tab'`
## Custom tabs with slot
```html
{{ item.label }}
{{ index }}
```
## Size and rounded size
Each tab is rendered with a [`MazBtn`](./maz-btn.md), so you can control its `size` (`MazSize`) and `rounded-size` (`MazRoundedSize`, applied to the bar, the indicator and each tab).
These props can be set on `MazTabsBar` directly, or on `MazTabs` which forwards them to its `MazTabsBar`. They are also globalizable through the [global defaults](../guide/global-defaults.md) (`MazTabsBar` or `global` entry).
```vue
```
Each item can also override the `size` and `rounded-size` (and accepts every other [`MazBtn`](./maz-btn.md) prop, except `active`, `block`, `type`, `loading` and `fab`).
## Active color
The active tab is highlighted by the indicator. Use the `color` prop (`MazColor`) on `MazTabsBar` (or on `MazTabs`, which forwards it) to color it. When omitted, the default neutral indicator is used.
```vue
```
## Standalone usage
`MazTabsBar` can be used on its own, without `MazTabs`, as an independent switcher with its own `v-model`.
**Tip: Nested inside a `MazTabs`**
If your page is already wrapped by a `MazTabs`, a nested `MazTabsBar` would otherwise be linked to that parent (clicking a tab would change the page). Add the `standalone` prop to make it fully independent (it then ignores the parent's selection, size, rounded-size and color):
```vue
```
The model returns the `1`-based index of the selected tab, unless the items provide a `value` (`string | number`), in which case that value is returned. The model type is inferred from the items passed: declare the items `as const` (or with literal `value`s) to get a strict union type for the model and the `@update:model-value` event.
```vue
```
When no `value` is set on the items, the model is a number (the `1`-based index):
```vue
```
## Types
```ts
type MazTabsBarItem
// Inherits all MazBtn props except 'active' | 'block' | 'type' | 'loading' | 'fab'
= | (Omit & {
/**
* Label of the tab
*/
label: string
/**
* Value returned by the model when the tab is selected (standalone usage).
* When omitted, the model returns the 1-based index of the tab.
*/
value?: Value
/**
* Will disable the tab
* @default false
*/
disabled?: boolean
/**
* Badge to display in the tab
* Inherit all props of MazBadge component
*/
badge?: MazBadgeProps & {
/**
* Content of the badge
*/
content: string | number | boolean
}
})
| string
```
## Accessibility
The tabs follow the [WAI-ARIA tabs pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/):
- `MazTabsBar` is a `tablist` (pass an `aria-label` to name it), each item is a `tab` with `aria-selected`, linked to its `MazTabsContentItem` (`tabpanel`) through `aria-controls` / `aria-labelledby`.
- **Keyboard**: only the selected tab is in the tab sequence, ← / → select the previous / next tab (reversed in RTL), Home / End the first / last one. Disabled tabs are skipped.
## Props & Events emitted
## MazTabs
## MazTabs API
`import MazTabs from 'maz-ui/components/MazTabs'`
### Props
- `model-value` (`number`, `v-model`): The the selected tab number.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): Size of the tabs, forwarded to MazTabsBar (and each tab button).
- `rounded-size` (`MazRoundedSize`): Size of the rounded, forwarded to MazTabsBar. Values: `'none'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'full'` (non exhaustive).
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`): Color of the active tab indicator, forwarded to MazTabsBar.
### Events
- `@update:model-value` (payload: `value: number`): Emitted when the selected tab change
### Slots
- `#default`
## MazTabsBar
## MazTabsBar API
`import MazTabsBar from 'maz-ui/components/MazTabsBar'`
### Props
- `items` (`readonly Item[]`, required): The items to display in the tabs bar.
- `model-value` (`MazTabsBarItemValue- `, `v-model`): Selected tab (standalone usage, without MazTabs). Holds the item `value` when provided, otherwise the 1-based index. Pass items `as const` (or with literal `value`) to infer a union type.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): Size of the tabs (forwarded to each MazBtn).
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Size of the rounded applied to the bar, the indicator and each tab. Values: `'none'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'full'` (non exhaustive).
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`): Color of the active tab indicator. When omitted, the default neutral indicator is used.
- `standalone` (`boolean`, default: `false`): Force the standalone mode: the tabs bar ignores any surrounding `MazTabs` (selection, size, rounded-size and color are no longer inherited) and is driven only by its own `v-model`. Useful for a nested switcher inside a page already wrapped by `MazTabs`.
- `persistent` (`boolean`, default: `false`): Will add a query param to the url to keep the selected tab on page refresh.
- `query-param` (`string`, default: `"tab"`): The name of the query param to add to the url.
- `block` (`boolean`, default: `false`): Will make the tabs bar full width.
- `elevation` (`boolean`, default: `false`): Will remove the elevation.
- `auto-scroll` (`boolean`, default: `true`): Will add a scroll on the tabs bar to show selected element.
- `bordered` (`boolean`, default: `true`): Will add a border to the tabs bar.
### Events
- `@update:model-value` (payload: `value: MazTabsBarItemValue
- `): Emitted when the selected tab changes (standalone usage).
### Slots
- `#item`: Content of item to display in the tabs bar Bindings: `item: { label: Item & string; value: string | number | undefined; disabled: boolean; size: "xs" | "sm" | "md" | "lg" | "xl" | "mini" | undefined; roundedSize: MazRoundedSize | undefined; color: NonNullable<"primary" | "secondary" | "accent" | ...` (all data of the item), `active: boolean` (`true` if the tab is active), `index: number` (index of the item).
- `#badge-content`: Content in the badge Bindings: `content: string | number | boolean` (content of the badge provided in item).
## MazTabsContent
## MazTabsContent API
`import MazTabsContent from 'maz-ui/components/MazTabsContent'`
### Props
No props.
### Slots
- `#default`
## MazTabsContentItem
## MazTabsContentItem API
`import MazTabsContentItem from 'maz-ui/components/MazTabsContentItem'`
### Props
- `tab` (`number`, required)
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-tabs-bar.md
---
---
title: "MazTabsBar"
description: "Bar of tab buttons of MazTabs."
package: "maz-ui"
---
# MazTabsBar
> Bar of tab buttons of MazTabs.
- Package: `maz-ui`
- Import: `import MazTabsBar from 'maz-ui/components/MazTabsBar'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazTabs](./maz-tabs.md): read its page for complete examples.
## MazTabsBar API
`import MazTabsBar from 'maz-ui/components/MazTabsBar'`
### Props
- `items` (`readonly Item[]`, required): The items to display in the tabs bar.
- `model-value` (`MazTabsBarItemValue
- `, `v-model`): Selected tab (standalone usage, without MazTabs). Holds the item `value` when provided, otherwise the 1-based index. Pass items `as const` (or with literal `value`) to infer a union type.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): Size of the tabs (forwarded to each MazBtn).
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Size of the rounded applied to the bar, the indicator and each tab. Values: `'none'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'full'` (non exhaustive).
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`): Color of the active tab indicator. When omitted, the default neutral indicator is used.
- `standalone` (`boolean`, default: `false`): Force the standalone mode: the tabs bar ignores any surrounding `MazTabs` (selection, size, rounded-size and color are no longer inherited) and is driven only by its own `v-model`. Useful for a nested switcher inside a page already wrapped by `MazTabs`.
- `persistent` (`boolean`, default: `false`): Will add a query param to the url to keep the selected tab on page refresh.
- `query-param` (`string`, default: `"tab"`): The name of the query param to add to the url.
- `block` (`boolean`, default: `false`): Will make the tabs bar full width.
- `elevation` (`boolean`, default: `false`): Will remove the elevation.
- `auto-scroll` (`boolean`, default: `true`): Will add a scroll on the tabs bar to show selected element.
- `bordered` (`boolean`, default: `true`): Will add a border to the tabs bar.
### Events
- `@update:model-value` (payload: `value: MazTabsBarItemValue
- `): Emitted when the selected tab changes (standalone usage).
### Slots
- `#item`: Content of item to display in the tabs bar Bindings: `item: { label: Item & string; value: string | number | undefined; disabled: boolean; size: "xs" | "sm" | "md" | "lg" | "xl" | "mini" | undefined; roundedSize: MazRoundedSize | undefined; color: NonNullable<"primary" | "secondary" | "accent" | ...` (all data of the item), `active: boolean` (`true` if the tab is active), `index: number` (index of the item).
- `#badge-content`: Content in the badge Bindings: `content: string | number | boolean` (content of the badge provided in item).
---
source: https://maz-ui.com/components/maz-tabs-content.md
---
---
title: "MazTabsContent"
description: "Container of the tab panels of MazTabs."
package: "maz-ui"
---
# MazTabsContent
> Container of the tab panels of MazTabs.
- Package: `maz-ui`
- Import: `import MazTabsContent from 'maz-ui/components/MazTabsContent'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazTabs](./maz-tabs.md): read its page for complete examples.
## MazTabsContent API
`import MazTabsContent from 'maz-ui/components/MazTabsContent'`
### Props
No props.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-tabs-content-item.md
---
---
title: "MazTabsContentItem"
description: "Panel of MazTabs displayed when its tab is active."
package: "maz-ui"
---
# MazTabsContentItem
> Panel of MazTabs displayed when its tab is active.
- Package: `maz-ui`
- Import: `import MazTabsContentItem from 'maz-ui/components/MazTabsContentItem'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
Used inside [MazTabs](./maz-tabs.md): read its page for complete examples.
## MazTabsContentItem API
`import MazTabsContentItem from 'maz-ui/components/MazTabsContentItem'`
### Props
- `tab` (`number`, required)
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-textarea.md
---
---
title: "MazTextarea"
description: "MazTextarea is a standalone component that replaces the standard html textarea input with a beautiful design system. Many options like colors, disabled, error, warning, success and error messages are available."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-textarea"
---
# MazTextarea
> MazTextarea is a standalone component that replaces the standard html textarea input with a beautiful design system. Many options like colors, disabled, error, warning, success and error messages are available.
- Package: `maz-ui`
- Import: `import MazTextarea from 'maz-ui/components/MazTextarea'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-textarea
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Note:**
This component uses the native CSS `field-sizing: content` property for autogrow - the textarea expands automatically as the user types, with zero JavaScript overhead.
## Basic usage
```vue
```
## With top-label
You can use the `top-label` attribute to display a top label above the textarea.
```html
```
## With assistive text
You can use the `assistive-text` attribute to display a assistive text below the textarea.
```html
```
## With label and append slots
You can use the `label` and `append` slots to customize the label and the append element.
```vue
The custom label
```
## With hint and state
You can use the `hint` attribute to display a hint message. This will replace the label.
```vue
```
## Disable autogrow
By default, the textarea automatically expands as the user types. You can disable this behavior with the `autogrow` prop set to `false` - the textarea will then have a fixed height with a manual resize handle.
```html
```
## Minimum rows (compact / input-like)
Use the `min-rows` prop to control the initial (minimum) height of the textarea. It defaults to `3` lines. Set it to `1` to make the textarea start at the height of a regular input while keeping the autogrow behavior: it grows line by line as the user types.
```vue
```
## Sizes
The `size` prop controls the padding (height) and text size of the textarea, mirroring the `MazInput` sizes (`mini`, `xs`, `sm`, `md`, `lg`, `xl`). Combined with `:min-rows="1"`, a given size matches the height of a `MazInput` of the same size, while keeping the autogrow behavior.
```vue
```
## Disabled
```html
```
## MazTextarea API
`import MazTextarea from 'maz-ui/components/MazTextarea'`
### Props
- `model-value` (`T`, `v-model`): The value of the textarea.
- `id` (`string`): The id of the textarea.
- `name` (`string`, default: `"MazTextarea"`): The name of the textarea.
- `label` (`string`): The label of the textarea.
- `placeholder` (`string`): The placeholder of the textarea.
- `required` (`boolean`, default: `false`): If the textarea is required.
- `disabled` (`boolean`, default: `false`): If the textarea is disabled.
- `readonly` (`boolean`, default: `false`): If the textarea is readonly.
- `error` (`boolean`, default: `false`): If the textarea has an error.
- `success` (`boolean`, default: `false`): If the textarea has a success.
- `warning` (`boolean`, default: `false`): If the textarea has a warning.
- `hint` (`string`): The hint of the textarea.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the textarea.
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Size radius of the component's border.
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): Controls the padding (height) and text size of the textarea, mirroring MazInput sizes. Combined with `minRows`, e.g. `size="md" :min-rows="1"` matches a regular input height.
- `padding` (`boolean`, default: `true`): If the textarea has a padding.
- `transparent` (`boolean`, default: `false`): If the textarea has a transparent background.
- `border` (`boolean`, default: `true`): If the textarea has no border.
- `autogrow` (`boolean`, default: `true`): If the textarea should autogrow based on its content.
- `min-rows` (`number`, default: `3`): Minimum number of rows displayed by the textarea (initial/minimum height). With autogrow enabled, the textarea still grows beyond this with its content.
- `append-justify` (`"center" | "end" | "start" | "space-between" | "space-around" | "space-evenly"`, default: `"end"`): The alignment of the append slot.
- `top-label` (`string`): Static label displayed above the textarea. Unlike the floating label, this remains fixed.
- `assistive-text` (`string`): Helper text displayed below the input to provide additional context or validation feedback.
### Events
- `@update:model-value` (payload: `T | undefined`): Emitted when the value of the textarea change
- `@input` (payload: `T | undefined`): Emitted when the value of the textarea change
- `@focus` (payload: `FocusEvent`): Emitted when the textarea is focused
- `@blur` (payload: `FocusEvent`): Emitted when the textarea is blurred
- `@change` (payload: `Event`): Emitted when the textarea value change
### Slots
- `#label`
- `#append`
---
source: https://maz-ui.com/components/maz-ticker.md
---
---
title: "MazTicker"
description: "MazTicker is a scrolling ticker component that continuously animates content in a loop with configurable speed, direction, pause controls, and gradient overlays"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-ticker"
---
# MazTicker
> MazTicker is a scrolling ticker component that continuously animates content in a loop with configurable speed, direction, pause controls, and gradient overlays
- Package: `maz-ui`
- Import: `import MazTicker from 'maz-ui/components/MazTicker'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-ticker
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
## Basic usage
```vue
Vue 3
Nuxt 3
TypeScript
TailwindCSS
Maz UI
```
## Screenshots gallery
A vertical ticker with images, similar to a screenshot showcase. Uses `orientation="vertical"` with `pause-on-hover` for user-friendly browsing.
```vue
```
## 3D Screenshots showcase
Create an eye-catching 3D perspective effect with tilted vertical tickers, inspired by the Nuxt UI Marquee screenshots demo.
```vue
```
## Orientation
### Horizontal (default)
By default, the ticker will scroll horizontally.
```vue
Item 1
Item 2
Item 3
```
### Vertical
Otherwise, the ticker will scroll vertically.
```vue
```
## Reverse direction
```vue
Normal direction
Reverse direction
```
## Speed control
Control the animation speed with the `duration` prop (in seconds). Lower values = faster.
```vue
Fast (5s)
Normal (20s)
Slow (40s)
```
## Repeat
The `repeat` prop controls how many times the content is duplicated to create a seamless loop. The default value is `4`. Increase it when your content is short to avoid visible gaps during the animation.
```vue
Repeat 2
Repeat 10
```
## Custom gap
```vue
Small gap
Large gap
```
## Overlay
### Without overlay
You can disable the overlay by setting the `overlay` prop to `false`.
```vue
No gradient overlay
```
### Custom overlay size
You can change the size of the overlay by setting the `overlay-size` prop to a CSS value.
```vue
Small overlay (10%)
Large overlay (50%)
```
## Pause controls
### Pause on hover
When a child element is hovered, the animation will pause.
```vue
Hover me to pause
```
### Pause on focus
When a child element is focused, the animation will pause.
```vue
Focusable link 1
Focusable link 2
Focusable link 3
```
### Programmatic pause
You can control the animation programmatically with the `paused` prop.
```vue
{{ isPaused ? 'Resume' : 'Pause' }}
Controlled by button
```
## Custom content
MazTicker accepts any HTML content, not just text.
```vue
Vue 3
Nuxt 3
TypeScript
TailwindCSS
Maz UI
```
## Slots
### Before and after
Replace the default before and after slots with custom content.
```vue
Latest:
Breaking news item
End
```
## Timing function
```vue
Linear (default)
Ease in out
```
## MazTicker API
`import MazTicker from 'maz-ui/components/MazTicker'`
### Props
- `orientation` (`MazTickerOrientation`, default: `"horizontal"`): Scrolling direction. Values: `'horizontal'`, `'vertical'` (non exhaustive).
- `reverse` (`boolean`, default: `false`): Reverse the scrolling direction.
- `duration` (`number`, default: `20`): Duration of one full animation cycle in seconds.
- `gap` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}%` ``, default: `"1rem"`): Gap between repeated content blocks (CSS value).
- `repeat` (`number`, default: `4`): Number of times the content is duplicated for seamless looping.
- `pause-on-hover` (`boolean`, default: `false`): Pause animation on mouse hover.
- `pause-on-focus` (`boolean`, default: `false`): Pause animation when a child element receives focus.
- `paused` (`boolean`, default: `false`): Programmatic pause control - takes precedence over pauseOnHover and pauseOnFocus.
- `overlay` (`boolean`, default: `true`): Show gradient overlays on edges to fade content in/out.
- `overlay-size` (`` `${number}rem` | `${number}px` | `${number}em` | `${number}vw` | `${number}vh` | `${number}vmin` | `${number}vmax` | `${number}%` | `${number}ch` | `${number}cm` | `${number}mm` | `${number}in` | `${number}ex` | `${number}pc` | `${number... ``, default: `"33%"`): Size of the gradient overlay zones (CSS value).
- `animation-timing-function` (`string`, default: `"linear"`): CSS animation timing function.
### Slots
- `#before`: Static content before the scrolling area
- `#overlay-start`: Custom overlay for the start edge (left in horizontal, top in vertical). Replaces default gradient.
- `#default`: Content to scroll (repeated for seamless animation)
- `#overlay-end`: Custom overlay for the end edge (right in horizontal, bottom in vertical). Replaces default gradient.
- `#after`: Static content after the scrolling area
---
source: https://maz-ui.com/components/maz-timeline.md
---
---
title: "MazTimeline"
description: "MazTimeline is a step/progress timeline component for Vue 3 with support for horizontal, vertical, and responsive layouts, customizable colors, sizes, step states, and scoped slots"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-timeline"
---
# MazTimeline
> MazTimeline is a step/progress timeline component for Vue 3 with support for horizontal, vertical, and responsive layouts, customizable colors, sizes, step states, and scoped slots
- Package: `maz-ui`
- Import: `import MazTimeline from 'maz-ui/components/MazTimeline'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-timeline
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
---
Control the current step:
## Basic usage
```vue
```
## Directions
### Horizontal
```vue
```
### Vertical
```vue
```
### Auto (responsive)
The default direction is `'auto'`, which switches from horizontal to vertical based on the `breakpoint` prop (default: `'768px'`).
```vue
```
## Colors
Use the `color` prop to change the theme color.
```vue
```
## Sizes
Use the `size` prop to change the indicator size.
```vue
```
## Step states
Each step can have a manual `state` property: `'completed'`, `'active'`, `'error'`, `'warning'`, or `'pending'`.
```vue
```
## Clickable
Enable `clickable` to allow users to navigate between steps by clicking on them. The `click-step` event is emitted with the step index.
```vue
```
## Disabled steps
Individual steps can be disabled by setting `disabled: true` on the step object.
```vue
```
## Without step numbers
Hide the step numbers inside indicators with `:show-step-numbers="false"`.
```vue
```
## Without auto-validate
By default, completed steps show a checkmark. Disable this with `:auto-validate-steps="false"`.
```vue
```
## Rounded sizes
Customize the indicator border radius with the `rounded-size` prop.
```vue
```
## Custom Icons
```vue
```
## Custom slots
MazTimeline provides scoped slots for full customization.
### Indicator slot
```vue
{{ index + 1 }}.
```
### Content slot
```vue
{{ step.title }}
Step {{ index + 1 }} - {{ state }}
```
### Connector slot
```vue
---
```
## MazTimeline API
`import MazTimeline from 'maz-ui/components/MazTimeline'`
### Props
- `model-value` (`number`, `v-model`): Index of the active step (v-model).
- `steps` (`MazTimelineItem[]`, required): Array of timeline steps to display.
- `direction` (`MazTimelineDirection`, default: `"auto"`): Layout direction of the timeline - `'horizontal'`: always horizontal - `'vertical'`: always vertical - `'auto'`: horizontal above breakpoint, vertical below. Values: `'horizontal'`, `'vertical'`, `'auto'` (non exhaustive).
- `breakpoint` (`string`, default: `"768px"`): CSS media breakpoint for auto direction (below this value → vertical).
- `color` (`MazTimelineColor`, default: `"primary"`): Color theme for active and completed steps. Values: `'primary'`, `'secondary'`, `'accent'`, `'info'`, `'success'`, `'warning'`, `'destructive'`, `'contrast'` (non exhaustive).
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `'md'`): Size of the step indicators and typography.
- `show-step-numbers` (`boolean`, default: `true`): Show step numbers inside the indicators.
- `auto-validate-steps` (`boolean`, default: `true`): Automatically show a checkmark icon for completed steps.
- `clickable` (`boolean`, default: `false`): Enable click interaction on steps.
- `animated` (`boolean`, default: `true`): Enable animations (pulse on active, state transitions, connector progress).
- `rounded-size` (`MazTimelineRoundedSize`, default: `'md'`): Border radius of step indicators. Values: `'none'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'2xl'`, `'3xl'`, `'full'` (non exhaustive).
### Events
- `@update:model-value` (payload: `value: number`): Emitted when the active step changes
- `@click-step` (payload: `payload: { step: MazTimelineItem; index: number; }`): Emitted when a clickable step is clicked
### Slots
- `#indicator`: Custom content for the step indicator circle Bindings: `step: MazTimelineItem` (The step data), `index: number` (The step index), `state: MazTimelineStepState` (The resolved step state), `isActive: boolean`, `isCompleted: boolean`.
- `#content`: Full custom content area replacing title and subtitle Bindings: `step: MazTimelineItem` (The step data), `index: number` (The step index), `state: MazTimelineStepState` (The resolved step state), `isActive: boolean`, `isCompleted: boolean`.
- `#title`: Custom title content Bindings: `step: MazTimelineItem` (The step data), `index: number` (The step index), `state: MazTimelineStepState` (The resolved step state).
- `#subtitle`: Custom subtitle content Bindings: `step: MazTimelineItem` (The step data), `index: number` (The step index), `state: MazTimelineStepState` (The resolved step state).
- `#connector`: Custom connector between steps Bindings: `index: number` (The index of the step before this connector), `isCompleted: boolean`, `isActive: boolean`.
---
source: https://maz-ui.com/components/maz-ui-provider.md
---
---
title: "MazUiProvider"
description: "Component alternative to the MazUi plugin: provides the theme, the translations and the default props of maz-ui to its subtree (lazy loaded pages, scoped themes)."
package: "maz-ui"
---
# MazUiProvider
> Component alternative to the MazUi plugin: provides the theme, the translations and the default props of maz-ui to its subtree (lazy loaded pages, scoped themes).
- Package: `maz-ui`
- Import: `import MazUiProvider from 'maz-ui/components/MazUiProvider'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
## MazUiProvider API
`import MazUiProvider from 'maz-ui/components/MazUiProvider'`
### Props
- `theme` (`MazUiThemeOptions & { preset: ThemePreset; }`, required)
- `translations` (`MazUiProviderTranslations`, required): Must include `locale` and at least the messages for that locale in `messages`.
### Slots
- `#default`
---
source: https://maz-ui.com/components/maz-window-mockup.md
---
---
title: "MazWindowMockup"
description: "MazWindowMockup renders a macOS-style window frame in three variants - browser, terminal, and editor - to showcase content, demos, or code examples in your documentation or UI."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-window-mockup"
---
# MazWindowMockup
> MazWindowMockup renders a macOS-style window frame in three variants - browser, terminal, and editor - to showcase content, demos, or code examples in your documentation or UI.
- Package: `maz-ui`
- Import: `import MazWindowMockup from 'maz-ui/components/MazWindowMockup'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-window-mockup
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
**Note: Optional: shiki for code variants**
When you pass the `code` prop, `MazWindowMockup` mounts `MazCodeHighlight` internally for syntax highlighting. This requires the [`shiki`](https://shiki.style) optional peer dependency to be installed. See the [MazCodeHighlight installation note](./maz-code-highlight.md#installation-requirement).
## Browser variant
The default variant. Displays an address bar with the `url` prop and a copy-URL button on the right side of the bar.
```vue
Browser content goes here
```
### Hide the URL copy button
Set `:hide-url-copy="true"` to remove the copy-URL button from the title bar.
```vue
```
### With screenshot
Use this variant to display a screenshot of a website.
```vue
```
## Terminal variant
Displays a centered title and a `$` prompt prefix in front of the code (when `code` is provided). The prompt prefix is **not** copied to the clipboard - the copy button only writes the raw `code` value.
```vue
```
### Custom prompt
Replace the default `$` with any character via the `prompt` prop.
```vue
```
### Without prompt
Hide the default prompt by setting `hide-prompt` to `true`.
```vue
```
## Editor variant
Shows a filename tab anchored to the bottom of the title bar - matching the look of real editors like VSCode.
```vue
```
## With code and language props
Pass `code` and `language` to display highlighted source code via `MazCodeHighlight`. The inner highlighter automatically renders with squared corners so it sits flush against the window's border.
```vue
```
## Empty-state placeholder
When neither `code` nor a slot content is provided, the content area renders an empty placeholder. Pass the optional `label` prop to display a centered text inside it.
```vue
```
## Custom translations
The URL copy button's aria-label and tooltip come from the `@maz-ui/translations` package (`windowMockup.copyUrlToClipboard` / `windowMockup.urlCopiedToClipboard`). Override per-instance with the `translations` prop:
```vue
```
For app-wide translations, set up the [maz-ui translations plugin](../ecosystem/translations.md) and the component will pick up your locale automatically.
## MazWindowMockup API
`import MazWindowMockup from 'maz-ui/components/MazWindowMockup'`
### Props
- `id` (`string`): Stable id used to scope the empty-state SVG pattern. Auto-generated if not provided.
- `variant` (`MazWindowMockupVariant`, default: `"browser"`): Window style variant. Values: `'browser'`, `'terminal'`, `'editor'` (non exhaustive).
- `url` (`string`, default: `"localhost"`): URL to display in the browser address bar (browser variant only).
- `filename` (`string`, default: `"index.vue"`): Filename to display in the editor tab (editor variant only).
- `title` (`string`, default: `"zsh"`): Title to display in the terminal title bar (terminal variant only).
- `min-height` (`string`): Minimum height of the content area as a CSS value (e.g. '200px').
- `code` (`string`): Source code to display using MazCodeHighlight. Takes priority over the default slot.
- `language` (`string`): Language identifier for syntax highlighting (e.g. 'vue', 'ts', 'bash').
- `label` (`string`): Label displayed inside the empty-state placeholder when no code and no slot content are provided.
- `hide-prompt` (`boolean`, default: `false`): Whether to hide the terminal prompt prefix (no-op on non-terminal variants).
- `prompt` (`string`, default: `"$"`): Prefix to display before the code in the terminal (terminal variant only).
- `hide-url-copy` (`boolean`, default: `false`): Hide the copy-to-clipboard button next to the URL bar (browser variant only).
- `translations` (`{ copyUrlToClipboard?: string | undefined; urlCopiedToClipboard?: string | undefined; }`): Custom translations for the component. Override either key independently.
### Slots
- `#default`: Free content (image, interface, etc.) shown when code prop is not set.
---
source: https://maz-ui.com/composables/use-aos.md
---
---
title: "useAos"
description: "Vue composable to access the AOS plugin instance (animations on scroll) in your components, to refresh or trigger the animations"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-aos"
---
# useAos
> Vue composable to access the AOS plugin instance (animations on scroll) in your components, to refresh or trigger the animations
- Package: `maz-ui`
- Import: `import { useAos } from 'maz-ui/composables/useAos'`
- Nuxt: auto-imported by `@maz-ui/nuxt` when `mazUi.plugins.aos` is enabled
- Web: https://maz-ui.com/composables/use-aos
**Warning:**
You must install the [aos plugin](../plugins/aos.md#install) before you start using it
**Tip:**
More info about the [aos plugin](../plugins/aos.md) can be found in its documentation
## Usage
```vue
```
---
source: https://maz-ui.com/composables/use-breakpoints.md
---
---
title: "useBreakpoints"
description: "This composable extends the functionality of the useWindowSize composable to manage responsive breakpoints"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-breakpoints"
---
# useBreakpoints
> This composable extends the functionality of the useWindowSize composable to manage responsive breakpoints
- Package: `maz-ui`
- Import: `import { useBreakpoints } from 'maz-ui/composables/useBreakpoints'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-breakpoints
## Basic usage
```ts
const breakpoints = {
'sm': '640px',
'md': '768px',
'lg': '1024px',
'xl': '1280px',
'2xl': '1536px',
}
const {
isLargeScreen,
isMediumScreen,
isSmallScreen,
} = useBreakpoints({
breakpoints,
initialWidth: 0,
mediumBreakPoint: 'md',
largeBreakPoint: 'lg',
})
```
**Warning:**
More documentation to come
---
source: https://maz-ui.com/composables/use-dialog.md
---
---
title: "useDialog"
description: "Vue composable for handling dialog plugin in your components"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-dialog"
---
# useDialog
> Vue composable for handling dialog plugin in your components
- Package: `maz-ui`
- Import: `import { useDialog } from 'maz-ui/composables/useDialog'`
- Nuxt: auto-imported by `@maz-ui/nuxt` when `mazUi.plugins.dialog` is enabled
- Web: https://maz-ui.com/composables/use-dialog
**Warning:**
You must install [dialog plugin](../plugins/dialog.md#install) before use it
**Tip:**
More info about [dialog plugin](../plugins/dialog.md) in its documentation
## Usage
```vue
Open Dialog
```
---
source: https://maz-ui.com/composables/use-display-names.md
---
---
title: "useDisplayNames"
description: "useDisplayNames is a Vue composable specialized in displaying localized country names (regions) and language names. It supports various code formats including ISO 639-1 (language codes), ISO 3166-1 (country codes), and BCP 47 (language tags), using the Intl.DisplayNames API for internationalization."
package: "maz-ui"
url: "https://maz-ui.com/composables/use-display-names"
---
# useDisplayNames
> useDisplayNames is a Vue composable specialized in displaying localized country names (regions) and language names. It supports various code formats including ISO 639-1 (language codes), ISO 3166-1 (country codes), and BCP 47 (language tags), using the Intl.DisplayNames API for internationalization.
- Package: `maz-ui`
- Import: `import { useDisplayNames } from 'maz-ui/composables/useDisplayNames'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-display-names
## Introduction
`useDisplayNames` allows you to fetch and format localized country names and language names using the `Intl.DisplayNames` API. It supports multiple code formats (ISO 639-1, ISO 3166-1, BCP 47) and is particularly useful for applications that need to display human-readable country or language names based on different locales.
**Warning:**
Depending on your environment (client or node server) and the browser you are using, the `Intl.DisplayNames` results can be differents (e.g, Firefox and Chrome can return different results).
## Key Features
- Displays localized country names (regions) and language names
- Supports multiple code formats: ISO 639-1 (language codes), ISO 3166-1 (country codes), and BCP 47 (language tags)
- Works with any locale supported by the browser's Intl.DisplayNames API
- Provides functions to get individual names or bulk retrieve all available names
- Handles errors gracefully with fallback values
- Smart filtering and sorting options for comprehensive lists
## Basic Usage
To see `useDisplayNames` in action, you can try out the following demo. This demo showcases how to use the composable to fetch and display localized language names dynamically based on user input.
```vue
Translated Language: {{ languageDisplayName || 'undefined' }}
```
In this example, the `useDisplayNames` composable is used to fetch and display the language name based on the selected locale and language code (ISO 639-1 or BCP 47 format).
The returned value is reactive and will update automatically when the locale or language code changes if arguments are reactive (use ref or computed).
## Functions
`useDisplayNames` can take a locale as argument to avoid passing this value each time you call the functions. This is useful when you need to fetch multiple country or language names based on the same locale.
It provides the following functions:
### `getDisplayName`
Fetches the localized display name of a country (region) or language based on the provided locale and code (supports ISO 639-1, ISO 3166-1, and BCP 47 formats).
```ts
function getDisplayName(code: MaybeRefOrGetter, options: {
type: MaybeRefOrGetter,
locale?: MaybeRefOrGetter
}): ComputedRef
```
### `getAllDisplayNames`
Fetches the localized display names for all available countries (regions) or languages for a given locale. Supports filtering by code type (ISO 639-1, ISO 3166-1, BCP 47, or all).
```ts
function getAllDisplayNames(options: {
type: MaybeRefOrGetter,
locale?: MaybeRefOrGetter,
codes?: MaybeRefOrGetter,
exclude?: MaybeRefOrGetter,
preferred?: MaybeRefOrGetter,
onlyIso?: MaybeRefOrGetter,
onlyBcp?: MaybeRefOrGetter,
}): ComputedRef<{ name: string, code: string }[]>
```
## Notes
- The `useDisplayNames` composable is designed to be used with Vue.
- The composable functions return `ComputedRef` values, which are reactive and will update automatically when their dependencies change.
- Handle errors gracefully by providing fallback values when the display name cannot be fetched.
- The `Intl.DisplayNames` API is used internally to fetch and format the display names based on the provided locale and code.
- The composable supports multiple locales, allowing you to fetch country and language names in different languages.
- Use the `getAllDisplayNames` function to fetch comprehensive lists of countries or languages with advanced filtering options.
- Supports various code formats: ISO 639-1 (language codes like 'en', 'fr'), ISO 3166-1 (country codes like 'US', 'FR'), and BCP 47 (language tags like 'en-US', 'fr-FR').
---
source: https://maz-ui.com/composables/use-drag.md
---
---
title: "useDrag"
description: "useDrag is a Vue composable that tracks a pointer drag gesture (touch, mouse and pen) in real time, exposing the live offset, distance and direction."
package: "maz-ui"
url: "https://maz-ui.com/composables/use-drag"
---
# useDrag
> useDrag is a Vue composable that tracks a pointer drag gesture (touch, mouse and pen) in real time, exposing the live offset, distance and direction.
- Package: `maz-ui`
- Import: `import { useDrag } from 'maz-ui/composables/useDrag'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-drag
## Introduction
`useDrag` follows a pointer drag on an element and gives you the **live** offset, distance and direction, plus `onStart` / `onMove` / `onEnd` callbacks. It is the low-level gesture primitive behind components like [MazBottomSheet](../components/maz-bottom-sheet.md) (drag-to-dismiss), and it's useful to build sliders, sortable handles, swipeable cards, bottom sheets, custom carousels, etc.
It is built on top of [Pointer Events](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events), so it works with **touch, mouse and pen**.
**Tip:**
For discrete directional swipe detection (left / right / up / down with a threshold) rather than real-time tracking, use [useSwipe](./use-swipe.md).
## Key Features
- Real-time pointer tracking (touch, mouse and pen)
- Live reactive state: `isDragging`, `offsetX`, `offsetY`, `distance`, `direction`
- `onStart` / `onMove` / `onEnd` callbacks with a full state snapshot
- Axis locking (`x`, `y` or `both`)
- Activation threshold, pointer-type filtering and reactive `disabled`
- Listeners are followed on the document, so the drag keeps working when the pointer leaves the element
- Automatically attaches/detaches when the target appears/disappears, and cleans up on unmount
## Basic Usage
Drag the card down: it follows your pointer and snaps back on release.
```vue
{{ dragging ? `Dragging - ${Math.round(dragOffset)}px ${dragDirection ?? ''}` : 'Drag me down' }}
```
## Options
`useDrag(target, options)` - the `target` is a `MaybeRefOrGetter` and `options` accepts:
```ts
interface UseDragOptions {
/**
* Restrict the tracking to a single axis. Off-axis movement is ignored.
* @default 'both'
*/
axis?: 'x' | 'y' | 'both'
/**
* Minimum distance (px) the pointer must travel before the drag becomes active.
* @default 0
*/
threshold?: number
/**
* Pointer types allowed to initiate the drag.
* @default ['mouse', 'touch', 'pen']
*/
pointerTypes?: ('mouse' | 'touch' | 'pen')[]
/**
* Reactively disable the gesture.
* @default false
*/
disabled?: MaybeRefOrGetter
/**
* Call `event.preventDefault()` on each pointer move while dragging.
* @default false
*/
preventDefault?: boolean
/**
* Call `event.stopPropagation()` on the pointer events.
* @default false
*/
stopPropagation?: boolean
/**
* Attach the listeners as soon as the target is available. When `false`, call `start()` manually.
* @default true
*/
immediate?: boolean
/** Called once when the drag becomes active (threshold reached). */
onStart?: (state: DragState) => void
/** Called on every pointer move while dragging. */
onMove?: (state: DragState) => void
/** Called when the drag ends (pointer up or cancel). */
onEnd?: (state: DragState) => void
}
```
Each callback receives a `DragState` snapshot:
```ts
interface DragState {
/** Pointer offset from the drag start on the X axis (`0` when axis is `'y'`). */
offsetX: number
/** Pointer offset from the drag start on the Y axis (`0` when axis is `'x'`). */
offsetY: number
/** Absolute distance dragged from the start. */
distance: number
/** Dominant direction of the drag. */
direction: 'up' | 'down' | 'left' | 'right' | undefined
/** Pointer position when the drag started. */
startX: number
startY: number
/** Current pointer position. */
x: number
y: number
/** The underlying pointer event. */
event: PointerEvent
}
```
## Composable Return
```ts
interface UseDragReturn {
/** Whether a drag is currently active (threshold reached). */
isDragging: Readonly[>
/** Reactive pointer offset from the drag start on the X axis. */
offsetX: Readonly][>
/** Reactive pointer offset from the drag start on the Y axis. */
offsetY: Readonly][>
/** Reactive absolute distance dragged from the start. */
distance: Readonly][>
/** Reactive dominant direction of the drag. */
direction: Readonly][>
/** Manually attach the listeners. */
start: () => void
/** Manually detach the listeners (also cancels an ongoing drag). */
stop: () => void
}
```
## Notes
- Add `touch-action: none` on the draggable element to prevent the browser from scrolling while dragging.
- The composable attaches automatically on mount (`immediate: true` by default) and cleans up on unmount; use `start()` / `stop()` for manual control.
- `onEnd` only fires when an actual drag happened (the threshold was reached), so a simple tap will not trigger it.
- The target can be a ref, a getter or a CSS selector string, and the listeners re-attach automatically when it changes.
---
source: https://maz-ui.com/composables/use-form-validator.md
---
---
title: "useFormValidator"
description: "Vue composables for form validation with any Standard Schema library (Valibot, Zod, ArkType...) - useFormValidator and useFormField provide a flexible and typed approach to handle form validation in your Vue applications."
package: "maz-ui"
url: "https://maz-ui.com/composables/use-form-validator"
---
# useFormValidator
> Vue composables for form validation with any Standard Schema library (Valibot, Zod, ArkType...) - useFormValidator and useFormField provide a flexible and typed approach to handle form validation in your Vue applications.
- Package: `maz-ui`
- Import: `import { useFormValidator } from 'maz-ui/composables/useFormValidator'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-form-validator
## Introduction
`useFormValidator` and `useFormField` are two Vue composables that work together to provide powerful form validation. They are **validation library agnostic**: any library implementing [Standard Schema](https://standardschema.dev) works out of the box, like [Valibot](https://valibot.dev), [Zod](https://zod.dev) or [ArkType](https://arktype.io). See Validation Libraries.
- **useFormValidator**: Initializes form validation for your entire form. Use it in your form's parent component.
- **useFormField**: Manages individual field validation states. Use it when you need fine-grained control over a field or when fields are in child components.
**When to use each:**
| Composable | Use When |
|------------|----------|
| `useFormValidator` only | Simple forms where all fields are in the same component |
| `useFormValidator` + `useFormField` | Fields in child components, or when using `eager`, `blur`, or `progressive` validation modes |
## Quick Start
Install the validation library of your choice (Valibot is used in most examples of this page):
```bash [valibot]
pnpm add valibot
```
```bash [zod]
pnpm add zod
```
```bash [arktype]
pnpm add arktype
```
Here's the simplest form you can create with `useFormValidator`:
```vue
]
```
## Validation Libraries
`useFormValidator` relies on [Standard Schema](https://standardschema.dev), a common interface shared by the main validation libraries. Maz-UI does not ship any validation library: install the one you prefer and pass its schemas. Valibot, Zod and ArkType are declared as optional peer dependencies of `maz-ui`, so your package manager warns you if the installed version is not supported.
| Library | Supported versions |
|---------|--------------------|
| [Valibot](https://valibot.dev) | `>=1.0.0 <2.0.0` |
| [Zod](https://zod.dev) | `>=3.24.0 <5.0.0` (v3 and v4) |
| [ArkType](https://arktype.io) | `>=2.0.0 <3.0.0` |
| [Others](https://standardschema.dev/#what-schema-libraries-implement-the-spec) | Any library implementing Standard Schema V1 |
The `schema` option is always a **plain object** where each key is a field name and each value is a schema of your library. Do not wrap it with `object()` / `z.object()`.
### Same form, different libraries
```ts [valibot]
import { useFormValidator } from 'maz-ui/composables'
import { email, minLength, nonEmpty, pipe, string } from 'valibot'
const { model, errorMessages, handleSubmit } = useFormValidator({
schema: {
email: pipe(string(), nonEmpty('Email is required'), email('Invalid email')),
password: pipe(string(), minLength(8, 'Min 8 characters')),
},
})
```
```ts [zod]
import { useFormValidator } from 'maz-ui/composables'
import { z } from 'zod'
const { model, errorMessages, handleSubmit } = useFormValidator({
schema: {
email: z.string().min(1, 'Email is required').pipe(z.email('Invalid email')),
password: z.string().min(8, 'Min 8 characters'),
},
})
```
```ts [arktype]
import { type } from 'arktype'
import { useFormValidator } from 'maz-ui/composables'
const { model, errorMessages, handleSubmit } = useFormValidator({
schema: {
email: type('string.email'),
password: type('string >= 8'),
},
})
```
### Live example with Zod
```vue
```
### Mixing libraries
Each field is validated by its own schema, so you can mix libraries in the same form (useful during a progressive migration from one library to another):
```ts
import { useFormValidator } from 'maz-ui/composables'
import { email, pipe, string } from 'valibot'
import { z } from 'zod'
const { model } = useFormValidator({
schema: {
email: pipe(string(), email('Invalid email')),
age: z.number().min(18, 'Min 18'),
},
})
```
### Custom schema
You can also write your own validator by implementing the `StandardSchemaV1` interface (exported by `maz-ui/composables`). `validate` can be synchronous or return a `Promise`:
```ts
import type { StandardSchemaV1 } from 'maz-ui/composables'
import { useFormValidator } from 'maz-ui/composables'
const frenchZipCode: StandardSchemaV1 = {
'~standard': {
version: 1,
vendor: 'my-app',
validate: value =>
typeof value === 'string' && /^\d{5}$/.test(value)
? { value }
: { issues: [{ message: 'Invalid zip code' }] },
},
}
const { model } = useFormValidator({
schema: { zipCode: frenchZipCode },
})
```
### Good to know
- **Empty values**: `undefined` and `null` field values are validated as an empty string (`''`). To make a field required, use a length rule (`nonEmpty()` with Valibot, `.min(1)` with Zod). An optional field with a format rule (email, URL...) has to accept the empty string explicitly, for example `z.email().or(z.literal(''))` with Zod or `union([literal(''), pipe(string(), email())])` with Valibot.
- **Error messages**: `errorMessages` contains the message of the first issue of each field, whatever the library.
- **Issues type**: `errors` and `fieldsStates[field].errors` are typed as `ValidationIssues`, the Standard Schema issue shape (`message` and `path`). At runtime, they are the native issues of your library, so you can cast them to access library specific properties (for example `BaseIssue` from Valibot or `z.core.$ZodIssue` from Zod).
- **Type inference**: the `model` type (input) and the `handleSubmit` payload type (output, after transformations) are inferred from the schemas whatever the library.
## Understanding Form State
`useFormValidator` returns several reactive values to help you manage your form:
| Property | Type | Description |
|----------|------|-------------|
| `model` | `Ref` | The form data object - bind this to your inputs with `v-model` |
| `isValid` | `ComputedRef` | `true` when all fields pass validation |
| `isDirty` | `ComputedRef` | `true` when any field has been modified from its initial value |
| `isSubmitting` | `Ref` | `true` while the form is being submitted |
| `isSubmitted` | `Ref` | `true` after the form has been submitted at least once |
| `errorMessages` | `ComputedRef>` | The first error message for each field (if any) |
| `errors` | `ComputedRef>` | All validation issues for each field |
| `fieldsStates` | `Ref` | Detailed state object for each field |
| `handleSubmit` | `Function` | Wrapper function for form submission |
| `validateForm` | `Function` | Manually trigger form validation |
| `resetForm` | `Function` | Reset the form to its initial state |
| `scrollToError` | `Function` | Scroll to the first field with an error |
### Field States
Each field in `fieldsStates` contains:
| Property | Type | Description |
|----------|------|-------------|
| `valid` | `boolean` | Field passes validation |
| `error` | `boolean` | Field has an error that should be displayed |
| `errors` | `ValidationIssues` | Array of all validation issues |
| `dirty` | `boolean` | Field value differs from initial value |
| `blurred` | `boolean` | Field has lost focus at least once |
| `validated` | `boolean` | Validation has run at least once |
| `validating` | `boolean` | Async validation is in progress |
```vue
{{ { isValid, isDirty, isSubmitted } }}
{{ fieldsStates }}
```
## Validation Modes
Validation modes control **when** validation runs and **when** errors are displayed. Choose the mode that best fits your UX needs.
| Mode | Validates On | Shows Errors | Best For |
|------|--------------|--------------|----------|
| `lazy` (default) | Value change | After change (if not empty) | Simple forms |
| `aggressive` | Immediately + every change | Always | Real-time feedback |
| `eager` | Blur, then on change | After first blur | Better UX |
| `blur` | Only on blur | After blur | Minimal interruption |
| `progressive` | Silently, shows on blur if invalid | After blur or validation | Optimal UX |
**Tip:**
For `eager`, `blur`, and `progressive` modes, you must use `useFormField` with the `ref` option or `validationEvents` to capture blur events.
### Lazy Mode (Default)
The default mode. Validates when field values change. Errors only appear if the field is not empty.
```vue
```
### Aggressive Mode
Validates all fields immediately when the form is created and on every change. Errors are always displayed.
```vue
```
### Eager Mode (Recommended)
Validates on blur first (if the field is not empty), then on every change. This provides a good balance between immediate feedback and not overwhelming the user.
**Warning:**
Requires `useFormField` with `ref` option or `validationEvents`.
```vue
```
### Blur Mode
**Warning:**
Requires `useFormField` with `ref` option or `validationEvents`.
Validates only when the field loses focus. Errors are only shown after blur.
```vue
```
### Progressive Mode
**Warning:**
Requires `useFormField` with `ref` option or `validationEvents`.
The most user-friendly mode. Validates silently in the background. Shows errors only on blur if the field is invalid. Once valid, it stays valid until it becomes invalid again.
```vue
```
## useFormField for Child Components
`useFormField` is essential when:
1. Your form fields are in child components
2. You need the `eager`, `blur`, or `progressive` validation modes
3. You want fine-grained control over individual field states
### Return Values
| Property | Type | Description |
|----------|------|-------------|
| `value` | `WritableComputedRef` | The field value (use with `v-model`) |
| `hasError` | `ComputedRef` | Field has an error that should be displayed |
| `errors` | `ComputedRef` | All validation issues |
| `errorMessage` | `ComputedRef` | First error message |
| `isValid` | `ComputedRef` | Field passes validation |
| `isDirty` | `ComputedRef` | Field has been modified |
| `isBlurred` | `ComputedRef` | Field has lost focus |
| `isValidated` | `ComputedRef` | Validation has run |
| `isValidating` | `ComputedRef` | Async validation in progress |
| `mode` | `ComputedRef` | The validation mode |
| `validationEvents` | `ComputedRef` | Blur event handler for `v-bind` |
### Two Ways to Bind Validation Events
#### Option 1: Using `ref` (Recommended)
Pass a template ref to `useFormField`. It will automatically detect interactive elements and attach blur listeners.
The `ref` option is **reactive**: if the field is rendered conditionally (e.g. with `v-if`), the blur listeners are attached automatically as soon as the element appears in the DOM, and removed when it is unmounted. You don't need to handle anything special.
```vue
```
Because it is reactive, the same code works even when the input is wrapped in a `v-if`:
```vue
```
You can also pass a raw `HTMLElement` directly. In that case it won't be reactive, so the element must already exist in the DOM:
```ts
const { value } = useFormField('email', {
ref: document.querySelector('input'),
formIdentifier: 'my-form',
})
```
#### Option 2: Using `validationEvents`
If your component emits a `blur` event, you can use `v-bind` with `validationEvents`.
```vue
```
## TypeScript Type Inference
The form model is automatically typed based on your schema, whatever the validation library:
```ts
const schema = {
name: pipe(string(), nonEmpty()),
age: pipe(number(), minValue(0)),
email: pipe(string(), email()),
}
const { model } = useFormValidator({ schema })
// model.value is typed as: { name?: string, age?: number, email?: string }
```
For `useFormField`, specify the field type as a generic parameter:
```ts
// Specify the type for better type safety
const { value } = useFormField('name', { formIdentifier: 'my-form' })
// value is typed as WritableComputedRef
```
**Warning: Common TypeScript Errors**
If you get circular reference errors with `useTemplateRef`, use the classic `ref()` instead:
```ts
// May cause TypeScript errors
const { value: email } = useFormField('email', {
ref: useTemplateRef('emailRef'),
})
// Solution 1: Add generic to useTemplateRef
const { value: email } = useFormField('email', {
ref: useTemplateRef('emailRef'),
})
// Solution 2: Use classic ref
const emailRef = ref()
const { value: email } = useFormField('email', {
ref: emailRef,
})
```
## Async Validation
Async validations (like checking username availability) are supported by every library: Valibot's `pipeAsync` and `checkAsync`, Zod's async `refine`, etc. The example below uses Valibot, here is the Zod equivalent of the schema:
```ts
import { z } from 'zod'
const schema = {
username: z
.string()
.min(1, 'Username is required')
.min(3, 'Min 3 characters')
.refine(async (value) => {
// Simulate API call
await new Promise(resolve => setTimeout(resolve, 2000))
return value !== 'taken'
}, 'Username is already taken'),
}
```
```vue
```
## Throttling and Debouncing
For expensive validations (like API calls), use throttling or debouncing to limit how often validation runs.
| Option | Behavior | Default Time | Use Case |
|--------|----------|--------------|----------|
| `debouncedFields` | Waits until user stops typing | 300ms | Search fields, API calls |
| `throttledFields` | Runs at most once per interval | 1000ms | Rate-limited APIs |
```vue
```
## Reset Form
Use `resetForm()` to reset the form to its initial state, or set `resetOnSuccess` to automatically reset after successful submission.
```vue
```
## Multiple Forms on Same Page
Use the `identifier` option to have multiple independent forms on the same page. Make sure to match the identifier in both `useFormValidator` and `useFormField`.
```vue
```
## Error Handling and scrollToError
### scrollToError
Automatically scroll to the first field with an error when validation fails:
```ts
const { handleSubmit } = useFormValidator({
schema,
options: {
scrollToError: '.has-error', // CSS selector for error elements
// scrollToError: false, // Disable scrolling
},
})
```
Add the matching class to your fields:
```html
```
### onError Callback
Handle validation failures with the `onError` callback:
```ts
const onSubmit = handleSubmit(
(data) => {
// Success callback
console.log('Valid:', data)
},
'.has-error', // scrollToError selector (optional)
{
onError: ({ model, errorMessages, errors }) => {
// Called when validation fails
console.log('Validation failed:', errorMessages)
},
}
)
```
## Performance & Best Practices
### Performance Tips
1. **Use throttling/debouncing** for expensive validations (API calls, complex logic)
2. **Prefer `eager` or `progressive` modes** over `aggressive` for better performance
3. **Use `lazy` mode** for simple forms with minimal validation
4. **Avoid `aggressive` mode on large forms** - it validates every field on every change
### Common Patterns
#### Multiple Forms with Identifiers
```ts
const { handleSubmit } = useFormValidator({
schema,
options: { identifier: 'my-unique-form' },
})
const { value } = useFormField('email', {
formIdentifier: 'my-unique-form', // Must match!
})
```
#### Custom Interactive Elements
If your custom component isn't detected for blur events, add `data-interactive`:
```vue
Custom Input
```
### Common Pitfalls
| Pitfall | Solution |
|---------|----------|
| Mismatched `formIdentifier` | Ensure `useFormField`'s `formIdentifier` matches `useFormValidator`'s `identifier` |
| Validation not triggering in eager/blur/progressive modes | Use `ref` option or `v-bind="validationEvents"` |
| TypeScript errors with `useTemplateRef` | Add generic type or use classic `ref()` |
| Field not found warning | Make sure the field name exists in your schema |
## API Reference
### useFormValidator
#### Parameters
```ts
useFormValidator({
schema: TSchema, // Object of Standard Schema field schemas: Valibot, Zod, ArkType... (required)
model?: Ref, // External model ref (optional)
defaultValues?: DeepPartial, // Initial values (optional)
options?: {
mode?: 'lazy' | 'aggressive' | 'eager' | 'blur' | 'progressive', // Default: 'lazy'
throttledFields?: Record, // Fields to throttle
debouncedFields?: Record, // Fields to debounce
scrollToError?: string | false, // CSS selector, default: '.has-field-error'
identifier?: string | symbol, // Form identifier, default: 'main-form-validator'
resetOnSuccess?: boolean, // Reset after submit, default: true
}
})
```
#### Return Values
```ts
{
identifier: string | symbol
model: Ref
isValid: ComputedRef
isDirty: ComputedRef
isSubmitting: Ref
isSubmitted: Ref
errors: ComputedRef>
errorMessages: ComputedRef>
fieldsStates: Ref>
validateForm: (setErrors?: boolean) => Promise
scrollToError: (selector?: string) => void
resetForm: () => void
handleSubmit: (
successCallback: Func,
scrollToError?: string | false,
options?: { onError?: Function, resetOnSuccess?: boolean }
) => (event?: Event) => Promise>
}
```
### useFormField
#### Parameters
```ts
useFormField(
name: string, // Field name in schema (required)
options?: {
defaultValue?: FieldType, // Default value for this field
mode?: 'lazy' | 'aggressive' | 'eager' | 'blur' | 'progressive', // Override form mode
ref?: Ref | HTMLElement, // Reactive template ref (v-if friendly) or raw element
formIdentifier?: string | symbol, // Must match useFormValidator's identifier
}
)
```
#### Return Values
```ts
{
value: WritableComputedRef
hasError: ComputedRef
errors: ComputedRef
errorMessage: ComputedRef
isValid: ComputedRef
isDirty: ComputedRef
isBlurred: ComputedRef
isValidated: ComputedRef
isValidating: ComputedRef
mode: ComputedRef
validationEvents: ComputedRef<{ onBlur?: () => void }>
}
```
### Types
```ts
// Standard Schema issue (https://standardschema.dev)
interface ValidationIssue {
readonly message: string
readonly path?: ReadonlyArray
}
type ValidationIssues = ValidationIssue[]
interface FormValidatorOptions {
mode?: 'eager' | 'lazy' | 'aggressive' | 'blur' | 'progressive'
throttledFields?: Partial>
debouncedFields?: Partial>
scrollToError?: string | false
identifier?: string | symbol
resetOnSuccess?: boolean
}
interface FormFieldOptions {
defaultValue?: FieldType
mode?: 'eager' | 'lazy' | 'aggressive' | 'blur' | 'progressive'
ref?: Ref | HTMLElement
formIdentifier?: string | symbol
}
interface FieldState {
valid: boolean
error: boolean
errors: ValidationIssues
dirty: boolean
blurred: boolean
validated: boolean
validating: boolean
initialValue?: Readonly
mode?: string
}
```
## Troubleshooting
### Type Errors with useTemplateRef
**Problem**: TypeScript circular reference errors when using `useTemplateRef`
**Solutions**:
```ts
// Solution 1: Add generic type
const { value } = useFormField('email', {
ref: useTemplateRef('emailRef'),
})
// Solution 2: Use classic ref
const emailRef = ref()
const { value } = useFormField('email', { ref: emailRef })
```
### Validation Not Triggering
**Problem**: `eager`, `blur`, or `progressive` mode not validating
**Solution**: These modes require blur event detection. Use either:
```ts
// Option 1: ref option
const { value } = useFormField('name', {
ref: useTemplateRef('inputRef'),
})
// Option 2: validationEvents
const { value, validationEvents } = useFormField('name')
// Then: v-bind="validationEvents" on your input
```
### Conditionally Rendered Fields (`v-if`)
The `ref` option is reactive, so a field wrapped in `v-if` works out of the box: blur listeners are attached as soon as the element is rendered and removed when it is unmounted.
If blur validation still doesn't trigger:
1. Ensure the `ref` is bound to an HTML element or a Vue component exposing `$el`
2. For custom components, add the `data-interactive` attribute
### Mismatched Form Identifiers
**Problem**: `useFormField` not finding the form context
**Solution**: Ensure identifiers match:
```ts
// In parent
const { handleSubmit } = useFormValidator({
schema,
options: { identifier: 'my-form' }, // This identifier...
})
// In child
const { value } = useFormField('email', {
formIdentifier: 'my-form', // ...must match this one
})
```
---
source: https://maz-ui.com/composables/use-idle-timeout.md
---
---
title: "useIdleTimeout"
description: "A Vue composable that provides an easy way to track user inactivity on your website and execute a callback function when the user becomes idle."
package: "maz-ui"
url: "https://maz-ui.com/composables/use-idle-timeout"
---
# useIdleTimeout
> A Vue composable that provides an easy way to track user inactivity on your website and execute a callback function when the user becomes idle.
- Package: `maz-ui`
- Import: `import { useIdleTimeout } from 'maz-ui/composables/useIdleTimeout'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-idle-timeout
**Note:**
A plugin to know the amount of time a user has spent on your website
## Demo
```vue
Start
Pause
Resume
Reset
Destroy
isIdle: {{ event.isIdle }}
eventType: {{ event.eventType }}
```
## Callback
```ts
type IdleTimeoutCallback = (payload: {
isIdle: boolean
eventType?: string
}) => void
```
## Options
```ts
interface IdleTimeoutStrictOption {
/** @default document.body */
element?: HTMLElement | Document
/** @default 60 * 1000 * 5 --> 5 minutes */
timeout?: number
/** @default false */
once?: boolean
/** @default true */
immediate?: boolean
}
```
## Actions
### Start
Start tracking user - needed for SSR when `immediate` option is set to false (execute it on client side)
```ts
idleTimeout.start()
```
### Pause
Will pause the timeout and events, can't be executed when the timeout has expired
```ts
idleTimeout.pause()
```
### Resume
Resume the instance will reinit the timeout
```ts
idleTimeout.resume()
```
### Reset
Reset the timeout of the instance like a restart
```ts
idleTimeout.reset()
```
### Destroy
Will destroy the instance and stop tracking
```ts
idleTimeout.destroy()
```
---
source: https://maz-ui.com/composables/use-pull-to-refresh.md
---
---
title: "usePullToRefresh"
description: "usePullToRefresh is a headless Vue composable for the pull to refresh gesture on the window or any scroll container."
package: "maz-ui"
url: "https://maz-ui.com/composables/use-pull-to-refresh"
---
# usePullToRefresh
> usePullToRefresh is a headless Vue composable for the pull to refresh gesture on the window or any scroll container.
- Package: `maz-ui`
- Import: `import { usePullToRefresh } from 'maz-ui/composables/usePullToRefresh'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-pull-to-refresh
## Introduction
`usePullToRefresh` tracks the pull to refresh gesture and gives you its state (distance, progress, ready, refreshing) to build your own indicator. It powers [MazPullToRefresh](../components/maz-pull-to-refresh.md): use the component for a ready-made indicator, the composable when you need full control over the rendering.
The pull only starts when the target is scrolled to the top, follows a rubber band beyond the threshold, ignores horizontal and multi-touch gestures, and prevents the native bounce while pulling.
## Basic usage
```vue
Refreshing…
Release to refresh
Pull to refresh
Content
```
Without `target`, the gesture is tracked on the window.
## Options
| Option | Type | Default | Description |
| ------------- | -------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------ |
| `onRefresh` | `() => unknown` | - | Called on release past the threshold, or by `refresh()` |
| `target` | `MaybeRefOrGetter` | `window` | Scroll container receiving the gesture |
| `threshold` | `MaybeRefOrGetter` | `80` | Pull distance (px, after resistance) needed to trigger a refresh |
| `maxDistance` | `MaybeRefOrGetter` | `threshold * 1.6` | Upper bound of the rubber band |
| `resistance` | `MaybeRefOrGetter` | `0.5` | Ratio between the finger movement and the pull distance |
| `minDuration` | `MaybeRefOrGetter` | `400` | Minimum duration (ms) of the refreshing state |
| `haptic` | `MaybeRefOrGetter` | `true` | Vibrate briefly when the threshold is reached |
| `disabled` | `MaybeRefOrGetter` | `false` | Disable the gesture |
| `onError` | `(error: unknown) => void` | - | Called when `onRefresh` throws or rejects (the error is also exposed in `error`) |
## Return
| Property | Type | Description |
| -------------- | --------------------------- | ------------------------------------------------------------ |
| `distance` | `Readonly[>` | Current pull distance in px |
| `progress` | `ComputedRef]` | Progress towards the threshold, from 0 to 1 |
| `isPulling` | `Readonly[>` | The user is pulling |
| `isReady` | `ComputedRef]` | Releasing now triggers a refresh |
| `isRefreshing` | `Readonly[>` | `onRefresh` is running |
| `error` | `Readonly][>` | Error of the last refresh, reset on each refresh |
| `refresh` | `() => Promise]` | Run the refresh programmatically (for a keyboard-usable button) |
| `start` | `() => void` | Attach the listeners (done automatically on mount) |
| `stop` | `() => void` | Detach the listeners (done automatically on unmount) |
## Notes
- Inside a component, listeners are attached on mount and removed when the scope is disposed. Outside of a component, they are attached right away.
- When `target` changes (for example a ref resolved later), the listeners move to the new element.
- `refresh()` never throws: errors go to `error` and `onError`. Calling it while a refresh is running does nothing.
- SSR safe: nothing touches the DOM before mount.
---
source: https://maz-ui.com/composables/use-reading-time.md
---
---
title: "useReadingTime"
description: "This composable allows you to calculate the reading time of a text"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-reading-time"
---
# useReadingTime
> This composable allows you to calculate the reading time of a text
- Package: `maz-ui`
- Import: `import { useReadingTime } from 'maz-ui/composables/useReadingTime'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-reading-time
## Basic usage
Time to read this page: minutes
```vue
Time to read this page: {{ duration }} minutes
```
## With content selector
**Warning:**
This method is not SSR friendly (only on client side, with Nuxt use this composable in `onMounted(() => { ... })`) and not recommended because it is less performant than the previous one
Time to read this page: minutes
```vue
Time to read this page: {{ duration }} minutes
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lectus quam id leo in. Placerat vestibulum lectus mauris ultrices eros in cursus turpis. Et tortor consequat id porta nibh venenatis cras sed. Praesent tristique magna sit amet. Iaculis at erat pellentesque adipiscing commodo elit at. Interdum velit euismod in pellentesque massa placerat duis. Eget nunc scelerisque viverra mauris in aliquam. Nulla facilisi morbi tempus iaculis urna id volutpat lacus. Pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum odio. Egestas integer eget aliquet nibh praesent tristique magna sit amet. Volutpat blandit aliquam etiam erat velit scelerisque. Eget nullam non nisi est sit amet. Turpis egestas sed tempus urna et pharetra. Nisl rhoncus mattis rhoncus urna neque viverra justo. Rutrum tellus pellentesque eu tincidunt tortor aliquam. Non odio euismod lacinia at. Magna eget est lorem ipsum.
Et ultrices neque ornare aenean euismod elementum nisi. Ullamcorper eget nulla facilisi etiam dignissim diam quis enim lobortis. Lobortis feugiat vivamus at augue eget arcu. Ut diam quam nulla porttitor massa id neque. Turpis in eu mi bibendum neque egestas. Vivamus at augue eget arcu dictum varius duis at. Nunc sed blandit libero volutpat. Convallis a cras semper auctor neque vitae tempus. Odio facilisis mauris sit amet massa vitae tortor condimentum. Condimentum id venenatis a condimentum. Tincidunt praesent semper feugiat nibh sed pulvinar. Dolor magna eget est lorem ipsum dolor. Ultricies mi eget mauris pharetra et ultrices neque ornare aenean. Sapien pellentesque habitant morbi tristique senectus et netus. Tortor vitae purus faucibus ornare suspendisse sed nisi. Est lorem ipsum dolor sit amet consectetur adipiscing elit pellentesque. Enim neque volutpat ac tincidunt vitae.
Iaculis at erat pellentesque adipiscing commodo elit at imperdiet. Scelerisque felis imperdiet proin fermentum leo vel orci porta non. Ut etiam sit amet nisl purus in mollis nunc sed. Sed velit dignissim sodales ut eu sem integer. Odio tempor orci dapibus ultrices in iaculis nunc. Id semper risus in hendrerit gravida. Aliquam faucibus purus in massa tempor nec. Mattis nunc sed blandit libero volutpat sed cras ornare arcu. Quisque id diam vel quam elementum pulvinar etiam non quam. Et egestas quis ipsum suspendisse ultrices gravida dictum. Velit aliquet sagittis id consectetur purus ut faucibus pulvinar elementum. In hac habitasse platea dictumst quisque. Amet nisl purus in mollis nunc sed id semper. Sollicitudin tempor id eu nisl nunc mi. Dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim. In iaculis nunc sed augue lacus viverra vitae.
```
## Velocity
> The velocity is the number of words per minute. By default it is 150 words per minute.
**Velocity**: words per minute
Time to read this page: minutes
## Types
### Options
```ts
export interface ReadingTimeOptions {
/**
* Content to calculate the reading time
* @default undefined
*/
content?: string | Ref
/**
* Selector of the content to calculate the reading time
* @default undefined
*/
contentSelector?: string | Ref
/**
* Words per minute
* @default 150
*/
velocity?: number
}
```
### Returns
```ts
export interface ReadingTimeReturn {
/** Content to calculate the reading time */
content: ComputedRef
/** Number of words in the content */
wordCount: ComputedRef
/** Words per minute */
velocity: ComputedRef
/** Reading time in minutes */
duration: ComputedRef
}
```
---
source: https://maz-ui.com/composables/use-string-matching.md
---
---
title: "useStringMatching"
description: "Efficient composable for string matching tasks, utilizing Levenshtein distance calculation. Simplify comparison operations with minimal setup. Enhance text similarity checks effortlessly."
package: "maz-ui"
url: "https://maz-ui.com/composables/use-string-matching"
---
# useStringMatching
> Efficient composable for string matching tasks, utilizing Levenshtein distance calculation. Simplify comparison operations with minimal setup. Enhance text similarity checks effortlessly.
- Package: `maz-ui`
- Import: `import { useStringMatching } from 'maz-ui/composables/useStringMatching'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-string-matching
## Usage
```vue
isMatching: {{ isMatching }}
score: {{ score }}
```
---
source: https://maz-ui.com/composables/use-swipe.md
---
---
title: "useSwipe"
description: "useSwipe is a Vue composable that simplifies the management of \"swipe\" interactions on HTML elements."
package: "maz-ui"
url: "https://maz-ui.com/composables/use-swipe"
---
# useSwipe
> useSwipe is a Vue composable that simplifies the management of "swipe" interactions on HTML elements.
- Package: `maz-ui`
- Import: `import { useSwipe } from 'maz-ui/composables/useSwipe'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-swipe
## Introduction
`useSwipe` allows you to detect and react to swiping movements on an HTML element. It provides you with various information about the swipe movement, such as the direction, distance, start, and end coordinates.
You can use this information to implement specific interactions in your application, such as scrolling a carousel, opening a side menu, etc.
It is built on top of [Pointer Events](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events), so it works with **touch, mouse and pen** out of the box.
**Tip:**
For a real-time drag gesture (follow the pointer, snap back, drag-to-dismiss…) rather than discrete directional detection, use [useDrag](./use-drag.md).
## Key Features
- Detects swipes in all 4 directions (left, right, up, down)
- Works with touch, mouse and pen (Pointer Events)
- Provides key information about the swipe movement (start/end coordinates, horizontal/vertical distance)
- Allows you to configure callbacks for each swipe direction
- Restrict the gesture to specific pointer types
- Possibility to customize the swipe detection threshold
- Automatically handles the addition and removal of event listeners
- Can be used with any HTML element
## Basic Usage
Here's an example of using the useSwipe composable:
```vue
Swipe in any direction
(works with touch, mouse and pen)
Last swipe direction: {{ lastSwipeDirection || 'None' }}
```
```ts
interface UseSwipeOptions {
/**
* The HTML element on which the swipe events will be handled. This can be either a direct reference to the element or a CSS selector.
* @required
*/
element: HTMLElement | string | Ref
/** Callback executed when a left swipe is detected. */
onLeft?: (event: PointerEvent) => void
/** Callback executed when a right swipe is detected. */
onRight?: (event: PointerEvent) => void
/** Callback executed when an up swipe is detected. */
onUp?: (event: PointerEvent) => void
/** Callback executed when a down swipe is detected. */
onDown?: (event: PointerEvent) => void
/**
* The minimum distance the swipe must travel to be considered valid.
* @default 50
*/
threshold?: number
/**
* Pointer types that can trigger the swipe.
* @default ['mouse', 'touch', 'pen']
*/
pointerTypes?: ('mouse' | 'touch' | 'pen')[]
/**
* Whether to prevent the default behavior of the pointer move event
* (the move listener becomes non-passive when enabled).
* @default false
*/
preventDefaultOnMove?: boolean
/**
* Whether to prevent the default behavior of the mousewheel event.
* @default false
*/
preventDefaultOnMouseWheel?: boolean
/**
* Whether to start listening immediately on instantiation.
* @default false
*/
immediate?: boolean
/**
* Whether to trigger the swipe event only on pointer up.
* @default false
*/
triggerOnEnd?: boolean
}
```
```ts
interface UseSwipeReturn {
/** A function to start listening for swipe events. */
start: () => void
/** A function to stop listening for swipe events. */
stop: () => void
/** The horizontal difference between the start and end coordinates of the swipe. */
xDiff: Ref
/** The vertical difference between the start and end coordinates of the swipe. */
yDiff: Ref
/** The horizontal start coordinate of the swipe. */
xStart: Ref
/** The horizontal end coordinate of the swipe. */
xEnd: Ref
/** The vertical start coordinate of the swipe. */
yStart: Ref
/** The vertical end coordinate of the swipe. */
yEnd: Ref
}
```
---
source: https://maz-ui.com/composables/use-timer.md
---
---
title: "useTimer"
description: "The useTimer composable manages timeouts. It allows you to start, pause, resume, and stop a timer with reactive updates on the remaining time. Ideal for handling asynchronous operations or user interactions with a specified timeout."
package: "maz-ui"
url: "https://maz-ui.com/composables/use-timer"
---
# useTimer
> The useTimer composable manages timeouts. It allows you to start, pause, resume, and stop a timer with reactive updates on the remaining time. Ideal for handling asynchronous operations or user interactions with a specified timeout.
- Package: `maz-ui`
- Import: `import { useTimer } from 'maz-ui/composables/useTimer'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-timer
---
The composable provides the following functionality:
- **start**: Initiates a timer that decrements the remaining time every second until the timeout is reached. When the timeout is reached, it executes the provided callback function.
- **pause**: Pauses the active timer, allowing it to be resumed later from the point it was paused.
- **resume**: Resumes the timer from the point it was paused, considering the remaining time.
- **stop**: Stops the timer completely, resetting the remaining time to the initial timeout value.
- **remainingTime**: A reactive variable that holds the current remaining time in milliseconds. It updates reactively as the timer progresses.
The composable also includes cleanup logic using onBeforeUnmount to ensure that the timer is stopped when the component is unmounted.
This composable can be used in Vue components to handle timeouts in a flexible and reactive manner.
## Usage
**Remaning time**: ms
```vue
Start
Stop
Pause
Resume
```
## Set timeout with start function
Starts the timer with the specified timeout. If the timeout is not provided, it uses the default value of 1000ms.
```ts
const { start } = useTimer()
start(4000)
```
## Types
```ts
export interface TimerOptions {
/**
* The time in milliseconds
* @default 1000
*/
timeout?: number
/**
* The callback to execute when the timer is finished
* @default undefined
*/
callback?: () => unknown
/**
* The interval to update the remaining time
* @default 200
*/
remainingTimeUpdate?: number
/**
* The offset time to execute the callback
* @default 0
*/
callbackOffsetTime?: number
}
```
---
source: https://maz-ui.com/composables/use-toast.md
---
---
title: "useToast"
description: "Vue composable to display toast notifications (info, success, warning, error, with actions and buttons) from your components, through the toast plugin"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-toast"
---
# useToast
> Vue composable to display toast notifications (info, success, warning, error, with actions and buttons) from your components, through the toast plugin
- Package: `maz-ui`
- Import: `import { useToast } from 'maz-ui/composables/useToast'`
- Nuxt: auto-imported by `@maz-ui/nuxt` when `mazUi.plugins.toast` is enabled
- Web: https://maz-ui.com/composables/use-toast
**Warning:**
You must install [toast plugin](../plugins/toast.md#install) before use it
**Tip:**
More info about [toast plugin](../plugins/toast.md) in its documentation
## Usage
```vue
```
---
source: https://maz-ui.com/composables/use-user-visibility.md
---
---
title: "useUserVisibility"
description: "Vue composable to know whether the user is looking at the page (Page Visibility API), with an optional delay before considering them away"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-user-visibility"
---
# useUserVisibility
> Vue composable to know whether the user is looking at the page (Page Visibility API), with an optional delay before considering them away
- Package: `maz-ui`
- Import: `import { useUserVisibility } from 'maz-ui/composables/useUserVisibility'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-user-visibility
**Tip:**
Useful to know if the user is displaying your website
## Demo
**Tip:**
Switch tabs for a second to see events
## How to use it?
```vue
Destroy
Destroy
Logs
isVisible: {{ isVisible }}
```
## Callback
```ts
export type UserVisibilyCallback = ({
isVisible,
}: {
isVisible: boolean
}) => void
```
## Options
```ts
interface UserVisibilyStrictOptions {
immediate: boolean
timeout: number
once: boolean
ssr: boolean // if `true`
}
```
### Default Options
```ts
const defaultOptions: UserVisibilyOptions = {
immediate: false,
timeout: 5000,
once: false,
ssr: false,
}
```
## Actions
### Start
Will start the user visibility tracking
```ts
userVisibility.start()
```
### Destroy
Will destroy the instance and stop the tracking
```ts
userVisibility.destroy()
```
---
source: https://maz-ui.com/composables/use-wait.md
---
---
title: "useWait"
description: "Vue composable to manage loading states (start, stop, check) in your components, through the wait plugin and the MazFullscreenLoader"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-wait"
---
# useWait
> Vue composable to manage loading states (start, stop, check) in your components, through the wait plugin and the MazFullscreenLoader
- Package: `maz-ui`
- Import: `import { useWait } from 'maz-ui/composables/useWait'`
- Nuxt: auto-imported by `@maz-ui/nuxt` when `mazUi.plugins.wait` is enabled
- Web: https://maz-ui.com/composables/use-wait
**Warning:**
You must install the [wait plugin](../plugins/wait.md#install) before using it
**Tip:**
More info about the [wait plugin](../plugins/wait.md) in its documentation
## Usage
```vue
Loading
Loaded
```
---
source: https://maz-ui.com/composables/use-window-size.md
---
---
title: "useWindowSize"
description: "This composable provides a simple utility to track the width and height of the browser window with reactivity"
package: "maz-ui"
url: "https://maz-ui.com/composables/use-window-size"
---
# useWindowSize
> This composable provides a simple utility to track the width and height of the browser window with reactivity
- Package: `maz-ui`
- Import: `import { useWindowSize } from 'maz-ui/composables/useWindowSize'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/composables/use-window-size
## Basic usage
```ts
const { height, width } = useWindowSize()
```
**Warning:**
More documentation to come
---
source: https://maz-ui.com/directives/click-outside.md
---
---
title: "vClickOutside"
description: "vClickOutside is a Vue directive to trigger a function when the user clicks outside an element"
package: "maz-ui"
url: "https://maz-ui.com/directives/click-outside"
---
# vClickOutside
> vClickOutside is a Vue directive to trigger a function when the user clicks outside an element
- Package: `maz-ui`
- Import: `import { vClickOutside } from 'maz-ui/directives/vClickOutside'`
- Web: https://maz-ui.com/directives/click-outside
## Basic usage
```vue
Click outside me
You clicked outside
```
## Advanced usage with options
The directive can accept an options object to customize its behavior:
```vue
Click outside me (but not on the button below)
This button is ignored
```
## Using the `once` option
The directive can be configured to trigger only once:
```vue
Click outside me (works only once)
```
## All options combined
Here's an example using all available options:
```vue
```
## API Reference
### Usage Patterns
```vue
...
...
```
### Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `callback` | `Function` | `undefined` | **Required.** Function to call when clicking outside |
| `ignore` | `string[]` | `[]` | Array of CSS selectors to ignore when detecting clicks |
| `capture` | `boolean` | `false` | Whether to use capture phase for event listening |
| `once` | `boolean` | `false` | Whether to trigger the callback only once |
### Type Definitions
```typescript
interface VClickOutsideOptions {
callback: (...args: any[]) => any
ignore?: string[]
capture?: boolean
once?: boolean
}
type vClickOutsideBindingValue =
| ((...args: any[]) => any)
| VClickOutsideOptions
```
## Global install
### Vue
```typescript
import { vClickOutsideInstall } from 'maz-ui/directives'
import { createApp } from 'vue'
const app = createApp(App)
app.use(vClickOutsideInstall)
app.mount('#app')
```
### Nuxt
Please refer to the [Nuxt module documentation](../ecosystem/nuxt.md) for more information.
---
source: https://maz-ui.com/directives/fullscreen-img.md
---
---
title: "vFullscreenImg"
description: "vFullscreenImg is a Vue directive that opens an image in fullscreen on click, with zoom and navigation between the images of a group"
package: "maz-ui"
url: "https://maz-ui.com/directives/fullscreen-img"
---
# vFullscreenImg
> vFullscreenImg is a Vue directive that opens an image in fullscreen on click, with zoom and navigation between the images of a group
- Package: `maz-ui`
- Import: `import { vFullscreenImg } from 'maz-ui/directives/vFullscreenImg'`
- Web: https://maz-ui.com/directives/fullscreen-img
## Basic usage
```vue
```
## With animate options
```html
```
## On custom element
```html
Click me to show image
```
## Global install
### Vue
`main.ts`
```ts
import { createApp } from 'vue'
import { vFullscreenImgInstall } from 'maz-ui/directives/vFullscreenImg'
const app = createApp(App)
app.use(vFullscreenImgInstall)
app.mount('#app')
```
### Nuxt
Please refer to the [Nuxt module documentation](../ecosystem/nuxt.md) for more information.
## Types
```ts
interface vFullscreenImgBindingOptions extends vFullscreenImgOptions {
src: string
alt?: string | null
}
export type vFullscreenImgBindingValue = string | vFullscreenImgBindingOptions | undefined
```
---
source: https://maz-ui.com/directives/lazy-img.md
---
---
title: "vLazyImg"
description: "vLazyImg is a Vue directive to lazy load images with many options. Images are loaded when they enter the viewport, using a shared IntersectionObserver for optimal performance."
package: "maz-ui"
url: "https://maz-ui.com/directives/lazy-img"
---
# vLazyImg
> vLazyImg is a Vue directive to lazy load images with many options. Images are loaded when they enter the viewport, using a shared IntersectionObserver for optimal performance.
- Package: `maz-ui`
- Import: `import { vLazyImg } from 'maz-ui/directives/vLazyImg'`
- Web: https://maz-ui.com/directives/lazy-img
**Tip: Performance**
Every element bound to the directive shares a pooled `IntersectionObserver` (grouped by observer options) and keeps its state per element. You can render hundreds of lazy images - like a list of [`MazAvatar`](../components/maz-avatar.md) - with only a handful of observers and no leak when elements unmount.
## Basic usage
```vue
```
## Use background image
> Instead of `v-lazy-img` use `v-lazy-img:bg-image`
```vue
```
## Disable lazy loading
Set `disabled: true` to load the image immediately, bypassing the `IntersectionObserver`. Useful for above-the-fold images or server-side rendering.
```vue
```
## Fallback image on error
Provide a `fallbackSrc` to replace the image when it fails to load. Set `fallbackSrc: false` to keep the broken image instead of loading the default placeholder.
```vue
```
## Options
> Open the developer console to show logs
```vue
```
## Global install
### Vue
```typescript
import { vLazyImgInstall, type vLazyImgOptions } from 'maz-ui/directives'
import { createApp } from 'vue'
const app = createApp(App)
// all options (optional)
const vLazyImgOptions: vLazyImgOptions = {
baseClass: 'm-lazy-img',
loadedClass: 'm-lazy-loaded',
loadingClass: 'm-lazy-loading',
errorClass: 'm-lazy-error',
fallbackClass: 'm-lazy-fallback',
observerOnce: true,
loadOnce: true,
observerOptions: {
root: undefined,
rootMargin: undefined,
threshold: 0.1,
},
fallbackSrc: '/images/fallback.png', // or `false` to disable the default placeholder
onLoading: (el: Element) => console.log('loading', el),
onLoaded: (el: Element) => console.log('loaded', el),
onError: (el: Element) => console.log('error', el),
onIntersecting: (el: Element) => console.log('intersecting', el),
}
app.use(vLazyImgInstall, vLazyImgOptions)
app.mount('#app')
```
### Nuxt
Please refer to the [Nuxt module documentation](../ecosystem/nuxt.md) for more information.
## Types
```ts
export interface vLazyImgOptions {
baseClass?: string
loadingClass?: string
loadedClass?: string
errorClass?: string
fallbackClass?: string
observerOnce?: boolean
loadOnce?: boolean
observerOptions?: {
root?: HTMLElement | null
threshold: number
rootMargin?: string
}
/** Image loaded on error - set to `false` to keep the broken image */
fallbackSrc?: string | false
onLoading?: (el: Element) => unknown
onLoaded?: (el: Element) => unknown
onError?: (el: Element) => unknown
onIntersecting?: (el: Element) => unknown
}
interface vLazyImgBindingOptions extends vLazyImgOptions {
/** The source of the image when the binding value is an options object */
src?: string
/** Load the image immediately, bypassing the IntersectionObserver */
disabled?: boolean
}
export type vLazyImgBindingValue = string | vLazyImgBindingOptions
```
---
source: https://maz-ui.com/directives/tooltip.md
---
---
title: "vTooltip"
description: "vTooltip is a Vue directive to display a text when the user hovers an element"
package: "maz-ui"
url: "https://maz-ui.com/directives/tooltip"
---
# vTooltip
> vTooltip is a Vue directive to display a text when the user hovers an element
- Package: `maz-ui`
- Import: `import { vTooltip } from 'maz-ui/directives/vTooltip'`
- Web: https://maz-ui.com/directives/tooltip
## Basic usage
```vue
Top
Right
Left
Bottom
```
## Colors
```html
Primary
Secondary
Success
Warning
destructive
Info
Accent
Contrast
Background
```
## Position
You can change the position of the tooltip by passing a `position` option or using the directive modifier (e.g. `v-tooltip.top`).
```html
Bottom
Left
Right
Top
Top start
Top end
Bottom start
Bottom end
```
## HTML content
You can also use HTML content in the tooltip by passing a string to the `html` option.
```html
HTML
```
## Customization
You can customize the tooltip by passing a `panelClass` or `panelStyle` option.
```html
panelClass
panelStyle
```
## Trigger
You can change the trigger mode of the tooltip by passing a `trigger` option.
The default trigger is `hover`.
The `adaptive` trigger will use the `click` trigger on touch devices (mobile and tablet) and the `hover` trigger on non-touch devices (desktop).
```html
Click
Hover
Adaptive
```
## Offset
The `offset` (in px) option allows you to adjust the position of the tooltip relative to the original element.
```html
0
10
20
40
```
## Open programmatically
```vue
Primary
Toggle tooltip
```
## Conditionally disable
Pass `false`, `null` or `undefined` as the binding value to silently disable the tooltip - no popover instance is created, no listeners are attached, and no warning is logged. This is the recommended way to skip the tooltip on the fly without conditionally rendering two different elements:
```vue
Hover me
```
If the binding switches back to a valid value later, the tooltip mounts as expected. Toggling the value off again destroys the existing popover instance.
## Global install
### Vue
```typescript
import { vTooltipInstall } from 'maz-ui/directives'
import { createApp } from 'vue'
const app = createApp(App)
// Options are optional
app.use(vTooltipInstall, {
position: 'top',
color: 'primary',
})
app.mount('#app')
```
### Nuxt
Please refer to the [Nuxt module documentation](../ecosystem/nuxt.md) for more information.
## Types
```ts
interface VTooltipOptions extends Partial> {
/**
* Text to display in the tooltip
*/
text?: string
/**
* HTML content (alternative to text)
*/
html?: string
/**
* Color variant of the tooltip
* @default default
*/
color?: MazPopoverProps['color']
/**
* Position of the tooltip
* @default top
*/
position?: PopoverPosition
/**
* Trigger of the tooltip
* @default hover
*/
trigger?: MazPopoverTrigger
/**
* Close on click outside
* @default false
*/
closeOnClickOutside?: boolean
/**
* Close on escape
* @default false
*/
closeOnEscape?: boolean
/**
* Open the tooltip
* @default false
*/
open?: boolean
}
type VTooltipBindingValue
= | string
| VTooltipOptions
```
---
source: https://maz-ui.com/directives/zoom-img.md
---
---
title: "vZoomImg"
description: "vZoomImg is a Vue directive to enlarge an image like a modal on click, if you have several images, you can pass them like a carousel"
package: "maz-ui"
url: "https://maz-ui.com/directives/zoom-img"
---
# vZoomImg
> vZoomImg is a Vue directive to enlarge an image like a modal on click, if you have several images, you can pass them like a carousel
- Package: `maz-ui`
- Import: `import { vZoomImg } from 'maz-ui/directives/vZoomImg'`
- Web: https://maz-ui.com/directives/zoom-img
> Can be mixed with [vLazyImg](./lazy-img.md) directive
## Basic usage
> Click on the photo
```vue
Show photo
```
## Options
```vue
```
## Global install
### Vue
```typescript
import { vZoomImgInstall, type vZoomImgOptions } from 'maz-ui/directives'
import { createApp } from 'vue'
const app = createApp(App)
app.use(vZoomImgInstall)
app.mount('#app')
```
### Nuxt
Please refer to the [Nuxt module documentation](../ecosystem/nuxt.md) for more information.
## Types
```ts
export interface vZoomImgOptions {
disabled?: boolean
scale?: boolean
blur?: boolean
}
interface vZoomImgBindingOptions extends vZoomImgOptions {
src: string
alt?: string
}
export type vZoomImgBindingValue = string | vZoomImgBindingOptions
```
---
source: https://maz-ui.com/plugins/aos.md
---
---
title: "aos (animation on scroll)"
description: "Plugin to animate elements on your page as you scroll."
package: "maz-ui"
url: "https://maz-ui.com/plugins/aos"
---
# aos (animation on scroll)
> Plugin to animate elements on your page as you scroll.
- Package: `maz-ui`
- Import: `import { AosPlugin } from 'maz-ui/plugins/aos'`
- Web: https://maz-ui.com/plugins/aos
**Tip:**
This plugin has a composable for easier use, after installing it, you can use [useAos](../composables/use-aos.md)
## Installation
All options are listed in the Global Options section.
```ts [Vue]
import { createApp } from 'vue'
import router from './router'
import { AosPlugin, AosOptions } from 'maz-ui/plugins/aos'
// ⚠️ import necessary CSS file ⚠️
import 'maz-ui/aos.css'
const app = createApp(App)
app.use(router)
const aosOptions: AosOptions = {
animation: {
duration: 1000,
once: false,
delay: 0,
},
delay: 100,
router,
}
app.use(AosPlugin, aosOptions)
app.mount('#app')
```
```ts [Nuxt]
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt'],
mazUi: {
composables: {
useAos: {
animation: {
duration: 1000,
once: false,
delay: 0,
},
delay: 100,
},
},
},
})
```
## Basic usage
```html{1,13}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
```
## Atributes
| Attribute | Description | Example value | Default value |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------- |
| data-maz-aos | animation name | fade-up | - |
| data-maz-aos-duration | \*Duration of animation (ms) | 50 to 3000 (with step of 50) | 300 |
| data-maz-aos-easing | Choose timing function to ease elements in different ways | ease-in-sine | linear |
| data-maz-aos-delay | Delay animation (ms) | 50 to 3000 (with step of 50) | 0 |
| data-maz-aos-anchor | Anchor element, whose offset will be counted to trigger animation instead of actual elements offset. ONLY with ID attribute | #selector | undefined |
| data-maz-aos-once | Choose wheter animation should fire once, or every time you scroll up/down to element | true | false |
## Animations
### Fade
- fade-up
- fade-down
- fade-right
- fade-left
- fade-up-right
- fade-up-left
- fade-down-right
- fade-down-left
### Zoom
- zoom-in
- zoom-in-up
- zoom-in-down
- zoom-in-right
- zoom-in-left
- zoom-out
- zoom-out-up
- zoom-out-down
- zoom-out-right
- zoom-out-left
### Slide
- slide-up
- slide-down
- slide-right
- slide-left
### Flip
- flip-left
- flip-right
- flip-up
- flip-down
### Rotate
- rotate-left
- rotate-right
### Scale
- scale-in
- scale-out
## Easing
You can choose one of these timing function to animate elements nicely:
- linear
- ease
- ease-in
- ease-out
- ease-in-out
- ease-in-back
- ease-out-back
- ease-in-out-back
- ease-in-sine
- ease-out-sine
- ease-in-out-sine
- ease-in-quad
- ease-out-quad
- ease-in-out-quad
- ease-in-cubic
- ease-out-cubic
- ease-in-out-cubic
- ease-in-quart
- ease-out-quart
- ease-in-out-quart
## Nuxt
**Tip:**
For **NuxtJS v3** and higher, use the dedicated Nuxt module to take advantage of auto-imports of components, plugins, composables and css files: [Nuxt Module Documentation](../ecosystem/nuxt.md)
Should be executed on client side
`nuxt.config.(ts|js)`
```ts
export default defineNuxtConfig({
css: ['maz-ui/aos.css'],
})
```
`plugins/maz-aos.client.ts`
```ts
import { AosOptions, installAos } from 'maz-ui/plugins'
export default ({ vueApp, $router: router }) => {
const options: AosOptions = {
router,
animation: {
duration: 1000,
delay: 0,
once: false,
},
}
vueApp.use(installAos, options)
}
```
## Run animations programatically
You can run animations programatically with the useAos composable.
This is useful if you want to run animations after the page is loaded or if no router is provided.
```vue
In the heart of Hollywood's narrow alleyways, there existed an actor like no other - a charismatic feline named Whiskers. With his sleek black fur and piercing eyes, he stole the spotlight in every appearance. Whiskers, known for his versatility and natural talent, seamlessly slipped into dramatic, comedic, or action-packed roles.
```
## Global Options
```ts
export interface AosOptions {
/**
* provide your router to launch animation after each navigation
* @default undefined
*/
router?: Router
/**
* duration in ms before start animations (useful when the HTML rendering is slow)
* @default 100
*/
delay?: number
observer?: {
/**
* Scope animation to specific parent HTMLElement
* @default undefined
*/
root?: Element | Document | null
/**
* margin around elements to trigger the animations - Ex: "100px"
* @default undefined
*/
rootMargin?: string
/**
* Ratio concerponding to the element size
* @default 0.2
*/
threshold?: number | number[]
}
animation?: {
/**
* if `false` the animation is played each times when the element is visible
* @default true
*/
once?: boolean
/**
* Default animation duration in ms
* @default 300
*/
duration?: number
/**
* Default animation delay in ms
* @default 0
*/
delay?: number
}
}
```
---
source: https://maz-ui.com/plugins/dialog.md
---
---
title: "dialog"
description: "Displays messages to your users in flexible and promised dialogs"
package: "maz-ui"
url: "https://maz-ui.com/plugins/dialog"
---
# dialog
> Displays messages to your users in flexible and promised dialogs
- Package: `maz-ui`
- Import: `import { DialogPlugin } from 'maz-ui/plugins/dialog'`
- Web: https://maz-ui.com/plugins/dialog
It is a simple and easy-to-use plugin that allows you to display messages to your users in flexible and promised dialogs. The plugin will mount the `MazDialogConfirm` component to the root of your application and provide you with a handler to open the dialog, close it and return a promise.
**Tip:**
This plugin has a composable for easier use, after installing it you can use [useDialog](../composables/use-dialog.md)
## Installation
```ts [Vue]
import { createApp } from 'vue'
import { DialogPlugin, DialogOptions } from 'maz-ui/plugins/dialog'
const app = createApp(App)
const dialogOptions: DialogOptions = {
// ...
}
app.use(DialogPlugin, dialogOptions)
app.mount('#app')
```
```ts [Nuxt]
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt'],
mazUi: {
composables: {
useDialog: true,
},
},
})
```
## Basic usage
You can display a simple dialog with a title and a message. The dialog will have a confirm and a cancel button. The confirm button will resolve the promise and the cancel button will reject it.
```vue
Show dialog
```
## Custom buttons with on click actions
The buttons property allows you to display custom buttons in the dialog and replace the default confirm and cancel buttons. You can use all props of [`MazBtn`](../components/maz-btn.md#props) component. Each button can have a custom action to execute when clicked.
```vue
Show dialog with custom buttons
```
## Custom response
The buttons property allows you to display custom buttons in the dialog and replace the default confirm and cancel buttons. Each button can have a custom response to return when clicked. The type property allows you to define the type of the button. The response property allows you to define the response of the promise when the button is clicked.
```vue
Show dialog with custom response
```
## Close dialog
You can close the dialog programmatically by calling the close method returned by the open method.
```vue
Open and close dialog
```
## Options
### Usage
```ts
import { useDialog } from 'maz-ui/composables/useDialog'
const dialog = useDialog()
const options: DialogOptions = {
title: 'Dialog title',
message: 'Dialog message',
}
dialog.open(options)
```
### Type
```ts
import type { MazBtnProps } from 'maz-ui/components/MazBtn'
type DialogOptions = Partial> & {
/**
* Dialog identifier - identifier to manage multiple dialogs
* @default 'main-dialog'
*/
identifier?: string
/**
* Custom buttons to display in the dialog and replace the default confirm and cancel buttons
* @default [{ text: 'Confirm', color: 'success', type: 'accept' }, { text: 'Cancel', color: 'destructive', type: 'reject' }]
*/
buttons?: MazDialogConfirmButton[]
/**
* Function to execute when the dialog is accepted (when the user click on the confirm button)
* Only available if the button type is 'accept'
*/
onAccept?: () => unknown
/**
* Function to execute when the dialog is rejected (when the user click on the cancel button)
* Only available if the button type is 'reject'
*/
onReject?: () => unknown
/**
* Function to execute when the dialog is closed
*/
onClose?: () => unknown
}
```
---
source: https://maz-ui.com/plugins/toast.md
---
---
title: "Toast"
description: "A powerful toast notification system for Vue.js that displays user-friendly messages with customizable positioning, styling, and behavior options"
package: "maz-ui"
url: "https://maz-ui.com/plugins/toast"
---
# Toast
> A powerful toast notification system for Vue.js that displays user-friendly messages with customizable positioning, styling, and behavior options
- Package: `maz-ui`
- Import: `import { ToastPlugin } from 'maz-ui/plugins/toast'`
- Web: https://maz-ui.com/plugins/toast
**Tip:**
This plugin has a composable for easier use, after installing it you can use [useToast](../composables/use-toast.md)
## Installation
```ts [Vue]
import { ToastPlugin } from 'maz-ui/plugins/toast'
import { createApp } from 'vue'
const app = createApp(App)
const toastOptions: ToastOptions = {
position: 'bottom-right',
timeout: 10_000,
persistent: false,
}
app.use(ToastPlugin, toastOptions)
app.mount('#app')
```
```ts [Nuxt]
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt'],
mazUi: {
composables: {
useToast: true,
},
},
})
```
## Basic usage
```vue
Message
Info toast on top
Error toast on bottom with 1s timeout
Warning toast on top right
Item 1 Item 2 Item 3 `, { position: 'bottom-left', html: true })">
Toast with html content
Persistent with no timeout
```
### Action and link
Toast can have a link or an action
```vue
Toast with link
Toast with blank link
Toast with action
```
## Close toast programmatically
You can close a toast programmatically by using the `close` method returned by the `toast` function
```typescript
function showToast() {
const toastMessage = toast.message('Toast message closed by code')
setTimeout(() => {
toastMessage.close()
}, 2000)
}
```
### Type
```ts
interface ToastOptions {
/**
* The position of the toast on the screen
* @default 'bottom-right'
*/
position?: ToastPosition
/**
* The timeout is in ms, it's the time before the toast is automatically closed
* if set to `false`, the toast will not be closed automatically
* @default 10000
*/
timeout?: number | boolean
/**
* If the toast is persistent, it can't be closed by user interaction (only on timeout or programmatically)
* @default false
*/
persistent?: boolean
/**
* Display an icon in the toast
* @default true
*/
icon?: boolean
/**
* The action will be displayed as a button in the toast
* @default undefined
*/
button?: MazBtnProps & {
text: string
onClick: () => unknown
href?: string
text?: string
/** @default _self */
target?: string
/** @default false */
closeToast?: boolean
}
buttons?: (MazBtnProps & {
text: string
onClick: () => unknown
href?: string
text?: string
/** @default _self */
target?: string
/** @default false */
closeToast?: boolean
})[]
/**
* If the toast is queued, it will be displayed in the order of the toasts
* @default false
*/
queue?: boolean
/**
* The maximum number of toasts to display
* @default false
*/
maxToasts?: number | boolean
/**
* If the toast is paused on hover, it will be paused when the mouse is over the toast
* @default true
*/
pauseOnHover?: boolean
/**
* If the message is HTML
* @default false
*/
html?: boolean
}
```
---
source: https://maz-ui.com/plugins/wait.md
---
---
title: "wait"
description: "A comprehensive loading state management plugin for Vue.js that provides easy-to-use utilities for handling async operations, loading indicators, and user feedback during data processing or any other async operation"
package: "maz-ui"
url: "https://maz-ui.com/plugins/wait"
---
# wait
> A comprehensive loading state management plugin for Vue.js that provides easy-to-use utilities for handling async operations, loading indicators, and user feedback during data processing or any other async operation
- Package: `maz-ui`
- Import: `import { WaitPlugin } from 'maz-ui/plugins/wait'`
- Web: https://maz-ui.com/plugins/wait
**Tip:**
This plugin has a composable for easier use, after installing it you can use [useWait](../composables/use-wait.md)
## Installation
```ts [Vue]
import { WaitPlugin } from 'maz-ui/plugins/wait'
import { createApp } from 'vue'
const app = createApp(App)
app.use(WaitPlugin)
app.mount('#app')
```
```ts [Nuxt]
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt'],
mazUi: {
composables: {
useWait: true,
},
},
})
```
## Basic usage
```vue
Submit Data
Data Submitted
```
---
source: https://maz-ui.com/ecosystem/eslint-config.md
---
---
title: "@maz-ui/eslint-config"
description: "ESLint flat-config preset for Vue/Nuxt/JS/TS projects, layered on @antfu/eslint-config with SonarJS, Tailwind v3+v4 and a11y add-ons."
package: "@maz-ui/eslint-config"
url: "https://maz-ui.com/ecosystem/eslint-config"
---
# @maz-ui/eslint-config
> ESLint flat-config preset for Vue/Nuxt/JS/TS projects, layered on @antfu/eslint-config with SonarJS, Tailwind v3+v4 and a11y add-ons.
- Package: `@maz-ui/eslint-config`
- Import: `import { defineConfig } from '@maz-ui/eslint-config'`
- Web: https://maz-ui.com/ecosystem/eslint-config
`@maz-ui/eslint-config` ships an opinionated ESLint **flat config** for the kind of stack maz-ui itself uses: TypeScript, Vue 3 / Nuxt 3, optional Tailwind CSS (v3 or v4), and tests. It is built on top of [`@antfu/eslint-config`](https://github.com/antfu/eslint-config) so you get a battle-tested baseline, then layered with quality rules from [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs), Tailwind rules from [`eslint-plugin-better-tailwindcss`](https://github.com/schoero/eslint-plugin-better-tailwindcss), and accessibility rules from [`eslint-plugin-vuejs-accessibility`](https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility).
## Installation
```bash
pnpm add -D @maz-ui/eslint-config eslint
```
The Tailwind plugin and other peer/transitive dependencies are bundled as direct dependencies, so you don't need to install them yourself.
## Basic usage
Create `eslint.config.ts` (or `.mjs`/`.js`) at the root of your project:
```ts
import { defineConfig } from '@maz-ui/eslint-config'
export default defineConfig()
```
That's it. Vue is auto-detected from your `package.json` (presence of `vue` or `nuxt`).
## Configuration
```ts
import { defineConfig } from '@maz-ui/eslint-config'
export default defineConfig({
// Toggle features explicitly (each one is also auto-detected from your deps).
typescript: true, // default
vue: true, // auto-detected
sonarjs: true, // default
tailwindcss: false, // see "Tailwind support" below
vueAccessibility: false, // optional
formatters: true, // CSS/HTML/JSON/YAML/Markdown formatting via dprint
// 'production' downgrades console.log to error, 'development' keeps it warning.
env: 'production',
// Extra ignore globs (merged with sensible defaults).
ignores: ['**/*.generated.ts'],
// Direct rule overrides applied on top of the resolved config.
rules: {
'no-console': 'error',
'vue/custom-event-name-casing': ['error', 'kebab-case'],
},
// Log verbosity - see "Logging" below.
logLevel: 'default',
})
```
## Logging
The preset prints a titled box summarizing what it resolved (typescript, vue, tailwindcss preset, sonarjs, …) when ESLint loads. Powered by [`@maz-ui/node`](https://www.npmjs.com/package/@maz-ui/node)'s consola-based logger.
| `logLevel` | What you see |
| --- | --- |
| `'silent'` | Nothing. |
| `'default'` *(TTY default)* | A titled box summarizing the resolved feature toggles, with `(auto-detected)` / `(default)` annotations next to each value. |
| `'debug'` | Adds one line per major block applied (Vue rules, SonarJS preset, vue-a11y, Tailwind plugin, test relaxations, user overrides). |
| `'verbose'` | Adds the final shape: total block count and ignore-glob count. |
```ts
defineConfig({ logLevel: 'debug' })
```
The default is **`'default'` in interactive terminals (TTY) and `'silent'` otherwise** - CI, lint-staged, pipes, and JSON / SARIF formatters all write to stdout, where the box would corrupt machine-readable output. `logLevel` always wins when set explicitly.
You can also append raw flat-config items as additional arguments - they merge after the built-in configs:
```ts
export default defineConfig(
{ typescript: true },
{
files: ['**/*.legacy.ts'],
rules: { 'ts/no-explicit-any': 'off' },
},
)
```
## Tailwind support
Powered by [`eslint-plugin-better-tailwindcss`](https://github.com/schoero/eslint-plugin-better-tailwindcss) - supports both **Tailwind v3 and v4**, and ESLint 7→10.
The `tailwindcss` option accepts several shapes:
| Value | Behavior |
| --- | --- |
| `false` *(default)* | Disabled. |
| `true` | Same as `'recommended'` with default settings. |
| `'recommended'` | Stylistic + correctness rules. |
| `'stylistic'` | Formatting rules only - class order, line wrapping, no duplicate classes, etc. |
| `'correctness'` | Validation rules only - `no-unknown-classes`, `no-conflicting-classes`. |
| `MazTailwindcssOptions` | Pick a preset and pass plugin settings (Tailwind config path, prefix entry point, …). |
```ts
defineConfig({
tailwindcss: {
preset: 'recommended',
// Tailwind v4 - path to the CSS that does `@import "tailwindcss" prefix(maz)`.
entryPoint: 'src/main.css',
// Tailwind v3 instead - path to your config file.
// tailwindConfig: 'tailwind.config.ts',
// Tailwind v4: detect custom @layer components classes (cards, btns, …).
detectComponentClasses: true,
// Monorepo: directory used to resolve `tailwindcss` and the config file.
cwd: 'apps/web',
// Custom `maz/tailwind-no-arbitrary-px` rule - see "Custom rules" below.
noArbitraryPx: true,
},
})
```
**Warning: Plugin needs to know your Tailwind setup**
The plugin's correctness rules (`no-unknown-classes`, `no-conflicting-classes`) auto-resolve your Tailwind installation. Without `entryPoint` (v4) or `tailwindConfig` (v3), the plugin falls back to the **default Tailwind config** and won't know about your prefix, custom utilities, or theme tokens - which produces a flood of false positives in non-vanilla setups.
If you customize Tailwind in any meaningful way (prefix, extend theme, custom utilities), set `entryPoint` or `tailwindConfig` explicitly. If you hit false positives anyway, downgrade to `'stylistic'` (formatting only) or disable individual rules:
```ts
defineConfig({
tailwindcss: 'recommended',
rules: {
'better-tailwindcss/no-unknown-classes': 'off',
},
})
```
The plugin recognizes the most common class-name utilities out of the box (`clsx`, `cn`, `tw-merge`, `cva`, `tv`, …); see the [plugin docs](https://github.com/schoero/eslint-plugin-better-tailwindcss) for the full list and how to register your own.
## Custom rules
`@maz-ui/eslint-config` ships its own ESLint plugin under the **`maz/*`** namespace. Rules are grouped by category - `maz/tailwind-*` today, with room for `maz/js-*` and others as they get added.
### `maz/tailwind-no-arbitrary-px`
Forbids `px` units inside Tailwind arbitrary value classes (`w-[16px]`, `m-[-16px]`, `[gap:24px]`, …) and **autofixes** them to `rem` (or `em`) using your project's root font-size. Whitespace inside brackets (e.g. `[up to 100px]`) is left alone, so plain prose is never rewritten by accident.
**Note: Registered only when `tailwindcss` is enabled**
The `maz` plugin and the `maz/tailwind-*` rules are only added to the flat-config when `tailwindcss` is set to anything other than `false`. With `tailwindcss: false` *(default)*, neither the plugin nor the rule appear in the resolved config - keeping the preset zero-cost for non-Tailwind projects. To use the rule without opting into the full Tailwind preset, register `mazPlugin` manually (see Use the plugin directly).
When `tailwindcss` is on, the rule is enabled with defaults. You can tune it two ways:
**Standard ESLint override** *(idiomatic, max control)*
```ts
defineConfig({
tailwindcss: 'recommended',
rules: {
'maz/tailwind-no-arbitrary-px': ['error', { baseFontSize: 10, unit: 'em' }],
},
})
```
User `rules` overrides are applied in a *trailing* flat-config block, so they win over the defaults wired in by `tailwindcssConfigs`.
**Ergonomic shortcut** *(set defaults via `tailwindcss.noArbitraryPx`)*
```ts
defineConfig({
tailwindcss: {
preset: 'recommended',
noArbitraryPx: {
baseFontSize: 16, // default - divide px by this to get rem
unit: 'rem', // default - output unit ('rem' | 'em')
severity: 'error', // default - 'off' | 'warn' | 'error'
},
},
})
```
| `noArbitraryPx` value | Behavior |
| ---------------------------------- | --------------------------------------------------- |
| `true` *(default)* | Enabled with defaults (`baseFontSize: 16`, `rem`). |
| `false` | Disabled. |
| `{ baseFontSize, unit, severity }` | Override any subset of the defaults. |
If both are set, the standard `rules` override wins (it's the last block applied).
What the autofix does (with `baseFontSize: 16`):
| Before | After |
| ----------------------- | ------------------------ |
| `w-[16px]` | `w-[1rem]` |
| `m-[-16px]` | `m-[-1rem]` |
| `tracking-[.5px]` | `tracking-[0.03125rem]` |
| `p-[16px_8px]` | `p-[1rem_0.5rem]` |
| `[gap:24px]` | `[gap:1.5rem]` |
| `w-[calc(100%-16px)]` | `w-[calc(100%-1rem)]` |
| `md:hover:w-[16px]` | `md:hover:w-[1rem]` |
The rule fires on:
- JSX `className` strings and template literals
- Vue SFC static `class="…"` attributes (via `vue-eslint-parser`)
- Vue dynamic `:class` bindings, including string literals inside arrays / objects
- Function-call arguments and tagged template literals (`clsx`, `cn`, `cva`, `tw`, …)
### Use the plugin directly
If you don't want the full Tailwind preset (or just prefer wiring rules yourself), import `mazPlugin` and register it in your own flat-config block. This is also the way to use `maz/tailwind-*` rules **without** enabling `tailwindcss` in `defineConfig`:
```ts
import { mazPlugin } from '@maz-ui/eslint-config'
export default [{
files: ['**/*.{ts,tsx,vue}'],
plugins: { maz: mazPlugin },
rules: {
'maz/tailwind-no-arbitrary-px': ['error', { baseFontSize: 16, unit: 'rem' }],
},
}]
```
## What it includes
- **Antfu base** - TypeScript-aware rules, Stylistic formatting, modern import order.
- **SonarJS** - code quality and complexity heuristics, with a relaxed set for `*.spec.ts` / `*.test.ts`.
- **Vue rules** (when Vue/Nuxt is detected) - block-tag order, naming conventions, template a11y.
- **Tailwind plugin** (opt-in) - class ordering, duplicate / deprecated / unknown / conflicting class detection - see Tailwind support.
- **`maz/*` custom rules** - namespaced ESLint plugin shipped with the preset; see Custom rules.
- **Markdown** - prose linting baseline.
- **vueAccessibility** (opt-in) - `eslint-plugin-vuejs-accessibility` rules with the AudioWorklet globals fix.
## Advanced
### Compose your own config
```ts
import {
baseRules,
mazPlugin,
sonarjsRules,
tailwindcssConfigs,
vueRules,
} from '@maz-ui/eslint-config'
export default [
{
plugins: { maz: mazPlugin },
rules: {
...baseRules(true), // production = true → no-console: 'error'
...sonarjsRules,
...vueRules,
'maz/tailwind-no-arbitrary-px': 'error',
},
},
// Drop in just the Tailwind block, with whatever preset and settings you want.
...tailwindcssConfigs('stylistic', {
entryPoint: 'src/main.css',
noArbitraryPx: { unit: 'em' },
}),
]
```
### Auto-detection caveat (monorepos)
Auto-detection of Vue / Nuxt reads the `package.json` in `process.cwd()` only. In a monorepo where `vue` is hoisted to the root and missing from a sub-package's `package.json`, detection silently fails. Set `vue: true` explicitly in those cases:
```ts
defineConfig({ vue: true, tailwindcss: { preset: 'recommended', cwd: 'apps/web' } })
```
## Compatibility
| Tool | Required version |
| --- | --- |
| ESLint | `>=9.0.0 <11.0.0` |
| Node.js | `>=20.19.0` |
| TypeScript | `^5.0.0` |
| Tailwind CSS | `^3.3.0 \|\| ^4.0.0` *(when `tailwindcss` is on)* |
---
source: https://maz-ui.com/ecosystem/icons/index.md
---
---
title: "@maz-ui/icons"
description: "The @maz-ui/icons package provides 860+ SVG icons (interface icons, brand logos, country flags) as tree-shakable Vue components, lazy components or raw SVG strings"
package: "@maz-ui/icons"
url: "https://maz-ui.com/ecosystem/icons/"
---
# @maz-ui/icons
> The @maz-ui/icons package provides 860+ SVG icons (interface icons, brand logos, country flags) as tree-shakable Vue components, lazy components or raw SVG strings
- Package: `@maz-ui/icons`
- Import: `import { MazCheck } from '@maz-ui/icons/static/MazCheck'` or `import { MazIconsResolver } from '@maz-ui/icons/resolvers'`
- Web: https://maz-ui.com/ecosystem/icons/
A comprehensive collection of **860 beautiful SVG icons** ready for use in your Vue.js applications. Built with performance and flexibility in mind, these icons are optimized for modern web development.
## Features
- **860+ icons** - All icons are available [in the icon set page](./icon-set.md)
- **Three component variants** - `static` (eager Vue component, default), `lazy` (async Vue component), and `raw` ✨ **(new in v5)** raw SVG strings for inlining without a Vue component or async chunk
- **Multiple usage patterns** - Vue components, raw SVG strings, direct SVG files, or auto-import
- **TypeScript support** - Full type definitions included
- **Tree-shakeable** - Import only the icons you need
- **Customizable** - Easy to style with CSS
- **Optimized SVGs** - Clean, minimal markup for best performance
- **Auto-import resolver** - Seamless integration with unplugin-vue-components
- **Build tool integration** - Works perfectly with Vite and vite-svg-loader
## Installation
### Basic Installation
```bash [npm]
npm install @maz-ui/icons
```
```bash [yarn]
yarn add @maz-ui/icons
```
```bash [pnpm]
pnpm add @maz-ui/icons
```
### With Auto-import Support (Recommended)
For the best developer experience with auto-imports:
```bash
npm install @maz-ui/icons unplugin-vue-components
```
### With vite-svg-loader Integration
To use SVG files as Vue components:
```bash
npm install @maz-ui/icons vite-svg-loader
```
## Usage Methods
### Method 1: Vue Components (Recommended)
Import and use icons as Vue components. Icons are available in two variants:
- **Static** (default) - eagerly loaded, rendered immediately with no async overhead
- **Lazy** - loaded on demand via `defineAsyncComponent`, ideal for optimizing bundle size
#### Static Icons (default)
```vue
```
#### Lazy Icons
Lazy icons are prefixed with `Lazy` and use `defineAsyncComponent` under the hood. Use them when you want to reduce your initial bundle size:
```vue
```
**Tip: Sub-path imports for better tree-shaking**
You can also import individual icons directly for optimal tree-shaking:
```ts
// Static Vue component (individual file)
import { MazCheck } from '@maz-ui/icons/static/MazCheck'
// Lazy Vue component (individual file)
import { MazCheck } from '@maz-ui/icons/lazy/MazCheck'
// Raw SVG string (individual file) - new in v5
import { MazCheck } from '@maz-ui/icons/raw/MazCheck'
```
#### Raw SVG strings (new in v5)
Each icon is also exported as a **raw SVG string** under the `raw/` subpath. Pass it to ` ` to inline the SVG without paying the cost of a Vue component or an async chunk - useful for icons rendered hundreds of times on a page (lists, tables) or for one-off `innerHTML` use.
```vue
```
**When to use which variant:**
| Variant | Bundle cost | Use case |
| --- | --- | --- |
| `static` | Vue component, eager | Default. Few icons per page, simplest path. |
| `lazy` | Vue component, async chunk | Many icons but most off-screen at first paint. |
| `raw` | Inline SVG string | Same icon repeated many times in a list/table; or you want zero component overhead. |
**Benefits:**
- ✅ Tree-shaking - Only bundled icons are included
- ✅ TypeScript support with full IntelliSense
- ✅ Static icons render immediately, lazy icons optimize bundle size
- ✅ Easy to style with CSS classes
### Method 2: Auto-import with Resolver
Never worry about imports again with automatic component resolution.
#### Setup unplugin-vue-components
**Warning: Troubleshooting**
If your are already using [`MazComponentsResolver`](../../guide/resolvers.md#mazcomponentsresolver), you should place `MazIconsResolver` before `MazComponentsResolver` in the `resolvers` array.
`vite.config.ts`
```ts
import { MazIconsResolver } from '@maz-ui/icons/resolvers'
import Components from 'unplugin-vue-components/vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
Components({
resolvers: [
MazIconsResolver() // Auto-import Maz UI icons
]
})
]
})
```
#### Usage (No Imports Required!)
```vue
```
The resolver automatically resolves:
- `MazXxx` → static icon from `@maz-ui/icons/MazXxx`
- `LazyMazXxx` → lazy icon from `@maz-ui/icons/lazy/MazXxx`
**Benefits:**
- ✅ Zero import boilerplate
- ✅ Full TypeScript support
- ✅ Tree-shaking still works
- ✅ Both static and lazy variants supported
- ✅ IntelliSense for all available icons
### Method 3: With vite-svg-loader
Transform SVG files into Vue components at build time:
#### Vite Configuration
`vite.config.ts`
```ts
import svgLoader from 'vite-svg-loader'
export default defineConfig({
plugins: [
svgLoader({
defaultImport: 'component' // Import as Vue component by default
})
]
})
```
#### Usage in Components
```vue
```
**Benefits:**
- ✅ Build-time optimization
- ✅ Full Vue component features (props, slots, etc.)
- ✅ Better performance than runtime imports
- ✅ Automatic TypeScript declarations
### Method 4: Direct SVG Files
Access SVG files directly for maximum flexibility:
```vue
```
**Benefits:**
- ✅ Direct file access
- ✅ Smallest possible bundle size
- ✅ Can be used in any context (not just Vue)
- ✅ Easy to embed in CSS or other assets
## Styling Icons
Icons inherit the current text color and can be styled like any other element:
```vue
```
### CSS Custom Properties
All icons support CSS custom properties for advanced styling:
```css
.custom-icon {
--icon-size: 1.5rem;
--icon-color: theme('colors.blue.500');
--icon-hover-color: theme('colors.blue.600');
width: var(--icon-size);
height: var(--icon-size);
color: var(--icon-color);
transition: color 0.2s ease;
}
.custom-icon:hover {
color: var(--icon-hover-color);
}
```
## Available Icons
The library includes **860+ carefully** covering all common use cases:
### Icon Naming Convention
All icons follow a consistent naming pattern:
- Static Vue components: `Maz` + PascalCase (e.g., `MazUserCircle`)
- Lazy Vue components: `LazyMaz` + PascalCase (e.g., `LazyMazUserCircle`)
- SVG files: kebab-case (e.g., `user-circle.svg`)
```typescript
// Static component imports (eagerly loaded)
import {
MazArrowRight, // arrow-right.svg
MazChatBubbleLeft, // chat-bubble-left.svg
MazShoppingCart, // shopping-cart.svg
MazUserCircle // user-circle.svg
} from '@maz-ui/icons'
// Lazy component imports (async loaded)
import {
LazyMazArrowRight,
LazyMazUserCircle
} from '@maz-ui/icons'
// Or import lazy icons without the Lazy prefix from the sub-path
import { MazArrowRight } from '@maz-ui/icons/lazy'
```
You can search icons on [Heroicons](https://heroicons.com/) and copy the name of the icon to use it in your project.
## Advanced Configuration
### Custom Icon Loading
Create your own icon loading utility:
```typescript
// utils/iconLoader.ts
import type { Component } from 'vue'
import { defineAsyncComponent } from 'vue'
interface IconComponents {
[key: string]: Component
}
export function createIconLoader(iconNames: string[]): IconComponents {
const icons: IconComponents = {}
iconNames.forEach((name) => {
const componentName = `Maz${name.split('-').map(
word => word.charAt(0).toUpperCase() + word.slice(1)
).join('')}`
icons[componentName] = defineAsyncComponent(
() => import(`@maz-ui/icons/svg/${name}.svg?component`)
)
})
return icons
}
// Usage
const icons = createIconLoader(['check', 'user', 'heart'])
```
### Dynamic Icon Loading
Load icons dynamically based on runtime conditions:
```vue
```
### Build-time Icon Optimization
Optimize icons at build time with custom Vite plugin:
```typescript
// vite-plugin-icon-optimizer.ts
import type { Plugin } from 'vite'
import { readFileSync } from 'node:fs'
import { optimize } from 'svgo'
export function iconOptimizer(): Plugin {
return {
name: 'icon-optimizer',
transform(code, id) {
if (id.includes('@maz-ui/icons/svg') && id.endsWith('.svg')) {
const svgContent = readFileSync(id.replace('?component', ''), 'utf-8')
const optimized = optimize(svgContent, {
plugins: [
'removeDoctype',
'removeComments',
'removeEmptyElements',
'mergePaths'
]
})
return `export default ${JSON.stringify(optimized.data)}`
}
}
}
}
```
## Integration Examples
### With Tailwind CSS
```vue
```
### With Pinia Store
```typescript
import type { Component } from 'vue'
// stores/icons.ts
import { defineStore } from 'pinia'
export const useIconStore = defineStore('icons', () => {
const loadedIcons = ref>(new Map())
async function loadIcon(name: string): Promise {
if (loadedIcons.value.has(name)) {
return loadedIcons.value.get(name)!
}
const icon = await import(`@maz-ui/icons/svg/${name}.svg?component`)
loadedIcons.value.set(name, icon.default)
return icon.default
}
return { loadIcon }
})
```
## Troubleshooting
### Common Issues
**Icons not displaying:**
- Ensure SVG files are properly served by your build tool
- Check if CSS `currentColor` is being inherited correctly
- Verify vite-svg-loader configuration if using component imports
**TypeScript errors:**
- Add `vite-svg-loader` types to your `tsconfig.json`:
```json
{
"compilerOptions": {
"types": ["vite-svg-loader"]
}
}
```
**Auto-import not working:**
- Verify `unplugin-vue-components` is properly configured
- Check that `MazIconsResolver` is included in resolvers array
- Ensure icon names match the exact component names
## Bundle Size
| Usage Method | Bundle Impact | Best For |
| -------------------- | ------------- | ------------------------------------- |
| Static components | Tree-shaken | Immediate rendering, critical UI |
| Lazy components | Code-split | Non-critical icons, large icon sets |
| Direct SVG | Minimal | Static usage, minimal bundles |
| Auto-import | Tree-shaken | Development experience |
| vite-svg-loader | Optimized | Build-time optimization |
## Related Packages
- [Heroicons](https://heroicons.com/) - Tailwind CSS icons
- [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components) - Auto-import components
- [`vite-svg-loader`](https://github.com/jpkleemans/vite-svg-loader) - Load SVG as Vue components
---
**Need help?** Check out our [GitHub discussions](https://github.com/LouisMazel/maz-ui/discussions) or open an [issue](https://github.com/LouisMazel/maz-ui/issues).
---
source: https://maz-ui.com/ecosystem/icons/icon-set.md
---
---
title: "Icon Set"
description: "Search and copy the 860+ icons of @maz-ui/icons, with the naming convention and the static, lazy and raw imports of each icon"
package: "@maz-ui/icons"
url: "https://maz-ui.com/ecosystem/icons/icon-set"
---
# Icon Set
> Search and copy the 860+ icons of @maz-ui/icons, with the naming convention and the static, lazy and raw imports of each icon
- Package: `@maz-ui/icons`
- Web: https://maz-ui.com/ecosystem/icons/icon-set
The library includes **860+ icons**
## Icon Naming Convention
All icons follow a consistent naming pattern:
- Static Vue components: `Maz` + PascalCase (e.g., `MazUserCircle`)
- Lazy Vue components: `LazyMaz` + PascalCase (e.g., `LazyMazUserCircle`)
- SVG files: kebab-case (e.g., `user-circle.svg`)
## Find your icon
---
source: https://maz-ui.com/ecosystem/mcp.md
---
---
title: "MCP server"
description: "The maz-ui MCP server gives AI coding agents the version-matched knowledge of maz-ui and its ecosystem - search by need, exact component APIs, icons, Tailwind theme tokens, setup guides and code review."
package: "@maz-ui/mcp"
url: "https://maz-ui.com/ecosystem/mcp"
---
# MCP server
> The maz-ui MCP server gives AI coding agents the version-matched knowledge of maz-ui and its ecosystem - search by need, exact component APIs, icons, Tailwind theme tokens, setup guides and code review.
- Package: `@maz-ui/mcp`
- Web: https://maz-ui.com/ecosystem/mcp
**Tip: Start with `npx @maz-ui/mcp init`**
It registers the server and writes the maz-ui rules for the agents of your project. See [AI agents](../guide/ai-agents.md) for the complete picture (rules, version-matched docs, Claude Code plugin, code review in CI).
## Tools
| Tool | Purpose |
| --- | --- |
| `search_docs` | Find what maz-ui provides for a need, described in plain words ("user avatar with initials", "confirm before delete", "debounce search") or by name. Understands the vocabulary of other libraries ("modal", "snackbar", "combobox") |
| `get_component_api` | Exact API of up to 10 components: props with types, defaults and accepted values, `v-model`, events with payload, slots with bindings, exposed methods |
| `find_icons` | Icons of `@maz-ui/icons` by meaning ("delete", "settings", "france flag") with their imports |
| `get_theme_tokens` | The theme of your project (preset values, `@theme` tokens, variants, utilities, read from your files) and every Tailwind class and CSS variable of the maz-ui theme: colors, radius, shadows, spacing, breakpoints, fonts, z-index, utilities |
| `get_doc` | Any documentation page by id or name (`components/maz-btn`, `useToast`, `guide/tailwind`), whole or by sections |
| `list_docs` | Catalog of the components, composables, directives, plugins, helpers, packages and guides |
| `get_setup_guide` | Installation steps for Vue or Nuxt, with or without Tailwind |
| `review_code` | Review files or code against the installed maz-ui: unknown props or values, unknown icons, native elements and libraries maz-ui already covers, default Tailwind palette, `maz:` prefix... |
Every tool is read-only. The server also gives agents instructions on when to use them, so they look maz-ui up before writing code.
### Prompts
| Prompt | Purpose |
| --- | --- |
| `build` | Implement a feature with the maz-ui ecosystem (search, APIs, icons, tokens, review) |
| `audit` | Find and fix what re-implements maz-ui in existing files |
| `setup` | Install and configure maz-ui in the project |
In Claude Code, they are available as `/maz-ui:build`, `/maz-ui:audit` and `/maz-ui:setup`.
## Version-matched docs
The server serves the documentation of the **maz-ui version installed in your project** (`node_modules/maz-ui/docs`), found from the directory it is started in (monorepos: the root, then `apps/*` and `packages/*`). Without maz-ui installed, it serves the docs bundled with `@maz-ui/mcp` (latest release).
To force a folder, pass `--docs ` or set `MAZ_UI_DOCS_DIR`.
## Configuration
`npx @maz-ui/mcp init` writes the configuration of Claude Code, Cursor and VS Code for you. To configure an agent by hand, start the server with `npx -y @maz-ui/mcp@latest`.
### Claude Code
```bash
# for every project, without any file in them
claude mcp add maz-ui --scope user -- npx -y @maz-ui/mcp@latest
# or for this project only (written in .mcp.json, shared with your team)
claude mcp add maz-ui --scope project -- npx -y @maz-ui/mcp@latest
```
Or in `.mcp.json`:
```json
{
"mcpServers": {
"maz-ui": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@maz-ui/mcp@latest"]
}
}
}
```
The [Claude Code plugin](../guide/ai-agents.md#claude-code-plugin) includes the server.
### Cursor
`.cursor/mcp.json`:
```json
{
"mcpServers": {
"maz-ui": {
"command": "npx",
"args": ["-y", "@maz-ui/mcp@latest"]
}
}
}
```
### VS Code (GitHub Copilot)
`.vscode/mcp.json`:
```json
{
"servers": {
"maz-ui": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@maz-ui/mcp@latest"]
}
}
}
```
### Codex
`~/.codex/config.toml`:
```toml
[mcp_servers.maz-ui]
command = "npx"
args = ["-y", "@maz-ui/mcp@latest"]
```
### Windsurf, Claude Desktop, Cline, Zed...
Add the same `command` and `args` to the MCP configuration of the client (`mcpServers` key):
```json
{
"mcpServers": {
"maz-ui": {
"command": "npx",
"args": ["-y", "@maz-ui/mcp@latest"]
}
}
}
```
## Command line
The package is also a CLI:
```bash
npx @maz-ui/mcp # start the MCP server (stdio)
npx @maz-ui/mcp init # configure the AI agents of the project
npx @maz-ui/mcp review # review files against maz-ui (CI)
npx @maz-ui/mcp search # search the docs from the terminal
npx @maz-ui/mcp --help
```
See [Code review in CI](../guide/ai-agents.md#code-review-in-ci) for the review options and rules.
## Programmatic API
```ts
import { createMazUiMcpServer, loadKnowledge, reviewCode } from '@maz-ui/mcp'
const knowledge = loadKnowledge({ cwd: process.cwd() })
const findings = reviewCode(' ', {
knowledge,
filename: 'Example.vue',
})
```
## Debugging
```bash
npx @modelcontextprotocol/inspector npx -y @maz-ui/mcp@latest
```
---
source: https://maz-ui.com/ecosystem/node/index.md
---
---
title: "@maz-ui/node"
description: "Lightweight Node.js utilities - promise-based shell execution, an opinionated consola-backed logger, and a banner printer for CLIs."
package: "@maz-ui/node"
url: "https://maz-ui.com/ecosystem/node/"
---
# @maz-ui/node
> Lightweight Node.js utilities - promise-based shell execution, an opinionated consola-backed logger, and a banner printer for CLIs.
- Package: `@maz-ui/node`
- Web: https://maz-ui.com/ecosystem/node/
`@maz-ui/node` powers the CLIs and build scripts inside the maz-ui ecosystem. It's intentionally tiny: an `exec` wrapper that returns a real `Promise`, a colourful logger built on [consola](https://github.com/unjs/consola), and a banner helper using [figlet](https://github.com/patorjk/figlet.js).
## Installation
```bash [pnpm]
pnpm add @maz-ui/node
```
```bash [npm]
npm install @maz-ui/node
```
```bash [yarn]
yarn add @maz-ui/node
```
## Basic usage
```ts
import { execPromise, logger, printBanner } from '@maz-ui/node'
printBanner({ name: 'my-cli', version: '1.0.0' })
logger.info('Running tests…')
await execPromise('npm test', { packageName: 'tests' })
logger.success('Done')
```
## What's inside
- [`execPromise`](./exec-promise.md) - Promise-based `child_process.exec` with structured logging.
- [`logger` / `createLogger`](./logger.md) - consola-backed logger with semantic log levels and helpers (`box`, `divider`, `brand`, …).
- [`printBanner`](./print-banner.md) - ASCII-art banner printer (figlet) with versioning, dividers and clearing.
- [`setupAgents`](./setup-agents.md) - Configure the AI coding agents of a project for maz-ui (rules and MCP server), as `npx @maz-ui/mcp init` does.
## Requirements
- Node.js >= 22.12.0
- ESM only - published as `"type": "module"`.
---
source: https://maz-ui.com/ecosystem/nuxt.md
---
---
title: "Install maz-ui with Nuxt"
description: "The ultimate Nuxt module for Maz-UI - zero-config setup with auto-imports, theming, internationalization and powerful features out of the box"
package: "@maz-ui/nuxt"
url: "https://maz-ui.com/ecosystem/nuxt"
---
# Install maz-ui with Nuxt
> The ultimate Nuxt module for Maz-UI - zero-config setup with auto-imports, theming, internationalization and powerful features out of the box
- Package: `@maz-ui/nuxt`
- Web: https://maz-ui.com/ecosystem/nuxt
**Maz-UI Nuxt Module** provides zero-configuration setup, intelligent auto-imports, powerful theming capabilities and internationalization.
**Tip: Model Context Protocol (MCP)**
In development, the module connects the AI coding agents detected in the project (Claude Code, Cursor, Copilot...) to the maz-ui [MCP server](./mcp.md), which gives them the docs and rules of the installed maz-ui. See AI Agents.
Check out the documentation of [@maz-ui/mcp](./mcp.md)
## Why Choose Maz-UI for Nuxt?
- **Zero Configuration** - Works out of the box with sensible defaults
- **Advanced Theming** - Built-in dark mode, custom themes, and CSS variables
- **Auto-Import Everything** - Components, composables, and directives automatically available
- **Performance Optimized** - Tree-shaking, lazy loading, and SSR-friendly CSS injection
- **Developer Experience** - TypeScript support, DevTools integration, and IntelliSense
- **Production Ready** - SSR/SSG support with client-side hydration
## Installation
```bash [pnpm]
pnpm add @maz-ui/nuxt
```
```bash [npm]
npm install @maz-ui/nuxt
```
```bash [yarn]
yarn add @maz-ui/nuxt
```
```bash [nuxt]
pnpx nuxt@latest module add @maz-ui/nuxt
```
Add the module to your `nuxt.config.ts`:
```ts
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt']
})
```
That's it! 🎉 All components and composables are now auto-imported and ready to use.
## Quick Start
### Instant Usage
No imports needed - everything is auto-imported:
```vue
Start timer ({{ remainingTime }}ms)
Toggle dark mode ({{ isDark ? '🌙' : '☀️' }})
```
## Configuration
### Minimal Setup
For most use cases, no configuration is needed:
```ts
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt']
// That's it! 🎉
})
```
### Advanced Configuration
Customize everything to your needs:
```ts
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt'],
mazUi: {
// General Settings
general: {
autoImportPrefix: 'Maz', // useMazToast instead of useToast
defaultMazIconPath: '/icons', // Default path for
devtools: true, // Enable DevTools integration
preventIosInputZoom: true, // No zoom on focused fields on iOS
},
// CSS & Styling
css: {
injectCss: true, // Auto-inject Maz-UI styles
},
// Theming System
theme: {
preset: 'maz-ui', // 'maz-ui' | 'pristine' | 'ocean' | 'obsidian' | 'nova' | custom object
strategy: 'runtime', // 'runtime' | 'buildtime'
darkModeStrategy: 'class', // 'class' | 'media'
darkClass: 'dark', // class on when colorMode === 'dark' (default: 'dark')
lightClass: 'light', // class on when colorMode === 'light' (default: 'light')
overrides: {
colors: {
light: { primary: 'oklch(0.65 0.19 254)' },
dark: { primary: 'oklch(0.72 0.18 254)' }
}
},
mode: 'both', // 'light' | 'dark' | 'both'
},
// Translations
translations: {
locales: 'fr',
fallbackLocale: 'en',
messages: {
// override default messages or add new languages
},
},
// Components
components: {
autoImport: true, // All components globally available
},
// Global component defaults (priority: instance prop > defaults[Component] > defaults.global > library default)
defaults: {
global: { roundedSize: 'lg' }, // cross-cutting (roundedSize, size)
MazBtn: { roundedSize: 'full' }, // per-component, wins over global
MazCard: { bordered: false, elevation: true },
},
// Country flags of MazSelectCountry and MazInputPhoneNumber: 'cdn' (default), 'local' (offline) or '/flags/{code}.svg'
flags: 'local',
// Plugins (not enabled by default)
plugins: {
aos: true,
dialog: true,
toast: true,
wait: true,
},
// Composables (enabled by default)
composables: {
useFormValidator: true,
useFreezeValue: true,
useIdleTimeout: false,
useInstanceUniqId: false,
useMountComponent: false,
useReadingTime: false,
useStringMatching: false,
},
// Directives (not enabled by default)
directives: {
vTooltip: true,
vLazyImg: true,
vClickOutside: true,
vFullscreenImg: true,
vZoomImg: true,
},
// AI coding agents (default: { rules: false, mcp: true }, false to disable)
agents: { rules: true, mcp: true },
}
})
```
## Complete Configuration Reference
### General Configuration
```ts
const general = {
// Add prefix to all auto-imported composables
autoImportPrefix: 'Maz', // only for composables, generates useMazToast, useMazTheme, etc.
// Default icon path for
defaultMazIconPath: '/icons',
// Enable Nuxt DevTools integration
devtools: true,
// Stop iOS from zooming the page when a form field gets the focus (default: false)
// Adds `maximum-scale=1` to the viewport on iOS only, see the preventIosInputZoom helper of @maz-ui/utils
preventIosInputZoom: false,
}
```
### CSS Configuration
```ts
const css = {
// Auto-inject Maz-UI base styles
injectCss: true,
}
```
### Theme System
The most powerful theming system for Nuxt applications:
```ts
const theme = {
// Use predefined presets or create custom ones
preset: 'maz-ui', // 'mazUi' | 'dark' | 'ocean' | CustomThemeObject
// Override specific parts of the theme
overrides: {
colors: {
light: {
primary: 'oklch(0.6 0.18 254)',
secondary: 'oklch(0.96 0.01 254)',
surface: 'oklch(1 0 0)',
foreground: 'oklch(0.16 0.02 254)',
},
dark: {
primary: 'oklch(0.72 0.18 254)',
secondary: 'oklch(0.22 0.02 254)',
surface: 'oklch(0.16 0.02 254)',
foreground: 'oklch(0.96 0.005 254)',
}
},
// Override other theme properties...
},
// Supported color modes to use
mode: 'both', // 'light' | 'dark' | 'both'
// Initial color mode to use (only if mode is 'both')
colorMode: 'auto', // 'light' | 'dark' | 'auto'
// CSS generation strategy
strategy: 'runtime', // 'runtime' (recommended) | 'buildtime'
// Dark mode handling
darkModeStrategy: 'class', // 'class' | 'media'
// Class added to when colorMode === 'dark' (default: 'dark')
darkClass: 'dark',
// Class added to when colorMode === 'light' (default: 'light')
// Mirror of darkClass - used to force `color-scheme: only light`.
lightClass: 'light',
// Persist the active preset name in the `maz-preset` cookie so the
// user's last-used theme is restored on reload. Default: true.
persistPreset: true,
}
```
### Global Component Defaults
Set default prop values once for every component. Resolution priority, per prop: instance prop > `defaults[Component]` > `defaults.global` > library default. A global default never overrides a prop set on the instance.
```ts
const defaults = {
// Cross-cutting tokens applied to every component that exposes them
global: {
roundedSize: 'lg', // 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'
size: 'sm', // 'mini' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
},
// Per-component defaults, strongly typed as Partial, win over `global`
MazBtn: { roundedSize: 'full' },
MazCard: { bordered: false, elevation: true },
MazContainer: { bordered: false },
}
```
See the [Global component defaults guide](../guide/global-defaults.md) for the full list of globalizable props.
### Country Flags
Source of the flags of `MazSelectCountry` and `MazInputPhoneNumber`. A `flag-src` set on a component wins.
```ts
export default defineNuxtConfig({
mazUi: {
// 'cdn' (default): flagcdn.com
// 'local': flags of @maz-ui/icons, one chunk per flag loaded when visible, no request to a third party
// '/flags/{code}.svg': your own files ({CODE} for uppercase codes)
flags: 'local',
},
})
```
Nothing is added to your build unless `flags` is `'local'`. See [MazSelectCountry](../components/maz-select-country.md#flags-source) for the details (Content Security Policy, PWA precache).
## Theme Strategies Explained
### Runtime (Recommended)
The full theme CSS is generated and injected synchronously on first paint:
- **No FOUC** - The full stylesheet is rendered in the document head before the first paint
- **SSR-friendly** - On Nuxt SSR, the CSS is inlined via `useHead` during server rendering and re-used on the client
- **Dynamic** - `useTheme().updateTheme(...)` re-injects the new CSS on the fly
```ts
export default defineNuxtConfig({
mazUi: {
theme: {
strategy: 'runtime' // Recommended for most use cases
}
}
})
```
### Buildtime
Build-time CSS generation strategy:
- **No runtime injection** - CSS is generated at build time and must be included manually
- **Consumer responsibility** - You must handle CSS inclusion in your build process and HTML
- **Optimal performance** - No client-side CSS generation overhead
- **Static themes only** - Best for applications without dynamic theme switching
```ts
export default defineNuxtConfig({
mazUi: {
theme: {
strategy: 'buildtime' // For static sites with predefined themes
}
}
})
```
### Components
```ts
const components = {
// Auto-import all 50+ Maz-UI components
autoImport: true,
}
```
**Available Components:**
`MazBtn`, `MazInput`, `MazSelect`, `MazDialog`, `MazToast`, `MazIcon`, `MazCard`, `MazTable`, `MazChart`, `MazCarousel`, `MazGallery`, and 50+ more!
### 🎪 Composables
All composables are auto-imported and ready to use:
```ts
const composables = {
// 🎨 Theming
useTheme: true, // Theme management and dark mode
// 🌐 Translations
useTranslations: true, // Translation management
// 📱 Responsive & Detection
useWindowSize: true, // Reactive window dimensions
useBreakpoints: true, // Responsive breakpoints
useUserVisibility: true, // Page visibility detection
useIdleTimeout: true, // User idle detection
// 🛠️ Utilities
useTimer: true, // Timer and countdown
useFormValidator: true, // Form validation
useStringMatching: true, // String utilities
useReadingTime: true, // Reading time calculation
useDisplayNames: true, // Display localized names
useSwipe: true, // Swipe gestures
usePullToRefresh: true, // Pull to refresh gesture
// 🔧 Advanced
useFreezeValue: true, // Freeze reactive values
useInjectStrict: true, // Strict dependency injection
useInstanceUniqId: true, // Unique IDs generation
useMountComponent: true, // Dynamic component mounting
}
```
### Plugins
```ts
const plugins = {
// Animations
aos: true,
// 🎭 Display modales without any implementation in template
dialog: true,
// 🎭 UI Notifications
toast: true,
// 🔄 Loading States
wait: true,
}
```
### Directives
Powerful Vue directives for enhanced functionality:
```ts
const directives = {
// Image directives
vLazyImg: { threshold: 0.1 }, // Lazy loading with intersection observer
vZoomImg: true, // Click to zoom images
vFullscreenImg: true, // Fullscreen image viewer
// Interaction directives
vTooltip: { position: 'top' }, // Flexible tooltips
vClickOutside: true, // Detect outside clicks
}
```
### AI Agents
Connect your AI coding agents (Claude Code, Cursor, GitHub Copilot, Codex, Windsurf...) to maz-ui, version-matched with the installed maz-ui, so they use its components, composables, icons, helpers and theme tokens instead of re-implementing them:
```ts
const agents = {
// Register the maz-ui MCP server in .mcp.json, .cursor/mcp.json, .vscode/mcp.json (default: true)
// Its instructions give the maz-ui rules to the agents
mcp: true,
// Also write the rules in .claude/rules/maz-ui.md and in AGENTS.md, for agents without MCP (default: false)
rules: false,
// 'claude' | 'agents-md' | 'cursor' | 'vscode' (default: the detected agents)
targets: ['claude', 'agents-md'],
// Folder where the files are written, relative to the Nuxt app (default: the root of the workspace)
dir: '../..',
}
// agents: true enables mcp and rules, agents: false disables everything
```
In a monorepo, the files are written at the **root of the workspace** (`workspaceDir` of Nuxt), where your agents start, not in the Nuxt app: a single `.mcp.json` serves every app. Set `dir` to choose another folder.
The module runs in development only (never in CI nor in tests), only for the agents it detects in the project (`.claude/`, `CLAUDE.md`, `.mcp.json`, `.cursor/`, `.vscode/mcp.json`, `.github/copilot-instructions.md`, `AGENTS.md`, `.codex/`, `.windsurf/`...), and keeps the files up to date when you upgrade maz-ui:
- `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`: a `maz-ui` server entry, added only when no maz-ui MCP server is already registered
- with `rules: true`, `.claude/rules/maz-ui.md`: a Claude Code rule (skipped when Claude reads `AGENTS.md`, i.e. without `CLAUDE.md`)
- with `rules: true`, `AGENTS.md`: a section delimited by `` and ``, read by Codex, Cursor, Copilot, Windsurf...
It never overwrites a file it does not own: your `CLAUDE.md`, your own rules and the other MCP servers are left untouched, and an existing `maz-ui` server entry (for example pinned to a version) is kept as is. Commit the generated files to share them with your team (check that `.claude/` is not in your `.gitignore`). See the [AI agents guide](../guide/ai-agents.md) for details.
## Advanced Theming
### Custom Theme Creation
```ts
import { definePreset } from '@maz-ui/themes'
export const customTheme = definePreset({
base: 'maz-ui',
overrides: {
name: 'custom',
foundation: {
'base-font-size': '14px',
'font-family': `Manrope, sans-serif, system-ui, -apple-system`,
'space': '0.25rem',
'border-width': '0.0625rem',
},
scales: {
rounded: { md: '0.7rem' },
},
colors: {
light: {
primary: 'oklch(0.65 0.27 5)', // Custom pink
secondary: 'oklch(0.96 0.01 5)',
surface: 'oklch(1 0 0)',
foreground: 'oklch(0.16 0.02 254)',
muted: 'oklch(0.6 0.01 254)',
accent: 'oklch(0.7 0.05 5)',
destructive: 'oklch(0.6 0.22 27)',
divider: 'oklch(0.92 0.005 254)',
},
dark: {
primary: 'oklch(0.75 0.22 5)',
secondary: 'oklch(0.24 0.02 5)',
surface: 'oklch(0.16 0.02 254)',
foreground: 'oklch(0.96 0.005 254)',
muted: 'oklch(0.6 0.01 254)',
accent: 'oklch(0.3 0.04 5)',
destructive: 'oklch(0.55 0.2 27)',
divider: 'oklch(0.3 0.01 254)',
}
},
},
})
export default defineNuxtConfig({
modules: ['@maz-ui/nuxt'],
mazUi: {
theme: {
preset: customTheme,
strategy: 'runtime',
}
}
})
```
**Tip: Subtree Overrides with MazUiProvider**
You can use [`MazUiProvider`](../guide/maz-ui-provider.md) within a Nuxt app to override theme or translations in a specific subtree, while the module handles global defaults.
## Troubleshooting
### Theme System Issues
If you encounter the error `"useTheme must be used within MazUi plugin or MazUiTheme plugin installation"`, ensure that:
1. **Enable useTheme composable** in your configuration:
```ts
export default defineNuxtConfig({
mazUi: {
composables: {
useTheme: true,
}
}
})
```
2. **Theme system is not disabled**:
```ts
export default defineNuxtConfig({
mazUi: {
theme: {
// theme config, not false
preset: 'maz-ui'
}
}
})
```
---
source: https://maz-ui.com/ecosystem/stylelint-config.md
---
---
title: "@maz-ui/stylelint-config"
description: "Stylelint preset for Vue/Nuxt/JS/TS projects, with first-class Tailwind CSS v4 support, RTL-friendly logical properties, and SCSS opt-in."
package: "@maz-ui/stylelint-config"
url: "https://maz-ui.com/ecosystem/stylelint-config"
---
# @maz-ui/stylelint-config
> Stylelint preset for Vue/Nuxt/JS/TS projects, with first-class Tailwind CSS v4 support, RTL-friendly logical properties, and SCSS opt-in.
- Package: `@maz-ui/stylelint-config`
- Import: `import { defineConfig } from '@maz-ui/stylelint-config'`
- Web: https://maz-ui.com/ecosystem/stylelint-config
`@maz-ui/stylelint-config` is the Stylelint counterpart to [`@maz-ui/eslint-config`](./eslint-config.md). It builds on Stylelint's official **standard** config and layers in the conventions used by maz-ui itself: BEM-friendly class patterns, Tailwind v4 support (at-rule whitelist + tunable plugin policy), RTL-friendly logical properties, optional SCSS support, Vue/HTML block parsing, and a single `extends` knob to compose extra shareable configs.
## Installation
```bash
pnpm add -D @maz-ui/stylelint-config stylelint
```
The peer dependencies the preset relies on (`stylelint-config-standard`, `stylelint-config-recommended-vue`, `stylelint-use-logical-spec`, `stylelint-plugin-tailwindcss`, `stylelint-order`, …) are bundled as direct dependencies, so you don't need to install them yourself.
## Basic usage
Create `stylelint.config.mjs` at the root of your project:
```js
import { defineConfig } from '@maz-ui/stylelint-config'
export default defineConfig()
```
Vue, Tailwind and SCSS are auto-detected from your `package.json`:
| Detected when… | Enables… |
| --- | --- |
| `vue` or `nuxt` is in dependencies | Vue support (`stylelint-config-recommended-vue`, `
```
### Advanced lazy loading strategies
#### 1. Conditional loading based on geolocation
```typescript
// Automatic language detection based on location
async function detectUserLanguage() {
try {
// Try to detect from browser
const browserLang = navigator.language.split('-')[0]
// Check if we support this language
const supportedLanguages = ['en', 'fr', 'es', 'de', 'it', 'pt', 'ja', 'zh']
if (supportedLanguages.includes(browserLang)) {
return browserLang
}
// Fallback to English
return 'en'
} catch {
return 'en'
}
}
// Configuration with automatic detection
app.use(MazUi, {
translations: {
locale: await detectUserLanguage(),
messages: {
fr: () => import('./locales/fr.ts'),
es: () => import('./locales/es.ts'),
de: () => import('./locales/de.ts'),
// ... other languages
}
}
})
```
#### 2. Smart caching
```typescript
// Custom cache for translations
const translationCache = new Map()
const messages = {
fr: async () => {
if (translationCache.has('fr')) {
return translationCache.get('fr')
}
const translations = await import('./locales/fr.ts').then(m => m.default)
translationCache.set('fr', translations)
return translations
}
}
```
## Using translations in your components
Once you've configured the plugin, you can control the language in your Vue components:
```vue