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,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazReadMore"
|
|
3
|
+
description: "MazReadMore is a standalone component to truncate long text with a \"Read more\" / \"Read less\" toggle functionality"
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-read-more"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazReadMore
|
|
9
|
+
|
|
10
|
+
> MazReadMore is a standalone component to truncate long text with a "Read more" / "Read less" toggle functionality
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazReadMore from 'maz-ui/components/MazReadMore'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-read-more
|
|
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
|
+
**Tip:**
|
|
20
|
+
|
|
21
|
+
This component can be translated globally using the [MazUi](../ecosystem/translations.md) plugin.
|
|
22
|
+
|
|
23
|
+
## Basic usage
|
|
24
|
+
|
|
25
|
+
Use the `text` prop or the default slot to provide the content to truncate. By default, the component uses line-clamp with 4 lines.
|
|
26
|
+
|
|
27
|
+
### With text prop
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<script lang="ts" setup>
|
|
31
|
+
import MazReadMore from 'maz-ui/components/MazReadMore'
|
|
32
|
+
|
|
33
|
+
const longText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
34
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
35
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
36
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
37
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
38
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
39
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<MazReadMore :text="longText" />
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### With default slot
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<script lang="ts" setup>
|
|
51
|
+
import MazReadMore from 'maz-ui/components/MazReadMore'
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<MazReadMore>
|
|
56
|
+
<p>
|
|
57
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
58
|
+
</p>
|
|
59
|
+
</MazReadMore>
|
|
60
|
+
</template>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Truncation with max lines
|
|
64
|
+
|
|
65
|
+
Control the number of visible lines using the `max-lines` prop.
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<script lang="ts" setup>
|
|
69
|
+
import MazReadMore from 'maz-ui/components/MazReadMore'
|
|
70
|
+
|
|
71
|
+
const longText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
72
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
73
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
|
|
74
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse.
|
|
75
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa.
|
|
76
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
77
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<MazReadMore :text="longText" :max-lines="2" />
|
|
82
|
+
<MazReadMore :text="longText" :max-lines="6" />
|
|
83
|
+
</template>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Truncation with max characters
|
|
87
|
+
|
|
88
|
+
Use the `max-chars` prop to truncate based on character count instead of lines.
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<script lang="ts" setup>
|
|
92
|
+
import MazReadMore from 'maz-ui/components/MazReadMore'
|
|
93
|
+
|
|
94
|
+
const longText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
95
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
96
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.`
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<template>
|
|
100
|
+
<MazReadMore :text="longText" :max-chars="50" />
|
|
101
|
+
<MazReadMore :max-chars="150">
|
|
102
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
103
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
104
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
105
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
106
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
107
|
+
</MazReadMore>
|
|
108
|
+
</template>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Using slot for content
|
|
112
|
+
|
|
113
|
+
You can use the default slot to provide rich content instead of plain text.
|
|
114
|
+
|
|
115
|
+
```vue
|
|
116
|
+
<script lang="ts" setup>
|
|
117
|
+
import MazReadMore from 'maz-ui/components/MazReadMore'
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<template>
|
|
121
|
+
<MazReadMore :max-lines="2">
|
|
122
|
+
<p>
|
|
123
|
+
<strong>Rich content example:</strong> Lorem ipsum dolor sit amet,
|
|
124
|
+
<em>consectetur adipiscing elit</em>. Sed do eiusmod tempor incididunt ut labore
|
|
125
|
+
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
126
|
+
ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
127
|
+
</p>
|
|
128
|
+
</MazReadMore>
|
|
129
|
+
</template>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Colors
|
|
133
|
+
|
|
134
|
+
Customize the color of the toggle link using the `color` prop.
|
|
135
|
+
|
|
136
|
+
```vue
|
|
137
|
+
<script lang="ts" setup>
|
|
138
|
+
import MazReadMore from 'maz-ui/components/MazReadMore'
|
|
139
|
+
|
|
140
|
+
const longText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
141
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
142
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.`
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<template>
|
|
146
|
+
<MazReadMore :text="longText" color="primary" :max-lines="2" />
|
|
147
|
+
<MazReadMore :text="longText" color="secondary" :max-lines="2" />
|
|
148
|
+
<MazReadMore :text="longText" color="info" :max-lines="2" />
|
|
149
|
+
<MazReadMore :text="longText" color="success" :max-lines="2" />
|
|
150
|
+
<MazReadMore :text="longText" color="warning" :max-lines="2" />
|
|
151
|
+
<MazReadMore :text="longText" color="destructive" :max-lines="2" />
|
|
152
|
+
</template>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Custom toggle text
|
|
156
|
+
|
|
157
|
+
Customize the "Read more" and "Read less" text using the `expand-text` and `collapse-text` props.
|
|
158
|
+
|
|
159
|
+
```vue
|
|
160
|
+
<script lang="ts" setup>
|
|
161
|
+
import MazReadMore from 'maz-ui/components/MazReadMore'
|
|
162
|
+
|
|
163
|
+
const longText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
164
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
165
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.`
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<template>
|
|
169
|
+
<MazReadMore
|
|
170
|
+
:text="longText"
|
|
171
|
+
:max-lines="2"
|
|
172
|
+
expand-text="Show more"
|
|
173
|
+
collapse-text="Show less"
|
|
174
|
+
/>
|
|
175
|
+
</template>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Short content (no button)
|
|
179
|
+
|
|
180
|
+
When the content is shorter than the truncation limit, the toggle button is automatically hidden.
|
|
181
|
+
|
|
182
|
+
```vue
|
|
183
|
+
<script lang="ts" setup>
|
|
184
|
+
import MazReadMore from 'maz-ui/components/MazReadMore'
|
|
185
|
+
</script>
|
|
186
|
+
|
|
187
|
+
<template>
|
|
188
|
+
<MazReadMore text="This is a short text that doesn't need truncation." :max-lines="4" />
|
|
189
|
+
</template>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## MazReadMore API
|
|
193
|
+
|
|
194
|
+
`import MazReadMore from 'maz-ui/components/MazReadMore'`
|
|
195
|
+
|
|
196
|
+
### Props
|
|
197
|
+
|
|
198
|
+
- `text` (`string`): The text to be truncated.
|
|
199
|
+
- `max-lines` (`number`, default: `4`): The maximum number of lines to be displayed.
|
|
200
|
+
- `max-chars` (`number`): The maximum number of characters to be displayed.
|
|
201
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent" | "surface" | "muted" | "inherit"`, default: `"primary"`): The color of the link (MazLink).
|
|
202
|
+
- `collapse-text` (`string`, default: `'readMore.collapse' (translations)`): The text of the link when the content is collapsed.
|
|
203
|
+
- `expand-text` (`string`, default: `'readMore.expand' (translations)`): The text of the link when the content is expanded.
|
|
204
|
+
- `id` (`string`): Unique identifier for accessibility linking.
|
|
205
|
+
- `aria-label` (`string`, default: `'readMore.ariaLabel' (translations)`): Accessibility label for the content region.
|
|
206
|
+
|
|
207
|
+
### Slots
|
|
208
|
+
|
|
209
|
+
- `#default`
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MazReadingProgressBar"
|
|
3
|
+
description: "MazReadingProgressBar is a standalone component to display a reading progress bar"
|
|
4
|
+
package: "maz-ui"
|
|
5
|
+
url: "https://maz-ui.com/components/maz-reading-progress-bar"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MazReadingProgressBar
|
|
9
|
+
|
|
10
|
+
> MazReadingProgressBar is a standalone component to display a reading progress bar
|
|
11
|
+
|
|
12
|
+
- Package: `maz-ui`
|
|
13
|
+
- Import: `import MazReadingProgressBar from 'maz-ui/components/MazReadingProgressBar'`
|
|
14
|
+
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
|
|
15
|
+
- Web: https://maz-ui.com/components/maz-reading-progress-bar
|
|
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
|
+
This component use the `<Teleport />` component to move the progress bar to the top of the page. You can set the `teleport-selector` prop to change the target of the teleportation.
|
|
20
|
+
|
|
21
|
+
## Basic usage
|
|
22
|
+
|
|
23
|
+
Look at the top of the page to see the component in action (scroll in page to inscrease progress bar width).
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import MazReadingProgressBar from 'maz-ui/components/MazReadingProgressBar'
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<MazReadingProgressBar content-selector=".VPDoc" teleport-selector="#app" />
|
|
32
|
+
</template>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Types
|
|
36
|
+
|
|
37
|
+
### Props
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
export interface Props {
|
|
41
|
+
/**
|
|
42
|
+
* Height of the progress bar
|
|
43
|
+
* @default 4px
|
|
44
|
+
*/
|
|
45
|
+
height?: string
|
|
46
|
+
/**
|
|
47
|
+
* Color of the progress bar
|
|
48
|
+
* @default primary
|
|
49
|
+
*/
|
|
50
|
+
color?: Color
|
|
51
|
+
/**
|
|
52
|
+
* Selector of the element to teleport the progress bar
|
|
53
|
+
* @default body
|
|
54
|
+
*/
|
|
55
|
+
teleportSelector?: string
|
|
56
|
+
/**
|
|
57
|
+
* Selector of the element to get the height
|
|
58
|
+
* @default body
|
|
59
|
+
*/
|
|
60
|
+
contentSelector?: string
|
|
61
|
+
/**
|
|
62
|
+
* Offset of the progress bar
|
|
63
|
+
* @default 0
|
|
64
|
+
*/
|
|
65
|
+
offset?: number
|
|
66
|
+
/**
|
|
67
|
+
* Class of the progress bar
|
|
68
|
+
* @default undefined
|
|
69
|
+
*/
|
|
70
|
+
barClass?: HTMLAttributes['class']
|
|
71
|
+
/**
|
|
72
|
+
* Instead of using the height of the content with a selector, you can set a scroll distance
|
|
73
|
+
* @default undefined
|
|
74
|
+
*/
|
|
75
|
+
distance?: number
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## MazReadingProgressBar API
|
|
80
|
+
|
|
81
|
+
`import MazReadingProgressBar from 'maz-ui/components/MazReadingProgressBar'`
|
|
82
|
+
|
|
83
|
+
### Props
|
|
84
|
+
|
|
85
|
+
- `height` (`string`, default: `"4px"`): Height of the progress bar.
|
|
86
|
+
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"`, default: `"primary"`): Color of the progress bar.
|
|
87
|
+
- `teleport-selector` (`string`, default: `"body"`): Selector of the element to teleport the progress bar.
|
|
88
|
+
- `content-selector` (`string`, default: `"body"`): Selector of the element to get the height.
|
|
89
|
+
- `offset` (`number`, default: `0`): Offset of the progress bar.
|
|
90
|
+
- `bar-class` (`ClassValue`): Class of the progress bar.
|
|
91
|
+
- `distance` (`number`): Instead of using the height of the content with a selector, you can set a scroll distance.
|
|
92
|
+
|
|
93
|
+
### Events
|
|
94
|
+
|
|
95
|
+
- `@begin`
|
|
96
|
+
- `@complete`
|