@maz-ui/mcp 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/README.md +61 -228
- package/bin/maz-ui-mcp.mjs +2 -5
- package/dist/cli.d.mts +7 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.mjs +14 -0
- package/dist/index.d.mts +340 -0
- package/dist/index.d.ts +340 -0
- package/dist/index.mjs +14 -0
- package/dist/shared/mcp.DzqVbCaL.mjs +2346 -0
- 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/{src/components → components}/maz-alert.md +31 -164
- 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/{src/components → components}/maz-badge.md +26 -67
- package/docs/components/maz-bottom-sheet.md +257 -0
- package/docs/{src/components → components}/maz-btn-group.md +26 -189
- package/docs/{src/components → components}/maz-btn.md +60 -245
- package/docs/components/maz-card-spotlight.md +84 -0
- package/docs/{src/components → components}/maz-card.md +67 -192
- package/docs/components/maz-carousel.md +153 -0
- package/docs/{src/components → components}/maz-chart.md +17 -161
- 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/{src/components → components}/maz-code-highlight.md +15 -93
- package/docs/components/maz-container.md +241 -0
- package/docs/{src/components → components}/maz-date-picker.md +85 -454
- 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/{src/components → components}/maz-dropzone.md +80 -221
- 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/{src/components → components}/maz-icon.md +32 -83
- 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/{src/components → components}/maz-input.md +74 -221
- 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/{src/components → components}/maz-markdown-editor.md +72 -125
- package/docs/components/maz-pagination.md +82 -0
- package/docs/components/maz-popover.md +794 -0
- package/docs/{src/components → components}/maz-pull-to-refresh.md +59 -45
- package/docs/components/maz-radio-buttons.md +313 -0
- package/docs/components/maz-radio.md +119 -0
- package/docs/{src/components → components}/maz-read-more.md +31 -122
- package/docs/components/maz-reading-progress-bar.md +96 -0
- package/docs/{src/components → components}/maz-select-country.md +80 -340
- package/docs/{src/components → components}/maz-select.md +76 -206
- 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/{src/components → components}/maz-sidebar.md +117 -329
- package/docs/{src/components → components}/maz-skeleton.md +27 -156
- package/docs/{src/components → components}/maz-slider.md +33 -66
- package/docs/components/maz-spinner.md +84 -0
- package/docs/{src/components → components}/maz-stepper.md +43 -185
- 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/{src/components → components}/maz-tabs.md +89 -126
- 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/{src/components → components}/maz-window-mockup.md +38 -105
- 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/{src/composables → composables}/use-display-names.md +12 -59
- package/docs/{src/composables → composables}/use-drag.md +14 -68
- package/docs/{src/composables → composables}/use-form-validator.md +22 -696
- package/docs/{src/composables → composables}/use-idle-timeout.md +13 -97
- package/docs/{src/composables → composables}/use-pull-to-refresh.md +14 -7
- package/docs/{src/composables → composables}/use-reading-time.md +20 -56
- package/docs/composables/use-string-matching.md +41 -0
- package/docs/{src/composables → composables}/use-swipe.md +14 -81
- package/docs/{src/composables → composables}/use-timer.md +12 -38
- package/docs/composables/use-toast.md +50 -0
- package/docs/{src/composables → composables}/use-user-visibility.md +14 -56
- package/docs/composables/use-wait.md +50 -0
- package/docs/composables/use-window-size.md +25 -0
- package/docs/{src/directives → directives}/click-outside.md +13 -99
- package/docs/{src/directives → directives}/fullscreen-img.md +10 -28
- package/docs/{src/directives → directives}/lazy-img.md +14 -49
- package/docs/{src/directives → directives}/tooltip.md +12 -217
- package/docs/{src/directives → directives}/zoom-img.md +11 -38
- package/docs/{src/ecosystem → ecosystem}/eslint-config.md +37 -29
- package/docs/ecosystem/icons/icon-set.md +25 -0
- package/docs/{src/ecosystem → ecosystem}/icons/index.md +22 -16
- package/docs/ecosystem/mcp.md +165 -0
- package/docs/{src/ecosystem → ecosystem}/node/exec-promise.md +12 -6
- package/docs/ecosystem/node/index.md +53 -0
- package/docs/{src/ecosystem → ecosystem}/node/logger.md +12 -6
- package/docs/{src/ecosystem → ecosystem}/node/print-banner.md +12 -4
- package/docs/ecosystem/node/setup-agents.md +102 -0
- package/docs/{src/ecosystem → ecosystem}/nuxt.md +46 -19
- package/docs/{src/ecosystem → ecosystem}/stylelint-config.md +33 -25
- package/docs/{src/ecosystem → ecosystem}/themes.md +72 -235
- package/docs/{src/ecosystem → ecosystem}/translations.md +25 -23
- package/docs/ecosystem/utils/camel-case.md +37 -0
- package/docs/ecosystem/utils/capitalize.md +37 -0
- package/docs/{src/ecosystem → ecosystem}/utils/check-availability.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/cookie.md +18 -12
- package/docs/ecosystem/utils/country-code-to-unicode-flag.md +128 -0
- package/docs/{src/ecosystem → ecosystem}/utils/currency.md +12 -26
- package/docs/{src/ecosystem → ecosystem}/utils/date.md +10 -24
- package/docs/ecosystem/utils/debounce-callback.md +44 -0
- package/docs/{src/ecosystem → ecosystem}/utils/debounce-id.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/debounce.md +14 -8
- package/docs/ecosystem/utils/fetch-locale-ip.md +39 -0
- package/docs/{src/ecosystem → ecosystem}/utils/format-json.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/format-phone-number.md +12 -6
- package/docs/ecosystem/utils/get-browser-locale.md +35 -0
- package/docs/ecosystem/utils/get-country-flag-url.md +67 -0
- package/docs/{src/ecosystem → ecosystem}/utils/get-error-message.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/idle-timeout.md +15 -9
- package/docs/{src/ecosystem → ecosystem}/utils/index.md +10 -13
- package/docs/{src/ecosystem → ecosystem}/utils/is-client.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/is-equal.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/is-ios.md +12 -6
- package/docs/ecosystem/utils/is-server.md +37 -0
- package/docs/ecosystem/utils/is-standalone-mode.md +49 -0
- package/docs/{src/ecosystem → ecosystem}/utils/kebab-case.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/normalize-string.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/number.md +10 -24
- package/docs/{src/ecosystem → ecosystem}/utils/pascal-case.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/prevent-ios-input-zoom.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/script-loader.md +16 -8
- package/docs/{src/ecosystem → ecosystem}/utils/sleep.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/snake-case.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/swipe-handler.md +14 -8
- package/docs/{src/ecosystem → ecosystem}/utils/textarea-autogrow.md +12 -6
- package/docs/{src/ecosystem → ecosystem}/utils/throttle-id.md +13 -7
- package/docs/{src/ecosystem → ecosystem}/utils/throttle.md +14 -8
- package/docs/ecosystem/utils/truthy-filter.md +37 -0
- package/docs/{src/ecosystem → ecosystem}/utils/types/deep-key-of.md +11 -5
- package/docs/{src/ecosystem → ecosystem}/utils/types/deep-partial.md +10 -4
- package/docs/ecosystem/utils/types/deep-required.md +45 -0
- package/docs/ecosystem/utils/types/flatten-object-keys.md +50 -0
- package/docs/{src/ecosystem → ecosystem}/utils/types/generic-instance-type.md +10 -4
- package/docs/{src/ecosystem → ecosystem}/utils/types/infer-maybe-ref.md +10 -4
- package/docs/ecosystem/utils/upper-first.md +38 -0
- package/docs/{src/ecosystem → ecosystem}/utils/user-visibility.md +12 -6
- package/docs/guide/ai-agents.md +237 -0
- package/docs/{src/guide → guide}/browser-support.md +22 -15
- package/docs/{src/guide → guide}/getting-started.md +34 -139
- package/docs/{src/guide → guide}/global-defaults.md +12 -11
- package/docs/{src/guide → guide}/maz-ui-provider.md +17 -16
- package/docs/{src/guide → guide}/migration-v5.md +95 -88
- package/docs/{src/guide → guide}/resolvers.md +33 -100
- package/docs/guide/tailwind.md +483 -0
- package/docs/{src/guide → guide}/vue.md +33 -39
- package/docs/manifest.json +1 -0
- package/docs/{src/plugins → plugins}/aos.md +20 -55
- package/docs/{src/plugins → plugins}/dialog.md +14 -161
- 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 +84 -22
- package/dist/mcp.d.mts +0 -153
- package/dist/mcp.d.ts +0 -153
- package/dist/mcp.mjs +0 -1511
- package/docs/generated-docs/maz-accordion.doc.md +0 -21
- package/docs/generated-docs/maz-alert.doc.md +0 -20
- package/docs/generated-docs/maz-animated-counter.doc.md +0 -17
- package/docs/generated-docs/maz-animated-element.doc.md +0 -14
- package/docs/generated-docs/maz-animated-text.doc.md +0 -17
- package/docs/generated-docs/maz-avatar.doc.md +0 -45
- package/docs/generated-docs/maz-backdrop.doc.md +0 -55
- package/docs/generated-docs/maz-badge.doc.md +0 -16
- package/docs/generated-docs/maz-bottom-sheet.doc.md +0 -24
- package/docs/generated-docs/maz-btn-group.doc.md +0 -20
- package/docs/generated-docs/maz-btn.doc.md +0 -33
- package/docs/generated-docs/maz-card-spotlight.doc.md +0 -16
- package/docs/generated-docs/maz-card.doc.md +0 -39
- package/docs/generated-docs/maz-carousel.doc.md +0 -17
- package/docs/generated-docs/maz-chart.doc.md +0 -10
- package/docs/generated-docs/maz-checkbox.doc.md +0 -33
- package/docs/generated-docs/maz-checklist.doc.md +0 -30
- package/docs/generated-docs/maz-circular-progress-bar.doc.md +0 -27
- package/docs/generated-docs/maz-code-highlight.doc.md +0 -11
- package/docs/generated-docs/maz-container.doc.md +0 -26
- package/docs/generated-docs/maz-date-picker.doc.md +0 -56
- package/docs/generated-docs/maz-dialog-confirm.doc.md +0 -24
- package/docs/generated-docs/maz-dialog.doc.md +0 -22
- package/docs/generated-docs/maz-drawer.doc.md +0 -25
- package/docs/generated-docs/maz-dropdown.doc.md +0 -45
- package/docs/generated-docs/maz-dropzone.doc.md +0 -82
- package/docs/generated-docs/maz-expand-animation.doc.md +0 -12
- package/docs/generated-docs/maz-fullscreen-loader.doc.md +0 -13
- package/docs/generated-docs/maz-gallery.doc.md +0 -17
- package/docs/generated-docs/maz-icon.doc.md +0 -16
- package/docs/generated-docs/maz-input-code.doc.md +0 -25
- package/docs/generated-docs/maz-input-number.doc.md +0 -33
- package/docs/generated-docs/maz-input-phone-number.doc.md +0 -62
- package/docs/generated-docs/maz-input-price.doc.md +0 -26
- package/docs/generated-docs/maz-input-tags.doc.md +0 -24
- package/docs/generated-docs/maz-input.doc.md +0 -54
- package/docs/generated-docs/maz-lazy-img.doc.md +0 -49
- package/docs/generated-docs/maz-link.doc.md +0 -31
- package/docs/generated-docs/maz-loading-bar.doc.md +0 -6
- package/docs/generated-docs/maz-markdown-editor.doc.md +0 -65
- package/docs/generated-docs/maz-pagination.doc.md +0 -21
- package/docs/generated-docs/maz-popover.doc.md +0 -79
- package/docs/generated-docs/maz-pull-to-refresh.doc.md +0 -50
- package/docs/generated-docs/maz-radio-buttons.doc.md +0 -34
- package/docs/generated-docs/maz-radio.doc.md +0 -33
- package/docs/generated-docs/maz-read-more.doc.md +0 -18
- package/docs/generated-docs/maz-reading-progress-bar.doc.md +0 -18
- package/docs/generated-docs/maz-select-country.doc.md +0 -45
- package/docs/generated-docs/maz-select.doc.md +0 -32
- package/docs/generated-docs/maz-sidebar-content.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-footer.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-group.doc.md +0 -11
- package/docs/generated-docs/maz-sidebar-header.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-menu-button.doc.md +0 -27
- package/docs/generated-docs/maz-sidebar-menu-item.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-menu-sub.doc.md +0 -16
- package/docs/generated-docs/maz-sidebar-menu.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar-separator.doc.md +0 -0
- package/docs/generated-docs/maz-sidebar-trigger.doc.md +0 -5
- package/docs/generated-docs/maz-sidebar.doc.md +0 -36
- package/docs/generated-docs/maz-skeleton.doc.md +0 -12
- package/docs/generated-docs/maz-slider.doc.md +0 -20
- package/docs/generated-docs/maz-spinner.doc.md +0 -6
- package/docs/generated-docs/maz-stepper.doc.md +0 -30
- package/docs/generated-docs/maz-switch.doc.md +0 -31
- package/docs/generated-docs/maz-table-cell.doc.md +0 -5
- package/docs/generated-docs/maz-table-row.doc.md +0 -12
- package/docs/generated-docs/maz-table-title.doc.md +0 -5
- package/docs/generated-docs/maz-table-virtualizer.doc.md +0 -20
- package/docs/generated-docs/maz-table.doc.md +0 -72
- package/docs/generated-docs/maz-tabs-bar.doc.md +0 -29
- package/docs/generated-docs/maz-tabs-content-item.doc.md +0 -11
- package/docs/generated-docs/maz-tabs-content.doc.md +0 -5
- package/docs/generated-docs/maz-tabs.doc.md +0 -20
- package/docs/generated-docs/maz-textarea.doc.md +0 -46
- package/docs/generated-docs/maz-ticker.doc.md +0 -25
- package/docs/generated-docs/maz-timeline.doc.md +0 -32
- package/docs/generated-docs/maz-ui-provider.doc.md +0 -12
- package/docs/generated-docs/maz-window-mockup.doc.md +0 -23
- package/docs/src/blog/v4.md +0 -276
- package/docs/src/blog/v5.md +0 -184
- package/docs/src/changelog.md +0 -7
- package/docs/src/components/index.md +0 -8
- package/docs/src/components/maz-accordion.md +0 -80
- package/docs/src/components/maz-animated-counter.md +0 -124
- package/docs/src/components/maz-animated-element.md +0 -36
- package/docs/src/components/maz-animated-text.md +0 -36
- package/docs/src/components/maz-avatar.md +0 -227
- package/docs/src/components/maz-backdrop.md +0 -250
- package/docs/src/components/maz-bottom-sheet.md +0 -533
- package/docs/src/components/maz-card-spotlight.md +0 -163
- package/docs/src/components/maz-carousel.md +0 -231
- package/docs/src/components/maz-checkbox.md +0 -168
- package/docs/src/components/maz-checklist.md +0 -414
- package/docs/src/components/maz-circular-progress-bar.md +0 -145
- package/docs/src/components/maz-container.md +0 -363
- package/docs/src/components/maz-dialog-confirm.md +0 -240
- package/docs/src/components/maz-dialog.md +0 -164
- package/docs/src/components/maz-drawer.md +0 -181
- package/docs/src/components/maz-dropdown.md +0 -691
- package/docs/src/components/maz-expand-animation.md +0 -99
- package/docs/src/components/maz-fullscreen-loader.md +0 -58
- package/docs/src/components/maz-gallery.md +0 -85
- package/docs/src/components/maz-input-code.md +0 -61
- package/docs/src/components/maz-input-number.md +0 -81
- package/docs/src/components/maz-input-phone-number.md +0 -942
- package/docs/src/components/maz-input-price.md +0 -67
- package/docs/src/components/maz-input-tags.md +0 -114
- package/docs/src/components/maz-lazy-img.md +0 -88
- package/docs/src/components/maz-link.md +0 -178
- package/docs/src/components/maz-loading-bar.md +0 -26
- package/docs/src/components/maz-pagination.md +0 -79
- package/docs/src/components/maz-popover.md +0 -1416
- package/docs/src/components/maz-radio-buttons.md +0 -462
- package/docs/src/components/maz-radio.md +0 -142
- package/docs/src/components/maz-reading-progress-bar.md +0 -74
- package/docs/src/components/maz-spinner.md +0 -93
- package/docs/src/components/maz-switch.md +0 -92
- package/docs/src/components/maz-table.md +0 -732
- package/docs/src/components/maz-textarea.md +0 -400
- package/docs/src/components/maz-ticker.md +0 -692
- package/docs/src/components/maz-timeline.md +0 -478
- package/docs/src/composables/use-aos.md +0 -34
- package/docs/src/composables/use-breakpoints.md +0 -35
- package/docs/src/composables/use-dialog.md +0 -88
- package/docs/src/composables/use-string-matching.md +0 -63
- package/docs/src/composables/use-toast.md +0 -71
- package/docs/src/composables/use-wait.md +0 -62
- package/docs/src/composables/use-window-size.md +0 -18
- package/docs/src/ecosystem/icons/icon-set.md +0 -123
- package/docs/src/ecosystem/mcp.md +0 -210
- package/docs/src/ecosystem/node/index.md +0 -53
- package/docs/src/ecosystem/utils/camel-case.md +0 -31
- package/docs/src/ecosystem/utils/capitalize.md +0 -50
- package/docs/src/ecosystem/utils/country-code-to-unicode-flag.md +0 -213
- package/docs/src/ecosystem/utils/debounce-callback.md +0 -38
- package/docs/src/ecosystem/utils/fetch-locale-ip.md +0 -33
- package/docs/src/ecosystem/utils/get-browser-locale.md +0 -29
- package/docs/src/ecosystem/utils/get-country-flag-url.md +0 -156
- package/docs/src/ecosystem/utils/is-server.md +0 -31
- package/docs/src/ecosystem/utils/is-standalone-mode.md +0 -43
- package/docs/src/ecosystem/utils/truthy-filter.md +0 -31
- package/docs/src/ecosystem/utils/types/deep-required.md +0 -39
- package/docs/src/ecosystem/utils/types/flatten-object-keys.md +0 -44
- package/docs/src/ecosystem/utils/upper-first.md +0 -32
- package/docs/src/guide/cli.md +0 -144
- package/docs/src/guide/migration-v4.md +0 -925
- package/docs/src/guide/tailwind.md +0 -158
- package/docs/src/index.md +0 -603
- package/docs/src/made-with-maz-ui.md +0 -58
- package/docs/src/plugins/toast.md +0 -349
- package/docs/src/plugins/wait.md +0 -109
- package/docs/src/theme-editor.md +0 -21
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazInputTags"
|
|
3
|
+
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."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-input-tags"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazInputTags
|
|
9
|
+
|
|
10
|
+
> 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.
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazInputTags from 'maz-ui/components/MazInputTags'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-input-tags
|
|
16
|
+
|
|
17
|
+
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
|
|
18
|
+
|
|
19
|
+
## Basic usage
|
|
20
|
+
|
|
21
|
+
**Returned value**
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import MazInputTags from 'maz-ui/components/MazInputTags'
|
|
26
|
+
import { ref } from 'vue'
|
|
27
|
+
|
|
28
|
+
const tags = ref(['tags 1', 'tags 2'])
|
|
29
|
+
const sizes = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<MazInputTags
|
|
34
|
+
v-model="tags"
|
|
35
|
+
label="Enter tags"
|
|
36
|
+
color="info"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Sizing
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<script lang="ts" setup>
|
|
45
|
+
import MazInputTags from 'maz-ui/components/MazInputTags'
|
|
46
|
+
import { ref } from 'vue'
|
|
47
|
+
|
|
48
|
+
const tags = ref(['tags 1', 'tags 2'])
|
|
49
|
+
const sizes = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<div class="flex flex-col gap-2">
|
|
54
|
+
<MazInputTags
|
|
55
|
+
v-for="size in sizes"
|
|
56
|
+
:key="size"
|
|
57
|
+
v-model="tags"
|
|
58
|
+
:size="size"
|
|
59
|
+
placeholder="Enter tags"
|
|
60
|
+
color="secondary"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<script lang="ts" setup>
|
|
68
|
+
import MazInputTags from 'maz-ui/components/MazInputTags'
|
|
69
|
+
import { ref } from 'vue'
|
|
70
|
+
|
|
71
|
+
const tags = ref(['tags 1', 'tags 2'])
|
|
72
|
+
const sizes = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<MazInputTags
|
|
77
|
+
v-model="tags"
|
|
78
|
+
label="Enter tags"
|
|
79
|
+
color="info"
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
<MazInputTags
|
|
83
|
+
v-model="tags"
|
|
84
|
+
placeholder="Enter tags"
|
|
85
|
+
color="secondary"
|
|
86
|
+
size="sm"
|
|
87
|
+
/>
|
|
88
|
+
</template>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## MazInputTags API
|
|
92
|
+
|
|
93
|
+
`import MazInputTags from 'maz-ui/components/MazInputTags'`
|
|
94
|
+
|
|
95
|
+
### Props
|
|
96
|
+
|
|
97
|
+
- `model-value` (`(string | number)[]`, `v-model`): The modelValue of the input.
|
|
98
|
+
- `placeholder` (`string`): The placeholder of the input.
|
|
99
|
+
- `label` (`string`): The label of the input.
|
|
100
|
+
- `disabled` (`boolean`, default: `false`): Disable the input.
|
|
101
|
+
- `error` (`boolean`, default: `false`): Display the input with error style.
|
|
102
|
+
- `success` (`boolean`, default: `false`): Display the input with success style.
|
|
103
|
+
- `warning` (`boolean`, default: `false`): Display the input with warning style.
|
|
104
|
+
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): The size of the input.
|
|
105
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): The color of the input.
|
|
106
|
+
- `block` (`boolean`): The input will be displayed in full width.
|
|
107
|
+
- `add-tags-on-blur` (`boolean`, default: `true`): Add tags on blur.
|
|
108
|
+
- `hint` (`string`): The hint text to display below the input.
|
|
109
|
+
|
|
110
|
+
### Events
|
|
111
|
+
|
|
112
|
+
- `@update:model-value` (payload: `value?: (string | number)[] | undefined`)
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: MazInput
|
|
3
|
-
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.
|
|
2
|
+
title: "MazInput"
|
|
3
|
+
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."
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-input"
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# MazInput
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> 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.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazInput from 'maz-ui/components/MazInput'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-input
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<ComponentDemo>
|
|
15
|
-
<MazInput v-model="inputValue" label="Label" name="firstname" />
|
|
17
|
+
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
## Basic usage
|
|
18
20
|
|
|
19
21
|
```vue
|
|
20
22
|
<script setup>
|
|
@@ -33,127 +35,55 @@ const inputValue = ref()
|
|
|
33
35
|
</template>
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
</template>
|
|
37
|
-
</ComponentDemo>
|
|
38
|
-
|
|
39
38
|
## Top label
|
|
40
39
|
|
|
41
|
-
<ComponentDemo>
|
|
42
|
-
<MazInput v-model="inputValue" top-label="Top label" placeholder="Placeholder" autocomplete="off" />
|
|
43
|
-
|
|
44
|
-
<template #code>
|
|
45
|
-
|
|
46
40
|
```html
|
|
47
41
|
<MazInput v-model="inputValue" top-label="Top label" placeholder="Placeholder" />
|
|
48
42
|
```
|
|
49
43
|
|
|
50
|
-
</template>
|
|
51
|
-
</ComponentDemo>
|
|
52
|
-
|
|
53
44
|
## Assistive text
|
|
54
45
|
|
|
55
|
-
<ComponentDemo>
|
|
56
|
-
<MazInput v-model="inputValue" top-label="Top label" assistive-text="Assistive text" placeholder="Placeholder" />
|
|
57
|
-
<br />
|
|
58
|
-
<br />
|
|
59
|
-
<MazInput v-model="inputValue" error top-label="Top label" assistive-text="Assistive text" placeholder="Placeholder" />
|
|
60
|
-
|
|
61
|
-
<template #code>
|
|
62
|
-
|
|
63
46
|
```html
|
|
64
47
|
<MazInput v-model="inputValue" top-label="Top label" assistive-text="Assistive text" placeholder="Placeholder" />
|
|
65
48
|
```
|
|
66
49
|
|
|
67
|
-
</template>
|
|
68
|
-
</ComponentDemo>
|
|
69
|
-
|
|
70
50
|
## Password
|
|
71
51
|
|
|
72
|
-
<ComponentDemo>
|
|
73
|
-
<form>
|
|
74
|
-
<MazInput v-model="passwordValue" label="Label" type="password" name="password" autocomplete="nope" />
|
|
75
|
-
</form>
|
|
76
|
-
|
|
77
|
-
<template #code>
|
|
78
|
-
|
|
79
52
|
```html
|
|
80
53
|
<MazInput v-model="passwordValue" label="Label" type="password" />
|
|
81
54
|
```
|
|
82
55
|
|
|
83
|
-
</template>
|
|
84
|
-
</ComponentDemo>
|
|
85
|
-
|
|
86
56
|
## Placeholder
|
|
87
57
|
|
|
88
|
-
<ComponentDemo>
|
|
89
|
-
<MazInput v-model="inputValue" placeholder="placeholder" autocomplete="off" />
|
|
90
|
-
|
|
91
|
-
<template #code>
|
|
92
|
-
|
|
93
58
|
```html
|
|
94
59
|
<MazInput v-model="inputValue" placeholder="placeholder" />
|
|
95
60
|
```
|
|
96
61
|
|
|
97
|
-
</template>
|
|
98
|
-
</ComponentDemo>
|
|
99
|
-
|
|
100
62
|
## Required
|
|
101
63
|
|
|
102
|
-
<ComponentDemo>
|
|
103
|
-
<MazInput v-model="inputValue" label="label required" required autocomplete="off" />
|
|
104
|
-
|
|
105
|
-
<template #code>
|
|
106
|
-
|
|
107
64
|
```html
|
|
108
65
|
<MazInput v-model="inputValue" label="label required" required />
|
|
109
66
|
```
|
|
110
67
|
|
|
111
|
-
</template>
|
|
112
|
-
</ComponentDemo>
|
|
113
|
-
|
|
114
68
|
## Disabled
|
|
115
69
|
|
|
116
|
-
<ComponentDemo>
|
|
117
|
-
<MazInput v-model="inputValue" label="label disabled" disabled autocomplete="off" />
|
|
118
|
-
|
|
119
|
-
<template #code>
|
|
120
|
-
|
|
121
70
|
```html
|
|
122
71
|
<MazInput v-model="inputValue" label="label disabled" disabled />
|
|
123
72
|
```
|
|
124
73
|
|
|
125
|
-
</template>
|
|
126
|
-
</ComponentDemo>
|
|
127
|
-
|
|
128
74
|
## Hint
|
|
129
75
|
|
|
130
76
|
> Will replace the label, useful to display short message
|
|
131
77
|
|
|
132
|
-
<ComponentDemo>
|
|
133
|
-
<MazInput v-model="defaultInputValue" label="label hint" hint="An error occured" error autocomplete="off" />
|
|
134
|
-
|
|
135
|
-
<template #code>
|
|
136
|
-
|
|
137
78
|
```html
|
|
138
79
|
<MazInput v-model="defaultInputValue" label="label hint" hint="An error occured" error />
|
|
139
80
|
```
|
|
140
81
|
|
|
141
|
-
</template>
|
|
142
|
-
</ComponentDemo>
|
|
143
|
-
|
|
144
82
|
## Icons
|
|
145
83
|
|
|
146
|
-
<MazInput
|
|
147
|
-
v-model="inputValue"
|
|
148
|
-
label="label icons"
|
|
149
|
-
start-icon="/banknotes.svg"
|
|
150
|
-
end-icon="/user.svg"
|
|
151
|
-
autocomplete="off"
|
|
152
|
-
/>
|
|
153
|
-
|
|
154
84
|
### Use icon name
|
|
155
85
|
|
|
156
|
-
|
|
86
|
+
**Details: View code**
|
|
157
87
|
|
|
158
88
|
When you use the properties `end-icon`, `start-icon` or `icon` with the icon name (string), the component uses `<MazIcon icon="..." />` component.
|
|
159
89
|
|
|
@@ -163,11 +93,9 @@ Check out how [MazIcon](./maz-icon.md) works, see all available icons and downlo
|
|
|
163
93
|
<MazInput v-model="inputValue" label="label icons" start-icon="/banknotes.svg" end-icon="/user.svg" />
|
|
164
94
|
```
|
|
165
95
|
|
|
166
|
-
:::
|
|
167
|
-
|
|
168
96
|
### Use your own SVG icons
|
|
169
97
|
|
|
170
|
-
|
|
98
|
+
**Details: View code**
|
|
171
99
|
|
|
172
100
|
```html
|
|
173
101
|
<MazInput v-model="inputValue" label="label icons">
|
|
@@ -203,11 +131,9 @@ Check out how [MazIcon](./maz-icon.md) works, see all available icons and downlo
|
|
|
203
131
|
</MazInput>
|
|
204
132
|
```
|
|
205
133
|
|
|
206
|
-
:::
|
|
207
|
-
|
|
208
134
|
### Use [vite-svg-loader](https://github.com/jpkleemans/vite-svg-loader)
|
|
209
135
|
|
|
210
|
-
|
|
136
|
+
**Details: View code**
|
|
211
137
|
|
|
212
138
|
```vue
|
|
213
139
|
<script lang="ts" setup>
|
|
@@ -229,13 +155,11 @@ const inputValue = ref('value')
|
|
|
229
155
|
</template>
|
|
230
156
|
```
|
|
231
157
|
|
|
232
|
-
:::
|
|
233
|
-
|
|
234
158
|
### Pass a full `MazIconProps` object
|
|
235
159
|
|
|
236
|
-
`startIcon` and `endIcon` also accept a full `MazIconProps` object
|
|
160
|
+
`startIcon` and `endIcon` also accept a full `MazIconProps` object - pass the same shape `<MazIcon>` accepts to override the size, set a `<title>` for screen readers, attach `svgAttributes`, etc.
|
|
237
161
|
|
|
238
|
-
|
|
162
|
+
**Details: View code**
|
|
239
163
|
|
|
240
164
|
```vue
|
|
241
165
|
<script lang="ts" setup>
|
|
@@ -259,28 +183,14 @@ const inputValue = ref('value')
|
|
|
259
183
|
</template>
|
|
260
184
|
```
|
|
261
185
|
|
|
262
|
-
:::
|
|
263
|
-
|
|
264
186
|
## Auto focus
|
|
265
187
|
|
|
266
188
|
> Will focus automatically the component
|
|
267
189
|
|
|
268
|
-
<ComponentDemo>
|
|
269
|
-
<MazInput
|
|
270
|
-
v-model="inputValue"
|
|
271
|
-
label="label auto-focus"
|
|
272
|
-
autocomplete="off"
|
|
273
|
-
/>
|
|
274
|
-
|
|
275
|
-
<template #code>
|
|
276
|
-
|
|
277
190
|
```html
|
|
278
191
|
<MazInput v-model="inputValue" label="label auto-focus" auto-focus />
|
|
279
192
|
```
|
|
280
193
|
|
|
281
|
-
</template>
|
|
282
|
-
</ComponentDemo>
|
|
283
|
-
|
|
284
194
|
## Debounce
|
|
285
195
|
|
|
286
196
|
> The value emit by the input will be delayed, usefull for searching
|
|
@@ -289,40 +199,13 @@ const inputValue = ref('value')
|
|
|
289
199
|
>
|
|
290
200
|
> If the debounce is true, the default debounce delay is 500ms
|
|
291
201
|
|
|
292
|
-
<ComponentDemo>
|
|
293
|
-
<MazInput v-model="inputValue" label="label debounce" :debounce="1000" autocomplete="off" />
|
|
294
|
-
|
|
295
|
-
<p class="maz:mt-2">
|
|
296
|
-
modelValue: {{ inputValue ?? 'null' }}
|
|
297
|
-
</p>
|
|
298
|
-
|
|
299
|
-
<template #code>
|
|
300
|
-
|
|
301
202
|
```html
|
|
302
203
|
<MazInput v-model="inputValue" label="label debounce" :debounce="1000" />
|
|
303
204
|
```
|
|
304
205
|
|
|
305
|
-
</template>
|
|
306
|
-
</ComponentDemo>
|
|
307
|
-
|
|
308
206
|
## Sizes
|
|
309
207
|
|
|
310
|
-
> Use the attribute `size` with a value in
|
|
311
|
-
|
|
312
|
-
<ComponentDemo>
|
|
313
|
-
<div class="maz:flex maz:flex-col maz:gap-2 maz:items-start">
|
|
314
|
-
<MazInput
|
|
315
|
-
v-for="size in sizes"
|
|
316
|
-
:key="size"
|
|
317
|
-
v-model="inputValue"
|
|
318
|
-
:label="['mini', 'xs'].includes(size) ? undefined : size"
|
|
319
|
-
:placeholder="['mini', 'xs'].includes(size) ? size : undefined"
|
|
320
|
-
:size="size"
|
|
321
|
-
autocomplete="off"
|
|
322
|
-
/>
|
|
323
|
-
</div>
|
|
324
|
-
|
|
325
|
-
<template #code>
|
|
208
|
+
> Use the attribute `size` with a value in
|
|
326
209
|
|
|
327
210
|
```vue
|
|
328
211
|
<script setup lang="ts">
|
|
@@ -340,32 +223,15 @@ const sizes = ['mini', 'xs', 'sm', 'md', 'lg', 'xl']
|
|
|
340
223
|
</template>
|
|
341
224
|
```
|
|
342
225
|
|
|
343
|
-
|
|
344
|
-
</ComponentDemo>
|
|
226
|
+
**Note: Zoom on iOS**
|
|
345
227
|
|
|
346
|
-
::: info Zoom on iOS
|
|
347
228
|
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.
|
|
348
|
-
:::
|
|
349
229
|
|
|
350
230
|
## Colors
|
|
351
231
|
|
|
352
|
-
|
|
232
|
+
**Tip:**
|
|
233
|
+
|
|
353
234
|
Click on each input to show colors
|
|
354
|
-
:::
|
|
355
|
-
|
|
356
|
-
<ComponentDemo>
|
|
357
|
-
<div class="maz:flex maz:flex-col maz:gap-2 maz:items-start">
|
|
358
|
-
<MazInput
|
|
359
|
-
v-for="name in colors"
|
|
360
|
-
:key="name"
|
|
361
|
-
v-model="inputValue"
|
|
362
|
-
:label="name"
|
|
363
|
-
:color="name"
|
|
364
|
-
autocomplete="off"
|
|
365
|
-
/>
|
|
366
|
-
</div>
|
|
367
|
-
|
|
368
|
-
<template #code>
|
|
369
235
|
|
|
370
236
|
```vue
|
|
371
237
|
<script setup>
|
|
@@ -383,25 +249,10 @@ const colors = ['primary', 'secondary', 'info', 'success', 'warning', 'destructi
|
|
|
383
249
|
</template>
|
|
384
250
|
```
|
|
385
251
|
|
|
386
|
-
</template>
|
|
387
|
-
</ComponentDemo>
|
|
388
|
-
|
|
389
252
|
## Rounded Size
|
|
390
253
|
|
|
391
254
|
Use the attribute `rounded-size` with a value in `'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'`
|
|
392
255
|
|
|
393
|
-
<ComponentDemo>
|
|
394
|
-
<div class="maz:flex maz:flex-col maz:gap-2 maz:items-start">
|
|
395
|
-
<MazInput rounded-size="none" placeholder="Rounded input" autocomplete="off" />
|
|
396
|
-
<MazInput rounded-size="sm" placeholder="Rounded input" autocomplete="off" />
|
|
397
|
-
<MazInput rounded-size="md" placeholder="Rounded input" autocomplete="off" />
|
|
398
|
-
<MazInput rounded-size="lg" placeholder="Rounded input" autocomplete="off" />
|
|
399
|
-
<MazInput rounded-size="xl" placeholder="Rounded input" autocomplete="off" />
|
|
400
|
-
<MazInput rounded-size="full" placeholder="Rounded input" autocomplete="off" />
|
|
401
|
-
</div>
|
|
402
|
-
|
|
403
|
-
<template #code>
|
|
404
|
-
|
|
405
256
|
```html
|
|
406
257
|
<MazInput rounded-size="none" placeholder="Rounded input" />
|
|
407
258
|
<MazInput rounded-size="sm" placeholder="Rounded input" />
|
|
@@ -411,71 +262,73 @@ Use the attribute `rounded-size` with a value in `'none' | 'sm' | 'md' | 'lg' |
|
|
|
411
262
|
<MazInput rounded-size="full" placeholder="Rounded input" />
|
|
412
263
|
```
|
|
413
264
|
|
|
414
|
-
</template>
|
|
415
|
-
</ComponentDemo>
|
|
416
|
-
|
|
417
265
|
## State
|
|
418
266
|
|
|
419
|
-
|
|
420
|
-
<MazInput v-model="inputValue" label="Label" error autocomplete="off" />
|
|
421
|
-
|
|
422
|
-
<template #code>
|
|
267
|
+
**destructive**
|
|
423
268
|
|
|
424
269
|
```html
|
|
425
270
|
<MazInput v-model="inputValue" label="Label" error />
|
|
426
271
|
```
|
|
427
272
|
|
|
428
|
-
|
|
429
|
-
</ComponentDemo>
|
|
430
|
-
|
|
431
|
-
<br />
|
|
432
|
-
<br />
|
|
433
|
-
|
|
434
|
-
<ComponentDemo title="Warning">
|
|
435
|
-
<MazInput v-model="inputValue" label="Label" warning autocomplete="off" />
|
|
436
|
-
|
|
437
|
-
<template #code>
|
|
273
|
+
**Warning**
|
|
438
274
|
|
|
439
275
|
```html
|
|
440
276
|
<MazInput v-model="inputValue" label="Label" warning />
|
|
441
277
|
```
|
|
442
278
|
|
|
443
|
-
|
|
444
|
-
</ComponentDemo>
|
|
445
|
-
|
|
446
|
-
<br />
|
|
447
|
-
<br />
|
|
448
|
-
|
|
449
|
-
<ComponentDemo title="Success">
|
|
450
|
-
<MazInput v-model="inputValue" label="Label" success autocomplete="off" />
|
|
451
|
-
|
|
452
|
-
<template #code>
|
|
279
|
+
**Success**
|
|
453
280
|
|
|
454
281
|
```html
|
|
455
282
|
<MazInput v-model="inputValue" label="Label" success />
|
|
456
283
|
```
|
|
457
284
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
285
|
+
## MazInput API
|
|
286
|
+
|
|
287
|
+
`import MazInput from 'maz-ui/components/MazInput'`
|
|
288
|
+
|
|
289
|
+
### Props
|
|
290
|
+
|
|
291
|
+
- `model-value` (`T`, `v-model`): The current value of the input field. This prop is used for two-way data binding with v-model.
|
|
292
|
+
- `placeholder` (`string`): Text displayed when the input is empty to guide the user.
|
|
293
|
+
- `label` (`string`): Floating label that appears inside the input and moves up when focused or filled. Provides better UX than traditional placeholders.
|
|
294
|
+
- `top-label` (`string`): Static label displayed above the input field. Unlike the floating label, this remains fixed.
|
|
295
|
+
- `assistive-text` (`string`): Helper text displayed below the input to provide additional context or validation feedback.
|
|
296
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Theme color that affects the border and focus states of the input.
|
|
297
|
+
- `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).
|
|
298
|
+
- `required` (`boolean`, default: `false`): Makes the input field mandatory for form submission.
|
|
299
|
+
- `disabled` (`boolean`, default: `false`): Disables the input field, preventing user interaction and form submission.
|
|
300
|
+
- `readonly` (`boolean`): Makes the input field read-only, allowing selection but preventing modification.
|
|
301
|
+
- `id` (`string`): Unique identifier for the input element, used for form labels and accessibility.
|
|
302
|
+
- `error` (`boolean`, default: `false`): Applies error styling (red border and text) to indicate validation failure.
|
|
303
|
+
- `success` (`boolean`, default: `false`): Applies success styling (green border and text) to indicate successful validation.
|
|
304
|
+
- `warning` (`boolean`, default: `false`): Applies warning styling (orange border and text) to indicate potential issues.
|
|
305
|
+
- `hint` (`string`): Alternative text that replaces the label when provided. Useful for contextual hints.
|
|
306
|
+
- `input-classes` (`string`): Additional CSS classes to apply specifically to the input wrapper element.
|
|
307
|
+
- `border` (`boolean`, default: `true`): Controls whether the input has a visible border. Set to false for borderless inputs.
|
|
308
|
+
- `inputmode` (`"none" | "text" | "search" | "url" | "email" | "tel" | "numeric" | "decimal"`, default: `"text"`): HTML inputmode attribute that provides hints for virtual keyboards on mobile devices.
|
|
309
|
+
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`): Controls the height and text size of the input component.
|
|
310
|
+
- `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.
|
|
311
|
+
- `auto-focus` (`boolean`, default: `false`): Automatically focuses the input when the component mounts.
|
|
312
|
+
- `border-active` (`boolean`, default: `false`): When true, shows the colored border immediately instead of only on focus.
|
|
313
|
+
- `start-icon` (`any`): 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, …).
|
|
314
|
+
- `end-icon` (`any`): 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.
|
|
315
|
+
- `rounded-size` (`MazRoundedSize`, default: `'md'`): Controls the border radius of the input component. Values: `'none'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'full'` (non exhaustive).
|
|
316
|
+
- `block` (`boolean`): Makes the input expand to the full width of its container.
|
|
317
|
+
- `name` (`string`): The name of the input field. Used for form submission and validation.
|
|
318
|
+
- `autocomplete` (`string`): The autocomplete attribute for the input field. Used for form submission and validation.
|
|
319
|
+
- `loading` (`boolean`, default: `false`): Loading state for the input field. Used to show a loading spinner.
|
|
320
|
+
|
|
321
|
+
### Events
|
|
322
|
+
|
|
323
|
+
- `@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
|
|
324
|
+
- `@click` (payload: `event: Event`): Triggered when the user clicks on the input field
|
|
325
|
+
- `@blur` (payload: `event: Event`): Triggered when the input field loses focus (user clicks outside or tabs away)
|
|
326
|
+
- `@change` (payload: `event: Event`): Triggered when the input value changes and the field loses focus. Different from input event which fires on every keystroke
|
|
327
|
+
- `@focus` (payload: `event: Event`): Triggered when the input field gains focus (user clicks or tabs into the field)
|
|
328
|
+
- `@input` (payload: `event: Event`): Triggered on every keystroke or input interaction (real-time input changes). This is the raw input event, not debounced
|
|
329
|
+
|
|
330
|
+
### Slots
|
|
331
|
+
|
|
332
|
+
- `#start-icon`: Custom content for the inline-start edge of the input field (left in LTR, right in RTL).
|
|
333
|
+
- `#end-icon`: Custom content for the inline-end edge of the input field (right in LTR, left in RTL).
|
|
334
|
+
- `#loader`: Loader slot.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazLazyImg"
|
|
3
|
+
description: "MazLazyImg is a standalone component to display images and svgs with lazy loading"
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-lazy-img"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazLazyImg
|
|
9
|
+
|
|
10
|
+
> MazLazyImg is a standalone component to display images and svgs with lazy loading
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazLazyImg from 'maz-ui/components/MazLazyImg'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-lazy-img
|
|
16
|
+
|
|
17
|
+
> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)
|
|
18
|
+
|
|
19
|
+
```vue
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import MazLazyImg from 'maz-ui/components/MazLazyImg'
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<MazLazyImg src="https://placedog.net/1000/1000" block />
|
|
26
|
+
</template>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Tip: Performance**
|
|
30
|
+
|
|
31
|
+
`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.
|
|
32
|
+
|
|
33
|
+
## Responsive sources
|
|
34
|
+
|
|
35
|
+
Pass an object with `sources` to serve different images depending on the media query (like a native `<picture>`).
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<MazLazyImg
|
|
40
|
+
:src="{
|
|
41
|
+
sources: [
|
|
42
|
+
{ srcset: 'https://placedog.net/600/400', media: '(max-width: 600px)' },
|
|
43
|
+
{ srcset: 'https://placedog.net/1500/1000', media: '(min-width: 601px)' },
|
|
44
|
+
],
|
|
45
|
+
}"
|
|
46
|
+
block
|
|
47
|
+
/>
|
|
48
|
+
</template>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Image height full
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<template>
|
|
57
|
+
<div style="height: 200px;">
|
|
58
|
+
<MazLazyImg image-height-full src="https://placedog.net/1500/1000" />
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Fallback on error
|
|
64
|
+
|
|
65
|
+
Provide `fallback-src` to swap the image when it fails to load.
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<template>
|
|
69
|
+
<MazLazyImg
|
|
70
|
+
src="https://broken-link-image-src.example"
|
|
71
|
+
fallback-src="https://placedog.net/500/500"
|
|
72
|
+
block
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Without loader
|
|
78
|
+
|
|
79
|
+
Hide the spinner shown while the image is loading with `hide-loader`.
|
|
80
|
+
|
|
81
|
+
```vue
|
|
82
|
+
<template>
|
|
83
|
+
<MazLazyImg src="https://placedog.net/1000/1000" hide-loader block />
|
|
84
|
+
</template>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## MazLazyImg API
|
|
88
|
+
|
|
89
|
+
`import MazLazyImg from 'maz-ui/components/MazLazyImg'`
|
|
90
|
+
|
|
91
|
+
### Props
|
|
92
|
+
|
|
93
|
+
- `src` (`MazImage | null`): The source of the image.
|
|
94
|
+
- `alt` (`string`): The alt of the image.
|
|
95
|
+
- `hide-loader` (`boolean`): Remove the loader.
|
|
96
|
+
- `observer-once` (`boolean`, default: `true`): Remove the observer once the image is loaded.
|
|
97
|
+
- `load-once` (`boolean`): Remove the observer once the image is loaded.
|
|
98
|
+
- `image-height-full` (`boolean`): Make the image height full.
|
|
99
|
+
- `observer-options` (`{ root?: HTMLElement | null | undefined; threshold: number; rootMargin?: string | undefined; }`): The options of the observer.
|
|
100
|
+
- `fallback-src` (`string`): The fallback src to replace the src on loading error.
|
|
101
|
+
- `img-class` (`ClassValue`): The classes of the image element.
|
|
102
|
+
- `block` (`boolean`): The image will be displayed in full width.
|
|
103
|
+
|
|
104
|
+
### Events
|
|
105
|
+
|
|
106
|
+
- `@intersecting` (payload: `el: Element`): Emitted when the image is intersecting
|
|
107
|
+
- `@loading` (payload: `el: Element`): Emitted when the image is loading
|
|
108
|
+
- `@loaded` (payload: `el: Element`): Emitted when the image is loaded
|
|
109
|
+
- `@error` (payload: `el: Element`): Emitted when the image is in error
|
|
110
|
+
|
|
111
|
+
### Slots
|
|
112
|
+
|
|
113
|
+
- `#default`
|