maz-ui 5.0.0 → 5.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{MazDropzone.DJ8au25t.css → MazDropzone.BW2grpTi.css} +1 -1
- package/dist/chunks/{MazDrawer.DANxKYxJ.js → MazDrawer.CC8zomfx.js} +2 -2
- package/dist/chunks/{MazDropzone.POH3pmfi.js → MazDropzone.Dez5j0WP.js} +2 -2
- package/dist/components/MazDrawer.js +1 -1
- package/dist/components/MazDropzone.js +1 -1
- package/dist/components/MazDropzone.vue.d.ts +2 -2
- package/dist/components/MazInputPrice.vue.d.ts +1 -1
- package/dist/components/index.js +2 -2
- package/docs/README.md +207 -0
- package/docs/agents/agents-md.md +52 -0
- package/docs/agents/claude-rule.md +52 -0
- package/docs/components/maz-accordion.md +76 -0
- package/docs/components/maz-alert.md +241 -0
- package/docs/components/maz-animated-counter.md +87 -0
- package/docs/components/maz-animated-element.md +46 -0
- package/docs/components/maz-animated-text.md +53 -0
- package/docs/components/maz-avatar.md +193 -0
- package/docs/components/maz-backdrop.md +178 -0
- package/docs/components/maz-badge.md +167 -0
- package/docs/components/maz-bottom-sheet.md +257 -0
- package/docs/components/maz-btn-group.md +316 -0
- package/docs/components/maz-btn.md +423 -0
- package/docs/components/maz-card-spotlight.md +84 -0
- package/docs/components/maz-card.md +321 -0
- package/docs/components/maz-carousel.md +153 -0
- package/docs/components/maz-chart.md +206 -0
- package/docs/components/maz-checkbox.md +138 -0
- package/docs/components/maz-checklist.md +251 -0
- package/docs/components/maz-circular-progress-bar.md +109 -0
- package/docs/components/maz-code-highlight.md +155 -0
- package/docs/components/maz-container.md +241 -0
- package/docs/components/maz-date-picker.md +791 -0
- package/docs/components/maz-dialog-confirm.md +215 -0
- package/docs/components/maz-dialog.md +143 -0
- package/docs/components/maz-drawer.md +106 -0
- package/docs/components/maz-dropdown.md +419 -0
- package/docs/components/maz-dropzone.md +387 -0
- package/docs/components/maz-expand-animation.md +82 -0
- package/docs/components/maz-fullscreen-loader.md +58 -0
- package/docs/components/maz-gallery.md +79 -0
- package/docs/components/maz-icon.md +203 -0
- package/docs/components/maz-input-code.md +73 -0
- package/docs/components/maz-input-number.md +79 -0
- package/docs/components/maz-input-phone-number.md +536 -0
- package/docs/components/maz-input-price.md +68 -0
- package/docs/components/maz-input-tags.md +112 -0
- package/docs/components/maz-input.md +334 -0
- package/docs/components/maz-lazy-img.md +113 -0
- package/docs/components/maz-link.md +146 -0
- package/docs/components/maz-loading-bar.md +38 -0
- package/docs/components/maz-markdown-editor.md +320 -0
- package/docs/components/maz-pagination.md +82 -0
- package/docs/components/maz-popover.md +794 -0
- package/docs/components/maz-pull-to-refresh.md +222 -0
- package/docs/components/maz-radio-buttons.md +313 -0
- package/docs/components/maz-radio.md +119 -0
- package/docs/components/maz-read-more.md +209 -0
- package/docs/components/maz-reading-progress-bar.md +96 -0
- package/docs/components/maz-select-country.md +513 -0
- package/docs/components/maz-select.md +318 -0
- package/docs/components/maz-sidebar-content.md +25 -0
- package/docs/components/maz-sidebar-footer.md +25 -0
- package/docs/components/maz-sidebar-group.md +27 -0
- package/docs/components/maz-sidebar-header.md +25 -0
- package/docs/components/maz-sidebar-menu-button.md +41 -0
- package/docs/components/maz-sidebar-menu-item.md +25 -0
- package/docs/components/maz-sidebar-menu-sub.md +32 -0
- package/docs/components/maz-sidebar-menu.md +25 -0
- package/docs/components/maz-sidebar-separator.md +21 -0
- package/docs/components/maz-sidebar-trigger.md +25 -0
- package/docs/components/maz-sidebar.md +507 -0
- package/docs/components/maz-skeleton.md +226 -0
- package/docs/components/maz-slider.md +165 -0
- package/docs/components/maz-spinner.md +84 -0
- package/docs/components/maz-stepper.md +301 -0
- package/docs/components/maz-switch.md +86 -0
- package/docs/components/maz-table-cell.md +27 -0
- package/docs/components/maz-table-row.md +28 -0
- package/docs/components/maz-table-title.md +27 -0
- package/docs/components/maz-table-virtualizer.md +31 -0
- package/docs/components/maz-table.md +426 -0
- package/docs/components/maz-tabs-bar.md +43 -0
- package/docs/components/maz-tabs-content-item.md +27 -0
- package/docs/components/maz-tabs-content.md +27 -0
- package/docs/components/maz-tabs.md +308 -0
- package/docs/components/maz-textarea.md +255 -0
- package/docs/components/maz-ticker.md +427 -0
- package/docs/components/maz-timeline.md +304 -0
- package/docs/components/maz-ui-provider.md +26 -0
- package/docs/components/maz-window-mockup.md +182 -0
- package/docs/composables/use-aos.md +41 -0
- package/docs/composables/use-breakpoints.md +42 -0
- package/docs/composables/use-dialog.md +58 -0
- package/docs/composables/use-display-names.md +130 -0
- package/docs/composables/use-drag.md +185 -0
- package/docs/composables/use-form-validator.md +1123 -0
- package/docs/composables/use-idle-timeout.md +172 -0
- package/docs/composables/use-pull-to-refresh.md +86 -0
- package/docs/composables/use-reading-time.md +132 -0
- package/docs/composables/use-string-matching.md +41 -0
- package/docs/composables/use-swipe.md +171 -0
- package/docs/composables/use-timer.md +104 -0
- package/docs/composables/use-toast.md +50 -0
- package/docs/composables/use-user-visibility.md +127 -0
- package/docs/composables/use-wait.md +50 -0
- package/docs/composables/use-window-size.md +25 -0
- package/docs/directives/click-outside.md +182 -0
- package/docs/directives/fullscreen-img.md +83 -0
- package/docs/directives/lazy-img.md +182 -0
- package/docs/directives/tooltip.md +298 -0
- package/docs/directives/zoom-img.md +100 -0
- package/docs/ecosystem/eslint-config.md +289 -0
- package/docs/ecosystem/icons/icon-set.md +25 -0
- package/docs/ecosystem/icons/index.md +584 -0
- package/docs/ecosystem/mcp.md +165 -0
- package/docs/ecosystem/node/exec-promise.md +93 -0
- package/docs/ecosystem/node/index.md +53 -0
- package/docs/ecosystem/node/logger.md +152 -0
- package/docs/ecosystem/node/print-banner.md +101 -0
- package/docs/ecosystem/node/setup-agents.md +102 -0
- package/docs/ecosystem/nuxt.md +551 -0
- package/docs/ecosystem/stylelint-config.md +310 -0
- package/docs/ecosystem/themes.md +966 -0
- package/docs/ecosystem/translations.md +1173 -0
- package/docs/ecosystem/utils/camel-case.md +37 -0
- package/docs/ecosystem/utils/capitalize.md +37 -0
- package/docs/ecosystem/utils/check-availability.md +85 -0
- package/docs/ecosystem/utils/cookie.md +86 -0
- package/docs/ecosystem/utils/country-code-to-unicode-flag.md +128 -0
- package/docs/ecosystem/utils/currency.md +53 -0
- package/docs/ecosystem/utils/date.md +53 -0
- package/docs/ecosystem/utils/debounce-callback.md +44 -0
- package/docs/ecosystem/utils/debounce-id.md +75 -0
- package/docs/ecosystem/utils/debounce.md +71 -0
- package/docs/ecosystem/utils/fetch-locale-ip.md +39 -0
- package/docs/ecosystem/utils/format-json.md +39 -0
- package/docs/ecosystem/utils/format-phone-number.md +43 -0
- package/docs/ecosystem/utils/get-browser-locale.md +35 -0
- package/docs/ecosystem/utils/get-country-flag-url.md +67 -0
- package/docs/ecosystem/utils/get-error-message.md +45 -0
- package/docs/ecosystem/utils/idle-timeout.md +96 -0
- package/docs/ecosystem/utils/index.md +57 -0
- package/docs/ecosystem/utils/is-client.md +38 -0
- package/docs/ecosystem/utils/is-equal.md +44 -0
- package/docs/ecosystem/utils/is-ios.md +43 -0
- package/docs/ecosystem/utils/is-server.md +37 -0
- package/docs/ecosystem/utils/is-standalone-mode.md +49 -0
- package/docs/ecosystem/utils/kebab-case.md +42 -0
- package/docs/ecosystem/utils/normalize-string.md +83 -0
- package/docs/ecosystem/utils/number.md +51 -0
- package/docs/ecosystem/utils/pascal-case.md +41 -0
- package/docs/ecosystem/utils/prevent-ios-input-zoom.md +72 -0
- package/docs/ecosystem/utils/script-loader.md +85 -0
- package/docs/ecosystem/utils/sleep.md +65 -0
- package/docs/ecosystem/utils/snake-case.md +42 -0
- package/docs/ecosystem/utils/swipe-handler.md +97 -0
- package/docs/ecosystem/utils/textarea-autogrow.md +47 -0
- package/docs/ecosystem/utils/throttle-id.md +54 -0
- package/docs/ecosystem/utils/throttle.md +63 -0
- package/docs/ecosystem/utils/truthy-filter.md +37 -0
- package/docs/ecosystem/utils/types/deep-key-of.md +54 -0
- package/docs/ecosystem/utils/types/deep-partial.md +48 -0
- package/docs/ecosystem/utils/types/deep-required.md +45 -0
- package/docs/ecosystem/utils/types/flatten-object-keys.md +50 -0
- package/docs/ecosystem/utils/types/generic-instance-type.md +48 -0
- package/docs/ecosystem/utils/types/infer-maybe-ref.md +41 -0
- package/docs/ecosystem/utils/upper-first.md +38 -0
- package/docs/ecosystem/utils/user-visibility.md +75 -0
- package/docs/guide/ai-agents.md +237 -0
- package/docs/guide/browser-support.md +88 -0
- package/docs/guide/getting-started.md +191 -0
- package/docs/guide/global-defaults.md +103 -0
- package/docs/guide/maz-ui-provider.md +231 -0
- package/docs/guide/migration-v5.md +871 -0
- package/docs/guide/resolvers.md +650 -0
- package/docs/guide/tailwind.md +483 -0
- package/docs/guide/vue.md +286 -0
- package/docs/manifest.json +1 -0
- package/docs/plugins/aos.md +312 -0
- package/docs/plugins/dialog.md +269 -0
- package/docs/plugins/toast.md +221 -0
- package/docs/plugins/wait.md +78 -0
- package/docs/reference/icons.md +46 -0
- package/docs/reference/tailwind-tokens.md +191 -0
- package/docs/rules.md +57 -0
- package/package.json +31 -4
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "AI agents"
|
|
3
|
+
description: "Make Claude Code, Cursor, GitHub Copilot, Codex and the other AI coding agents use maz-ui and its ecosystem instead of re-implementing it - project rules, MCP server, version-matched docs, llms.txt and automatic code review."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/guide/ai-agents"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AI agents
|
|
9
|
+
|
|
10
|
+
> Make Claude Code, Cursor, GitHub Copilot, Codex and the other AI coding agents use maz-ui and its ecosystem instead of re-implementing it - project rules, MCP server, version-matched docs, llms.txt and automatic code review.
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Web: https://maz-ui.com/guide/ai-agents
|
|
14
|
+
|
|
15
|
+
## Why
|
|
16
|
+
|
|
17
|
+
Left alone, coding agents rebuild what maz-ui already provides: native buttons instead of `MazBtn`, lodash instead of `@maz-ui/utils`, inline SVG instead of `@maz-ui/icons`, `bg-blue-500` instead of the theme colors. They also guess APIs from outdated training data.
|
|
18
|
+
|
|
19
|
+
maz-ui gives them four things:
|
|
20
|
+
|
|
21
|
+
| | What | Where |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| **Rules** | How to use maz-ui in your project, loaded automatically by the agent | `.claude/rules/maz-ui.md`, `AGENTS.md` |
|
|
24
|
+
| **Version-matched docs** | Agent-ready markdown of the installed version: guides, component APIs, icons, Tailwind tokens | `node_modules/maz-ui/docs/` |
|
|
25
|
+
| **MCP server** | Search by need, exact component APIs, icons, theme tokens, setup guides, code review | `npx @maz-ui/mcp` |
|
|
26
|
+
| **Code review** | Static checks against the real maz-ui APIs, in the agent loop and in CI | `review_code` tool, `npx @maz-ui/mcp review` |
|
|
27
|
+
|
|
28
|
+
## Quick start
|
|
29
|
+
|
|
30
|
+
Run this command at the root of your project:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx @maz-ui/mcp init
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
It detects the agents you use and configures them, using the docs of the maz-ui version installed in the project:
|
|
37
|
+
|
|
38
|
+
| Agent | Rules | MCP server |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| Claude Code | `.claude/rules/maz-ui.md` (always loaded) | `.mcp.json` |
|
|
41
|
+
| Cursor | `AGENTS.md` | `.cursor/mcp.json` |
|
|
42
|
+
| GitHub Copilot (VS Code) | `AGENTS.md` | `.vscode/mcp.json` |
|
|
43
|
+
| Codex, Windsurf, Zed, Gemini CLI... | `AGENTS.md` | global config of the agent (see [MCP](../ecosystem/mcp.md)) |
|
|
44
|
+
|
|
45
|
+
When no agent is detected, it configures Claude Code and `AGENTS.md`. Commit the generated files: your whole team and your CI agents get them.
|
|
46
|
+
|
|
47
|
+
**Tip: It never overwrites your own instructions**
|
|
48
|
+
|
|
49
|
+
- Your `CLAUDE.md` is never touched: Claude Code loads `.claude/rules/maz-ui.md` on top of it.
|
|
50
|
+
- In `AGENTS.md`, maz-ui only manages the section between `<!-- BEGIN:maz-ui -->` and `<!-- END:maz-ui -->`.
|
|
51
|
+
- In the MCP config files, only the `maz-ui` entry is added, the formatting and comments of the file are preserved. An existing server running `@maz-ui/mcp` under another name is kept as is.
|
|
52
|
+
- A file you created yourself with the same path is never overwritten.
|
|
53
|
+
|
|
54
|
+
### Options
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx @maz-ui/mcp init --targets claude,agents-md,cursor,vscode # choose the agents
|
|
58
|
+
npx @maz-ui/mcp init --no-rules # MCP server only
|
|
59
|
+
npx @maz-ui/mcp init --no-mcp # rules only
|
|
60
|
+
npx @maz-ui/mcp init --dry-run # show the changes
|
|
61
|
+
npx @maz-ui/mcp init --remove # remove everything init added
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Run it again after upgrading maz-ui: the rules follow the installed version.
|
|
65
|
+
|
|
66
|
+
### Nuxt: connected by default
|
|
67
|
+
|
|
68
|
+
With [`@maz-ui/nuxt`](../ecosystem/nuxt.md), the agents detected in the project are connected to the maz-ui MCP server when you start the dev server: the module only adds the `maz-ui` entry to their MCP config (`.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`). The instructions of the MCP server already give the maz-ui rules to the agents, so no rule file is written by default.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
export default defineNuxtConfig({
|
|
72
|
+
modules: ['@maz-ui/nuxt'],
|
|
73
|
+
mazUi: {
|
|
74
|
+
// default: { rules: false, mcp: true }
|
|
75
|
+
agents: {
|
|
76
|
+
rules: true, // also write .claude/rules/maz-ui.md and the AGENTS.md section
|
|
77
|
+
targets: ['claude', 'agents-md'], // default: the detected agents
|
|
78
|
+
},
|
|
79
|
+
// or disable it: agents: false
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
It only runs in development (never in CI, in tests or during builds), writes nothing when no agent is detected, keeps the files in sync with the installed maz-ui version and never overwrites files it does not own.
|
|
85
|
+
|
|
86
|
+
### Without any file in the project
|
|
87
|
+
|
|
88
|
+
The MCP server carries the rules in its instructions: registering it once for your user is enough, in every project, without writing anything in them.
|
|
89
|
+
|
|
90
|
+
- Claude Code: install the plugin, or run `claude mcp add maz-ui --scope user -- npx -y @maz-ui/mcp@latest`.
|
|
91
|
+
- Cursor, Windsurf, Codex...: add the server to the global MCP config of the agent (see [MCP](../ecosystem/mcp.md#configuration)).
|
|
92
|
+
|
|
93
|
+
Write the project files (`init`, the Nuxt option) when your whole team, or agents without MCP, need the rules.
|
|
94
|
+
|
|
95
|
+
## Version-matched docs
|
|
96
|
+
|
|
97
|
+
Each `maz-ui` release ships its documentation for agents in `node_modules/maz-ui/docs/`:
|
|
98
|
+
|
|
99
|
+
```txt
|
|
100
|
+
node_modules/maz-ui/docs/
|
|
101
|
+
├── README.md # index of every page, start here
|
|
102
|
+
├── rules.md # the rules below
|
|
103
|
+
├── manifest.json # machine-readable index, component APIs, icons, tokens
|
|
104
|
+
├── components/maz-btn.md # usage, examples and full API of each component
|
|
105
|
+
├── composables/ directives/ plugins/ guide/
|
|
106
|
+
├── ecosystem/ # themes, translations, icons, nuxt, utils, node...
|
|
107
|
+
└── reference/
|
|
108
|
+
├── tailwind-tokens.md # every Tailwind class and CSS variable of the theme
|
|
109
|
+
└── icons.md # the 860+ icon names
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The pages are the ones of this website, cleaned for agents: no live demos, every example as code, and the full API of each component (props with their accepted values, `v-model`, events, slots) generated from the TypeScript sources.
|
|
113
|
+
|
|
114
|
+
Agents read the docs of **your** version, not what they remember from their training data. The MCP server serves the same files.
|
|
115
|
+
|
|
116
|
+
## MCP server
|
|
117
|
+
|
|
118
|
+
The MCP server gives agents tools that work with the needs they have, and verify their code:
|
|
119
|
+
|
|
120
|
+
| Tool | Purpose |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| `search_docs` | Find what maz-ui provides for a need ("confirm before delete", "phone input", "debounce search") |
|
|
123
|
+
| `get_component_api` | Exact props, values, events, slots of up to 10 components |
|
|
124
|
+
| `find_icons` | Icons by meaning ("delete", "settings", "france flag") with their imports |
|
|
125
|
+
| `get_theme_tokens` | Every Tailwind class and CSS variable of the theme |
|
|
126
|
+
| `get_doc` | Any page of the docs, or only some sections |
|
|
127
|
+
| `list_docs` | The whole catalog |
|
|
128
|
+
| `get_setup_guide` | Installation in a Vue or Nuxt app, with or without Tailwind |
|
|
129
|
+
| `review_code` | Review files against the installed maz-ui |
|
|
130
|
+
|
|
131
|
+
See [MCP](../ecosystem/mcp.md) for the configuration of each agent.
|
|
132
|
+
|
|
133
|
+
## Claude Code plugin
|
|
134
|
+
|
|
135
|
+
The maz-ui plugin bundles the MCP server, a `maz-ui` skill (rules and workflow) and a hook that reviews every `.vue`, `.ts` and `.css` file Claude edits, so it fixes maz-ui mistakes before you see them.
|
|
136
|
+
|
|
137
|
+
```txt
|
|
138
|
+
/plugin marketplace add LouisMazel/maz-ui
|
|
139
|
+
/plugin install maz-ui@maz-ui
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The plugin works in every project, `init` configures one project for your whole team: use both or either.
|
|
143
|
+
|
|
144
|
+
## Code review in CI
|
|
145
|
+
|
|
146
|
+
The checks of `review_code` are also available from the command line:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npx @maz-ui/mcp review "src/**/*.{vue,ts,css}"
|
|
150
|
+
npx @maz-ui/mcp review app --min-severity warning --max-warnings 0
|
|
151
|
+
npx @maz-ui/mcp review src --format json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The command exits with an error code when it finds errors (or more warnings than `--max-warnings`).
|
|
155
|
+
|
|
156
|
+
| Rule | Severity | Detects |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| `unknown-component` | error | `<MazButton>` (did you mean `MazBtn`?) |
|
|
159
|
+
| `unknown-prop` | warning | A prop the component does not have (`colour`) |
|
|
160
|
+
| `invalid-prop-value` | error | `color="red"` on a component that accepts `primary`, `secondary`... |
|
|
161
|
+
| `boolean-prop-string` | error | `disabled="false"` (a truthy string) |
|
|
162
|
+
| `unknown-model`, `unknown-event`, `unknown-slot` | error | `v-model:foo`, `@clik`, `<template #captions>` |
|
|
163
|
+
| `unknown-icon` | error | An icon that does not exist in `@maz-ui/icons` |
|
|
164
|
+
| `prefer-maz-component` | warning | `<button>`, `<input>`, `<select>`, `<textarea>`, `<dialog>`... |
|
|
165
|
+
| `inline-svg` | warning | SVG icons written inline |
|
|
166
|
+
| `prefer-ecosystem`, `prefer-utils` | warning / info | lodash, VueUse, toast, icon, tooltip, date picker... libraries that maz-ui already covers |
|
|
167
|
+
| `theme-colors` | warning | Default Tailwind palette (`bg-blue-500`, `text-gray-600`, `bg-white`) |
|
|
168
|
+
| `hardcoded-color` | warning | `bg-[#1d90ff]`, `color: #fff` |
|
|
169
|
+
| `internal-prefix` | error | The internal `maz:` prefix |
|
|
170
|
+
| `tailwind-v3` | warning | `bg-opacity-50`, `flex-shrink-0`... |
|
|
171
|
+
| `missing-reference` | error | `@apply` in a SFC style block without `@reference` |
|
|
172
|
+
| `manual-dark-mode` | warning | Dark mode handled by hand instead of `useTheme()` |
|
|
173
|
+
| `root-import`, `internal-import` | error | Runtime imports from `maz-ui` (types only) or from `src`/`dist` |
|
|
174
|
+
| `nuxt-auto-import` | info | Imports that `@maz-ui/nuxt` already auto-imports |
|
|
175
|
+
|
|
176
|
+
When something is intended, ignore it with a comment on the line above (`<!-- maz-ui-review-ignore prefer-maz-component -->`, `// maz-ui-review-ignore theme-colors`), or `maz-ui-review-ignore-file` for a whole file.
|
|
177
|
+
|
|
178
|
+
## llms.txt
|
|
179
|
+
|
|
180
|
+
The documentation is also published for agents that browse the web:
|
|
181
|
+
|
|
182
|
+
- [maz-ui.com/llms.txt](https://maz-ui.com/llms.txt): index of every page
|
|
183
|
+
- [maz-ui.com/llms-full.txt](https://maz-ui.com/llms-full.txt): the whole documentation in one file
|
|
184
|
+
- Each page as markdown: `https://maz-ui.com/components/maz-btn.md`
|
|
185
|
+
|
|
186
|
+
## The rules
|
|
187
|
+
|
|
188
|
+
This is what `init`, the Nuxt option, the Claude Code plugin and the MCP server teach to your agents:
|
|
189
|
+
|
|
190
|
+
This project is built with **maz-ui** and its ecosystem (`@maz-ui/themes`, `@maz-ui/icons`, `@maz-ui/utils`, `@maz-ui/translations`, `@maz-ui/nuxt`). Reuse what it provides instead of re-implementing it: most UI elements, helpers, icons and styles you need already exist.
|
|
191
|
+
|
|
192
|
+
### Look it up before you write it
|
|
193
|
+
|
|
194
|
+
Before creating a component, composable, helper, icon or style, check what maz-ui offers:
|
|
195
|
+
|
|
196
|
+
- **MCP server `maz-ui`** (when available): `search_docs` (describe the need: "confirm before delete", "phone input"), `get_component_api` (exact props, events, slots), `find_icons`, `get_theme_tokens` (Tailwind classes), `get_doc`, `review_code`.
|
|
197
|
+
- **Version-matched docs** in `node_modules/maz-ui/docs/` (start with `README.md`; in a monorepo, resolve `maz-ui` from the app package). Read the relevant page before using an API.
|
|
198
|
+
|
|
199
|
+
Never guess an API: only use props, events, slots and imports that are documented.
|
|
200
|
+
|
|
201
|
+
### Components
|
|
202
|
+
|
|
203
|
+
- Use `Maz*` components instead of native elements or hand-made widgets: `MazBtn` (not `<button>`), `MazInput`, `MazSelect`, `MazCheckbox`, `MazSwitch`, `MazTextarea`, `MazDialog`, `MazDialogConfirm`, `MazDrawer`, `MazBottomSheet`, `MazPopover`, `MazDropdown`, `MazTabs`, `MazTable`, `MazCard`, `MazAvatar`, `MazBadge`, `MazAlert`, `MazSkeleton`, `MazSpinner`, `MazDatePicker`, `MazInputPhoneNumber`, `MazDropzone`, `MazStepper`, `MazSidebar`, `MazPagination`...
|
|
204
|
+
- Prop values are typed: colors are `primary | secondary | accent | info | success | warning | destructive | contrast | transparent` (plus `surface` on some components), sizes `mini | xs | sm | md | lg | xl`.
|
|
205
|
+
- Feedback and overlays: `useToast()` for notifications, `useDialog()` or `MazDialogConfirm` for confirmations, `useWait()` for loading states.
|
|
206
|
+
- Forms: `useFormValidator` / `useFormField` with your Standard Schema library (Zod, Valibot, ArkType).
|
|
207
|
+
|
|
208
|
+
### Icons
|
|
209
|
+
|
|
210
|
+
Use `@maz-ui/icons` (860+ icons: `MazTrash`, `MazXMark`, `MazMagnifyingGlass`, `MazFlagFR`, `MazLogoVue`...). Never inline SVG or add another icon library. Pass icon components to icon props: `<MazBtn :start-icon="MazTrash">`.
|
|
211
|
+
|
|
212
|
+
### Helpers and composables
|
|
213
|
+
|
|
214
|
+
Use `@maz-ui/utils` and maz-ui composables instead of lodash, VueUse or hand-written code: `debounce`, `throttle`, `sleep`, `isEqual`, `capitalize`, `formatCurrency`, `formatDate`, `formatNumber`, `formatPhoneNumber`, `getCookie`/`setCookie`, `useBreakpoints`, `useWindowSize`, `useTimer`, `useIdleTimeout`, `useSwipe`, `vClickOutside`, `vTooltip`, `vLazyImg`...
|
|
215
|
+
|
|
216
|
+
### Styling with Tailwind
|
|
217
|
+
|
|
218
|
+
The maz-ui theme is exposed to Tailwind (`@import 'maz-ui/tailwindcss/theme.css'`). Only use its tokens:
|
|
219
|
+
|
|
220
|
+
- Colors: `primary`, `secondary`, `accent`, `info`, `success`, `warning`, `destructive`, `contrast` (each with `-foreground` and `-50` to `-950`), `surface`, `foreground`, `muted`, `divider`, `overlay`, plus `bg-container` and `bg-input`. Example: `bg-surface text-foreground border-divider`, `bg-primary text-primary-foreground`, `text-muted`.
|
|
221
|
+
- Never use the default Tailwind palette (`bg-blue-500`, `text-gray-600`, `bg-white`, `text-black`) nor hard-coded colors (`#fff`, `rgb()`, `bg-[#...]`). Theme colors already adapt to dark mode: do not add `dark:` color overrides.
|
|
222
|
+
- Radius `rounded-*`, shadows `shadow-sm` to `shadow-xl` and `shadow-elevation`, spacing scale (`p-4`, `gap-2`), breakpoints `mob-*`, `tab-*`, `lap-*` (plus `sm` to `2xl`), utilities `flex-center`, `padded-container`.
|
|
223
|
+
- **No `maz:` prefix** in this project: it is internal to the maz-ui library and its documentation.
|
|
224
|
+
- In custom CSS, use the variables: `var(--maz-primary)`, `var(--maz-rounded-md)`, `calc(var(--maz-space) * 4)`.
|
|
225
|
+
|
|
226
|
+
### Theme
|
|
227
|
+
|
|
228
|
+
Brand colors, fonts, radius and spacing come from a `@maz-ui/themes` preset (`definePreset`), not from overrides scattered in CSS. Use `useTheme()` for dark mode and presets (`toggleDarkMode`, `setColorMode`, `updateTheme`), never toggle the `dark` class or store the mode yourself.
|
|
229
|
+
|
|
230
|
+
### Imports
|
|
231
|
+
|
|
232
|
+
- Deep imports: `maz-ui/components/MazBtn`, `maz-ui/composables/useToast`, `maz-ui/directives/vTooltip`, `@maz-ui/utils/helpers/debounce`, `@maz-ui/icons/static/MazTrash`. The `maz-ui` root entry only exports types. Never import from `maz-ui/src` or `maz-ui/dist`.
|
|
233
|
+
- With `@maz-ui/nuxt`, components and composables are auto-imported: do not import them.
|
|
234
|
+
|
|
235
|
+
### Before you finish
|
|
236
|
+
|
|
237
|
+
Run `review_code` (MCP) on the files you changed, or `npx @maz-ui/mcp review <files>`, and fix every finding.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Browser support"
|
|
3
|
+
description: "Maz-UI v5 browser compatibility matrix and the native CSS features it depends on."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/guide/browser-support"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Browser support
|
|
9
|
+
|
|
10
|
+
> Maz-UI v5 browser compatibility matrix and the native CSS features it depends on.
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Web: https://maz-ui.com/guide/browser-support
|
|
14
|
+
|
|
15
|
+
Maz-UI v5 is built on **Tailwind CSS v4**, which relies on modern native CSS features with no polyfill path. If your audience still uses older browsers, stay on Maz-UI v4.
|
|
16
|
+
|
|
17
|
+
## Minimum versions
|
|
18
|
+
|
|
19
|
+
| Browser | Minimum |
|
|
20
|
+
| ------------------ | ------- |
|
|
21
|
+
| **Chromium** (Chrome, Edge, Opera, Brave, Arc, …) | **111** (March 2023) |
|
|
22
|
+
| **Safari** (macOS, iOS, iPadOS) | **16.4** (March 2023) |
|
|
23
|
+
| **Firefox** | **128** (July 2024) |
|
|
24
|
+
| **Samsung Internet** | **22** (2023) |
|
|
25
|
+
|
|
26
|
+
On the Android side: Chrome 111+ is bundled with Android 13+ devices and is available as an update on anything from Android 7. WebView apps built against API level 24+ get Chromium 111+ automatically.
|
|
27
|
+
|
|
28
|
+
Anything older than the versions above will not render the design system correctly. The most common failure mode is colors looking wrong (because `color-mix()` doesn't resolve) or cascade layers being ignored.
|
|
29
|
+
|
|
30
|
+
## Why these minimums
|
|
31
|
+
|
|
32
|
+
Maz-UI v5 + Tailwind v4 uses the following native CSS features:
|
|
33
|
+
|
|
34
|
+
### `color-mix()`
|
|
35
|
+
|
|
36
|
+
Used for every alpha modifier (`bg-primary/50`, the custom `color-mix(in srgb, var(--X) 60%, transparent)` generated by the `@maz-ui/upgrade` package for `hsl(var(--X) / 60%)`, etc.).
|
|
37
|
+
|
|
38
|
+
[Browser support · caniuse](https://caniuse.com/?search=color-mix) - supported everywhere since Chromium 111 / Safari 16.4 / Firefox 128.
|
|
39
|
+
|
|
40
|
+
### `@property`
|
|
41
|
+
|
|
42
|
+
Used internally by Tailwind v4 to declare typed custom properties with default values. Powers the `--tw-translate-x`, `--tw-rotate`, etc. that back transform utilities.
|
|
43
|
+
|
|
44
|
+
[Browser support · caniuse](https://caniuse.com/?search=%40property) - supported everywhere since Chromium 111 / Safari 16.4 / Firefox 128.
|
|
45
|
+
|
|
46
|
+
### Native CSS nesting
|
|
47
|
+
|
|
48
|
+
Used by Tailwind v4 internally and by Maz-UI utilities like `cap-f` (`&::first-letter`). v4 does not run a CSS-nesting preprocessor; the output relies on the browser parsing nested rules directly.
|
|
49
|
+
|
|
50
|
+
[Browser support · caniuse](https://caniuse.com/css-nesting) - supported everywhere since Chromium 112 / Safari 16.5 / Firefox 117.
|
|
51
|
+
|
|
52
|
+
### `:has()` selector
|
|
53
|
+
|
|
54
|
+
Used by a few Maz-UI utilities for parent-aware styling.
|
|
55
|
+
|
|
56
|
+
[Browser support · caniuse](https://caniuse.com/css-has) - supported everywhere since Chromium 105 / Safari 15.4 / Firefox 121.
|
|
57
|
+
|
|
58
|
+
## Testing on older browsers
|
|
59
|
+
|
|
60
|
+
If you need to support a browser older than the matrix above:
|
|
61
|
+
|
|
62
|
+
1. **Stay on Maz-UI v4** - it keeps Tailwind v3 and targets Chromium 90+, Safari 14+, Firefox 90+.
|
|
63
|
+
2. **Check your real audience** using your analytics tool before bumping to v5. "Support everything" is often outdated advice in 2026 - most teams can comfortably drop anything older than Chromium 111.
|
|
64
|
+
|
|
65
|
+
## Testing on the minimum versions
|
|
66
|
+
|
|
67
|
+
Playwright can install exact minimum-version browsers for regression testing:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pnpm add -D @playwright/test
|
|
71
|
+
npx playwright install chromium@111 firefox@128 webkit@16.4
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then run your visual tests against that matrix in CI.
|
|
75
|
+
|
|
76
|
+
## What happens on unsupported browsers
|
|
77
|
+
|
|
78
|
+
- **`color-mix` unsupported** - any utility that goes through an alpha modifier (`bg-primary/50`, the custom overlay colors in MazDialog / MazBackdrop) falls back to the base color with no transparency. Visual regression but not a crash.
|
|
79
|
+
- **`@property` unsupported** - transform, translate, rotate, scale utilities don't animate smoothly because the custom properties aren't interpolatable without `@property`.
|
|
80
|
+
- **Cascade layers unsupported** - the order of Maz-UI styles vs app styles becomes non-deterministic, so resets and utilities can override app styles (or vice versa) unpredictably.
|
|
81
|
+
|
|
82
|
+
The safe recommendation is: detect at app boot and show an "unsupported browser" screen if you can't guarantee the minimum matrix.
|
|
83
|
+
|
|
84
|
+
## See also
|
|
85
|
+
|
|
86
|
+
- [Migration v4 → v5](./migration-v5.md) - the full upgrade guide
|
|
87
|
+
- [Tailwind v4 browser support](https://tailwindcss.com/blog/tailwindcss-v4#browser-support) - upstream notes
|
|
88
|
+
- [Tailwind CSS integration](./tailwind.md) - how the design system plugs into your own Tailwind
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Getting Started"
|
|
3
|
+
description: "Build Vue and Nuxt applications faster with Maz-UI v5 - The modern, modular component library"
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/guide/getting-started"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Getting Started
|
|
9
|
+
|
|
10
|
+
> Build Vue and Nuxt applications faster with Maz-UI v5 - The modern, modular component library
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Web: https://maz-ui.com/guide/getting-started
|
|
14
|
+
|
|
15
|
+
**Tip: **Why Maz-UI?****
|
|
16
|
+
|
|
17
|
+
- 🌱 **Tree-shaking** - Import only what you need
|
|
18
|
+
- 🛠️ **TypeScript-first** - Full type safety out of the box
|
|
19
|
+
- 🚀 **Performance** - Tree-shaking benefits and maximum optimization
|
|
20
|
+
- 🎨 **Theming system** - Customizable themes and dark mode support (5 presets available) - [@maz-ui/themes](../ecosystem/themes.md)
|
|
21
|
+
- 💨 **Optional Tailwind bridge** - Already have a Tailwind v4 setup? Expose your active maz-ui theme tokens (colors, radius, breakpoints, custom utilities) to your own Tailwind config - [Tailwind integration](./tailwind.md)
|
|
22
|
+
- 🌐 **Internationalization** - Locale management and tree-shakable imports - [@maz-ui/translations](../ecosystem/translations.md)
|
|
23
|
+
- 🎨 **Icon library** - Comprehensive collection of SVG icons designed for performance and flexibility (860+ icons) - [@maz-ui/icons](../ecosystem/icons/index.md)
|
|
24
|
+
- 🧰 **Nuxt module** - Effortless Maz-UI integration with auto-imports - [@maz-ui/nuxt](../ecosystem/nuxt.md)
|
|
25
|
+
- 🤖 **AI agents** - Make Claude Code, Cursor, Copilot and Codex use maz-ui instead of re-implementing it - [AI agents](./ai-agents.md), [@maz-ui/mcp](../ecosystem/mcp.md)
|
|
26
|
+
|
|
27
|
+
**Tip: Migrating from v4?**
|
|
28
|
+
|
|
29
|
+
Run `npx @maz-ui/upgrade ./` to handle the mechanical part of the migration (CSS subpath imports, prop renames, CSS var renames, Nuxt config keys, custom preset color keys, and `package.json` version bumps). See the [v5 migration guide](./migration-v5.md) for the rest.
|
|
30
|
+
|
|
31
|
+
## Guides
|
|
32
|
+
|
|
33
|
+
Start by choosing your framework:
|
|
34
|
+
|
|
35
|
+
- [Install maz-ui with Vue](./vue.md)
|
|
36
|
+
- [Install maz-ui with Nuxt](../ecosystem/nuxt.md)
|
|
37
|
+
|
|
38
|
+
## Ecosystem Packages
|
|
39
|
+
|
|
40
|
+
Extend Maz-UI with our specialized companion packages:
|
|
41
|
+
|
|
42
|
+
### @maz-ui/themes
|
|
43
|
+
|
|
44
|
+
**Advanced Theming System**
|
|
45
|
+
|
|
46
|
+
Modern theme system with OKLCh color scales, runtime preset switching, and dark mode support.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install @maz-ui/themes
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Features:**
|
|
53
|
+
|
|
54
|
+
- 🎨 Native `light-dark()` + `color-scheme` + OKLCh scales via relative color syntax
|
|
55
|
+
- 🌓 Smart dark mode - `class` or `media` strategies, with smooth transitions on toggle
|
|
56
|
+
- ✨ Optional animated theme switch via View Transitions (`setColorMode(..., { animate: true })`)
|
|
57
|
+
- ⚡ `runtime` and `buildtime` rendering strategies
|
|
58
|
+
- 🍪 Active preset persisted across reloads (opt-out)
|
|
59
|
+
- 🛡️ Full TypeScript support
|
|
60
|
+
|
|
61
|
+
[→ View Theme Documentation](../ecosystem/themes.md)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### @maz-ui/translations
|
|
66
|
+
|
|
67
|
+
**Internationalization (i18n)**
|
|
68
|
+
|
|
69
|
+
Internationalization library for Maz-UI.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install @maz-ui/translations
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Features:**
|
|
76
|
+
|
|
77
|
+
- 🌐 Internationalization of Maz-UI components
|
|
78
|
+
- 🔄 Locale management
|
|
79
|
+
- 📦 Tree-shakable imports
|
|
80
|
+
- 🛠️ TypeScript support
|
|
81
|
+
|
|
82
|
+
[→ View Translations Documentation](../ecosystem/translations.md)
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### @maz-ui/icons
|
|
87
|
+
|
|
88
|
+
**Optimized Icon Library**
|
|
89
|
+
|
|
90
|
+
Comprehensive collection of SVG icons designed for performance and flexibility.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm install @maz-ui/icons
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Features:**
|
|
97
|
+
|
|
98
|
+
- 860+ icons
|
|
99
|
+
- Usable as Vue components (e.g. `<MazStar />`)
|
|
100
|
+
- Tree-shakable imports
|
|
101
|
+
- Multiple sizes and variants
|
|
102
|
+
- Full TypeScript definitions
|
|
103
|
+
|
|
104
|
+
[→ Browse Icon Library](../ecosystem/icons/index.md)
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### @maz-ui/mcp
|
|
109
|
+
|
|
110
|
+
**Make your AI coding agents use maz-ui**
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx @maz-ui/mcp init
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Features:**
|
|
117
|
+
|
|
118
|
+
- Rules for Claude Code, Cursor, GitHub Copilot, Codex... without touching your own instructions
|
|
119
|
+
- MCP server: search by need, component APIs, icons, Tailwind theme tokens, docs of the installed version
|
|
120
|
+
- Code review against the installed maz-ui, in the agent loop and in CI
|
|
121
|
+
- Claude Code plugin and automatic setup with the Nuxt module
|
|
122
|
+
|
|
123
|
+
[→ View AI agents guide](./ai-agents.md)
|
|
124
|
+
|
|
125
|
+
## Performance Optimizations
|
|
126
|
+
|
|
127
|
+
### Tree-Shaking Benefits
|
|
128
|
+
|
|
129
|
+
Maz-UI v5 is built with tree-shaking in mind. Import only what you need for optimal bundle sizes:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
/**
|
|
133
|
+
* Components
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
// ✅ Import specific components (good)
|
|
137
|
+
import { MazBtn, MazCard, MazInput } from 'maz-ui/components'
|
|
138
|
+
// ✅✅ Direct component import (most optimized)
|
|
139
|
+
import MazBtn from 'maz-ui/components/MazBtn'
|
|
140
|
+
import MazCard from 'maz-ui/components/MazCard'
|
|
141
|
+
import MazInput from 'maz-ui/components/MazInput'
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Composables
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
// ✅ Import composable from index file
|
|
148
|
+
import { useBreakpoints, useToast } from 'maz-ui/composables'
|
|
149
|
+
|
|
150
|
+
// ✅✅ Direct composable import (most optimized)
|
|
151
|
+
import { useToast } from 'maz-ui/composables/useToast'
|
|
152
|
+
import { useBreakpoints } from 'maz-ui/composables/useBreakpoints'
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Directives
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
// ✅ Import directive from index file
|
|
159
|
+
import { vClickOutside } from 'maz-ui/directives'
|
|
160
|
+
|
|
161
|
+
// ✅✅ Direct directive import (most optimized)
|
|
162
|
+
import { vClickOutside } from 'maz-ui/directives/vClickOutside'
|
|
163
|
+
|
|
164
|
+
// ✅✅✅ Even better: auto-import does this automatically
|
|
165
|
+
// Components, composables, and utilities are imported only when used
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Plugins
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
// ✅ Import plugin from index file
|
|
172
|
+
import { MazUi } from 'maz-ui/plugins'
|
|
173
|
+
// ✅✅ Direct plugin import (most optimized)
|
|
174
|
+
import { MazUi } from 'maz-ui/plugins/maz-ui'
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Utilities
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
// ❌ Avoid importing everything
|
|
181
|
+
import { formatCurrency, debounce } from '@maz-ui/utils'
|
|
182
|
+
// ✅ Import from @maz-ui/utils
|
|
183
|
+
import { debounce } from '@maz-ui/utils/helpers/debounce'
|
|
184
|
+
import { formatCurrency } from '@maz-ui/utils/helpers/formatCurrency'
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Tip: Maximum Optimization**
|
|
188
|
+
|
|
189
|
+
**Direct imports** (e.g., `import MazBtn from 'maz-ui/components/MazBtn'`) are the most optimized approach as they bypass index files completely. This ensures the smallest possible bundle size and fastest build times.
|
|
190
|
+
|
|
191
|
+
## Next Steps
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Global component defaults"
|
|
3
|
+
description: "Set default prop values once for every Maz-UI component through the MazUi plugin or the Nuxt module"
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/guide/global-defaults"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Global component defaults
|
|
9
|
+
|
|
10
|
+
> Set default prop values once for every Maz-UI component through the MazUi plugin or the Nuxt module
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Web: https://maz-ui.com/guide/global-defaults
|
|
14
|
+
|
|
15
|
+
Instead of repeating the same prop on every instance (`<MazBtn rounded-size="lg" />` everywhere), you can set a default once and let every component pick it up.
|
|
16
|
+
|
|
17
|
+
## Priority
|
|
18
|
+
|
|
19
|
+
A resolved prop always follows this order, from highest to lowest priority:
|
|
20
|
+
|
|
21
|
+
1. The prop set on the component instance
|
|
22
|
+
2. `defaults.<ComponentName>` (per-component default)
|
|
23
|
+
3. `defaults.global` (cross-cutting default)
|
|
24
|
+
4. The library's built-in default
|
|
25
|
+
|
|
26
|
+
A global default **never** overrides a prop set on the instance. Without any `defaults` config, every component keeps its built-in default, so this feature is fully opt-in and backward compatible.
|
|
27
|
+
|
|
28
|
+
## Vue
|
|
29
|
+
|
|
30
|
+
Pass `defaults` to the `MazUi` plugin:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { MazUi } from 'maz-ui/plugins/maz-ui'
|
|
34
|
+
import { mazUi as mazUiPreset } from '@maz-ui/themes/presets/mazUi'
|
|
35
|
+
import 'maz-ui/style.css'
|
|
36
|
+
|
|
37
|
+
app.use(MazUi, {
|
|
38
|
+
theme: { preset: mazUiPreset },
|
|
39
|
+
defaults: {
|
|
40
|
+
global: { roundedSize: 'lg' },
|
|
41
|
+
MazBtn: { roundedSize: 'full' }, // wins over global for MazBtn
|
|
42
|
+
MazCard: { bordered: false, elevation: true },
|
|
43
|
+
MazContainer: { bordered: false },
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Nuxt
|
|
49
|
+
|
|
50
|
+
Set it in `nuxt.config` under the `mazUi` key:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
export default defineNuxtConfig({
|
|
54
|
+
modules: ['@maz-ui/nuxt'],
|
|
55
|
+
mazUi: {
|
|
56
|
+
defaults: {
|
|
57
|
+
global: { roundedSize: 'lg' },
|
|
58
|
+
MazBtn: { roundedSize: 'full' },
|
|
59
|
+
MazCard: { bordered: false, elevation: true },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## `global` vs per-component
|
|
66
|
+
|
|
67
|
+
- `defaults.global` holds **cross-cutting** props shared by many components: `roundedSize`, `size` and `flagSrc`. Set them once and every component that exposes them picks the value up.
|
|
68
|
+
- `defaults.<ComponentName>` holds **per-component** props (including booleans such as `bordered`, `elevation`, `padding`). A per-component entry always wins over `global`.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
defaults: {
|
|
72
|
+
global: { roundedSize: 'lg', size: 'sm' },
|
|
73
|
+
MazBtn: { roundedSize: 'full' }, // MazBtn is 'full', everything else 'lg'
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Type safety
|
|
78
|
+
|
|
79
|
+
`defaults` is fully typed. Each component entry is typed as `Partial<ComponentNameProps>`, so you get autocompletion and a TypeScript error on an unknown or mistyped prop:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
defaults: {
|
|
83
|
+
MazBtn: { roundedSiz: 'lg' }, // ❌ TS error: 'roundedSiz' does not exist
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Globalizable props
|
|
88
|
+
|
|
89
|
+
| Prop | Type | Components |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| `roundedSize` | `MazRoundedSize` (`'none' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'`) | `MazBtn`, `MazBtnGroup`, `MazContainer`, `MazInput`, `MazTextarea`, `MazTable`, `MazBadge`, `MazAlert`, `MazAvatar`, `MazSkeleton`, `MazTimeline` |
|
|
92
|
+
| `flagSrc` | `MazCountryFlagSrc` (URL template or function, e.g. `loadCountryFlag` from `maz-ui/country-flags`) | `MazSelectCountry`, `MazInputPhoneNumber` (see [flags source](../components/maz-select-country.md#flags-source)) |
|
|
93
|
+
| `size` | `MazSize` (`'mini' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'`) | `MazBtn`, `MazBtnGroup`, `MazBadge`, `MazInput`, `MazSelect`, `MazSelectCountry`, `MazInputNumber`, `MazInputTags`, `MazInputPhoneNumber`, `MazCheckbox`, `MazRadio`, `MazRadioButtons`, `MazDropdown`, `MazPagination`, `MazTable`, `MazTimeline` |
|
|
94
|
+
| `bordered`, `elevation`, `padding`, `transparent`, `overflowHidden` | `boolean` | `MazContainer` |
|
|
95
|
+
| `bordered`, `elevation`, `padding`, `radius`, `scale`, `overflowHidden` | `boolean` | `MazCard` |
|
|
96
|
+
|
|
97
|
+
**Tip: Note**
|
|
98
|
+
|
|
99
|
+
Components whose `size` is a free CSS length (`MazSizeUnit`, e.g. `MazSpinner`, `MazAvatar`, `MazDrawer`, `MazSlider`, `MazCircularProgressBar`, `MazFullscreenLoader`) do not take the global `size` token - the value would not be valid for them. `MazAlert` and `MazTimeline` keep their own wider `roundedSize` scale; a `defaults.global.roundedSize` value still applies to them, and their extra steps (`2xl`, `3xl`) are reachable through their per-component entry.
|
|
100
|
+
|
|
101
|
+
## Relation to the theme system
|
|
102
|
+
|
|
103
|
+
This is **not** a duplicate of [`@maz-ui/themes`](../ecosystem/themes.md). The theme system controls *what a token looks like* (the CSS value of `rounded-md`, `shadow-elevation`, colors…). Global defaults control *which prop value a component selects by default* (whether `MazBtn` defaults to `roundedSize="lg"`). Both work together: the theme defines what `lg` renders as, the defaults decide which step a component uses.
|