@primevue/mcp 4.5.5 → 5.0.0-rc.2
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/LICENSE.md +45 -21
- package/README.md +48 -250
- package/data/components.json +47269 -0
- package/data/llms/components/accordion.md +629 -0
- package/data/llms/components/animateonscroll.md +165 -0
- package/data/llms/components/autocomplete.md +995 -0
- package/data/llms/components/avatar.md +264 -0
- package/data/llms/components/badge.md +200 -0
- package/data/llms/components/blockui.md +99 -0
- package/data/llms/components/breadcrumb.md +269 -0
- package/data/llms/components/button.md +902 -0
- package/data/llms/components/card.md +209 -0
- package/data/llms/components/carousel.md +506 -0
- package/data/llms/components/cascadeselect.md +1207 -0
- package/data/llms/components/chart.md +1022 -0
- package/data/llms/components/checkbox.md +401 -0
- package/data/llms/components/chip.md +206 -0
- package/data/llms/components/colorpicker.md +213 -0
- package/data/llms/components/commandmenu.md +660 -0
- package/data/llms/components/compare.md +407 -0
- package/data/llms/components/confirmdialog.md +343 -0
- package/data/llms/components/confirmpopup.md +252 -0
- package/data/llms/components/contextmenu.md +522 -0
- package/data/llms/components/datatable.md +5266 -0
- package/data/llms/components/dataview.md +569 -0
- package/data/llms/components/datepicker.md +964 -0
- package/data/llms/components/deferredcontent.md +96 -0
- package/data/llms/components/dialog.md +702 -0
- package/data/llms/components/divider.md +152 -0
- package/data/llms/components/dock.md +488 -0
- package/data/llms/components/drawer.md +469 -0
- package/data/llms/components/dynamicdialog.md +214 -0
- package/data/llms/components/editor.md +205 -0
- package/data/llms/components/fieldset.md +253 -0
- package/data/llms/components/fileupload.md +459 -0
- package/data/llms/components/floatlabel.md +144 -0
- package/data/llms/components/fluid.md +104 -0
- package/data/llms/components/focustrap.md +59 -0
- package/data/llms/components/forms.md +344 -0
- package/data/llms/components/galleria.md +1119 -0
- package/data/llms/components/gallery.md +1003 -0
- package/data/llms/components/iconfield.md +283 -0
- package/data/llms/components/iftalabel.md +96 -0
- package/data/llms/components/image.md +179 -0
- package/data/llms/components/imagecompare.md +108 -0
- package/data/llms/components/inplace.md +183 -0
- package/data/llms/components/inputcolor.md +869 -0
- package/data/llms/components/inputgroup.md +419 -0
- package/data/llms/components/inputmask.md +345 -0
- package/data/llms/components/inputnumber.md +551 -0
- package/data/llms/components/inputotp.md +345 -0
- package/data/llms/components/inputpassword.md +738 -0
- package/data/llms/components/inputtags.md +432 -0
- package/data/llms/components/inputtext.md +569 -0
- package/data/llms/components/installation.md +1 -0
- package/data/llms/components/keyfilter.md +116 -0
- package/data/llms/components/knob.md +318 -0
- package/data/llms/components/label.md +151 -0
- package/data/llms/components/laravel.md +53 -0
- package/data/llms/components/listbox.md +636 -0
- package/data/llms/components/mask.md +203 -0
- package/data/llms/components/mcp.md +39 -0
- package/data/llms/components/megamenu.md +563 -0
- package/data/llms/components/menu.md +651 -0
- package/data/llms/components/menubar.md +446 -0
- package/data/llms/components/message.md +497 -0
- package/data/llms/components/metergroup.md +281 -0
- package/data/llms/components/multiselect.md +752 -0
- package/data/llms/components/orderlist.md +224 -0
- package/data/llms/components/organizationchart.md +418 -0
- package/data/llms/components/paginator.md +221 -0
- package/data/llms/components/panel.md +321 -0
- package/data/llms/components/panelmenu.md +703 -0
- package/data/llms/components/password.md +657 -0
- package/data/llms/components/picklist.md +286 -0
- package/data/llms/components/popover.md +145 -0
- package/data/llms/components/progressbar.md +242 -0
- package/data/llms/components/progressspinner.md +104 -0
- package/data/llms/components/radiobutton.md +427 -0
- package/data/llms/components/rating.md +312 -0
- package/data/llms/components/ripple.md +91 -0
- package/data/llms/components/scrollarea.md +700 -0
- package/data/llms/components/scrollpanel.md +131 -0
- package/data/llms/components/scrolltop.md +87 -0
- package/data/llms/components/select.md +1251 -0
- package/data/llms/components/selectbutton.md +268 -0
- package/data/llms/components/sidebar.md +2232 -0
- package/data/llms/components/skeleton.md +302 -0
- package/data/llms/components/slider.md +416 -0
- package/data/llms/components/speeddial.md +402 -0
- package/data/llms/components/splitbutton.md +840 -0
- package/data/llms/components/splitter.md +447 -0
- package/data/llms/components/stepper.md +551 -0
- package/data/llms/components/styleclass.md +226 -0
- package/data/llms/components/tabs.md +609 -0
- package/data/llms/components/tag.md +178 -0
- package/data/llms/components/terminal.md +123 -0
- package/data/llms/components/textarea.md +519 -0
- package/data/llms/components/tieredmenu.md +578 -0
- package/data/llms/components/timeline.md +494 -0
- package/data/llms/components/toast.md +472 -0
- package/data/llms/components/togglebutton.md +276 -0
- package/data/llms/components/toggleswitch.md +271 -0
- package/data/llms/components/toolbar.md +140 -0
- package/data/llms/components/tooltip.md +160 -0
- package/data/llms/components/tree.md +1076 -0
- package/data/llms/components/treeselect.md +660 -0
- package/data/llms/components/treetable.md +2493 -0
- package/data/llms/components/virtualscroller.md +265 -0
- package/data/llms/guides/autoimport.md +28 -0
- package/data/llms/guides/cdn.md +72 -0
- package/data/llms/guides/configuration.md +158 -0
- package/data/llms/guides/customicons.md +67 -0
- package/data/llms/guides/guides/accessibility.md +27 -0
- package/data/llms/guides/guides/animations.md +119 -0
- package/data/llms/guides/guides/rtl.md +7 -0
- package/data/llms/guides/icons.md +136 -0
- package/data/llms/guides/installation.md +3 -0
- package/data/llms/guides/laravel.md +66 -0
- package/data/llms/guides/llms.md +15 -0
- package/data/llms/guides/mcp.md +104 -0
- package/data/llms/guides/migration/v4.md +15 -0
- package/data/llms/guides/migration/v5.md +15 -0
- package/data/llms/guides/nuxt.md +141 -0
- package/data/llms/guides/passthrough.md +137 -0
- package/data/llms/guides/primeclt.md +43 -0
- package/data/llms/guides/tailwind.md +151 -0
- package/data/llms/guides/theming/styled.md +497 -0
- package/data/llms/guides/theming/unstyled.md +57 -0
- package/data/llms/guides/uikit.md +3 -0
- package/data/llms/guides/vite.md +90 -0
- package/data/llms/llms-full.txt +54465 -0
- package/data/llms/llms.txt +132 -0
- package/data/llms/pages/accessibility.md +27 -0
- package/data/llms/pages/animations.md +119 -0
- package/data/llms/pages/autoimport.md +28 -0
- package/data/llms/pages/cdn.md +72 -0
- package/data/llms/pages/configuration.md +158 -0
- package/data/llms/pages/contribution.md +31 -0
- package/data/llms/pages/customicons.md +67 -0
- package/data/llms/pages/designer.md +79 -0
- package/data/llms/pages/dynamicimports.md +7 -0
- package/data/llms/pages/forms.md +63 -0
- package/data/llms/pages/guides/accessibility.md +27 -0
- package/data/llms/pages/guides/animations.md +119 -0
- package/data/llms/pages/guides/rtl.md +7 -0
- package/data/llms/pages/icons.md +136 -0
- package/data/llms/pages/installation.md +3 -0
- package/data/llms/pages/introduction.md +23 -0
- package/data/llms/pages/laravel.md +66 -0
- package/data/llms/pages/llms.md +15 -0
- package/data/llms/pages/mcp.md +104 -0
- package/data/llms/pages/migration/v4.md +15 -0
- package/data/llms/pages/migration/v5.md +15 -0
- package/data/llms/pages/nuxt.md +141 -0
- package/data/llms/pages/passthrough.md +137 -0
- package/data/llms/pages/primeclt.md +43 -0
- package/data/llms/pages/rtl.md +7 -0
- package/data/llms/pages/setup.md +3 -0
- package/data/llms/pages/styled.md +497 -0
- package/data/llms/pages/tailwind.md +151 -0
- package/data/llms/pages/theming/styled.md +497 -0
- package/data/llms/pages/theming/unstyled.md +57 -0
- package/data/llms/pages/uikit.md +3 -0
- package/data/llms/pages/unstyled.md +57 -0
- package/data/llms/pages/v4.md +15 -0
- package/data/llms/pages/v5.md +15 -0
- package/data/llms/pages/vite.md +90 -0
- package/data/manifest.json +11117 -0
- package/data/mcp-data.json +55940 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +66066 -72541
- package/package.json +10 -12
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# VirtualScroller
|
|
2
|
+
|
|
3
|
+
VirtualScroller is a performant approach to render large amounts of data efficiently.
|
|
4
|
+
|
|
5
|
+
## Basic
|
|
6
|
+
|
|
7
|
+
VirtualScroller requires items as the data to display, itemSize for the dimensions of an item and item template are required on component. In addition, an initial array is required based on the total number of items to display. Size of the viewport is configured using scrollWidth , scrollHeight properties directly or with CSS width and height styles.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex justify-center">
|
|
12
|
+
<VirtualScroller :items="items" :itemSize="50" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px">
|
|
13
|
+
<template v-slot:item="{ item, options }">
|
|
14
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">{{ item }}</div>
|
|
15
|
+
</template>
|
|
16
|
+
</VirtualScroller>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { ref } from 'vue';
|
|
22
|
+
|
|
23
|
+
const items = ref(Array.from({ length: 100000 }).map((_, i) => \`Item #\${i}\`));
|
|
24
|
+
<\/script>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Horizontal
|
|
28
|
+
|
|
29
|
+
Setting orientation to horizontal enables scrolling horizontally. In this case, the itemSize should refer to the width of an item.
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<template>
|
|
33
|
+
<div class="flex justify-center">
|
|
34
|
+
<VirtualScroller :items="items" :itemSize="50" orientation="horizontal" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px" :pt="{ content: 'flex flex-row' }">
|
|
35
|
+
<template v-slot:item="{ item, options }">
|
|
36
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="width: 50px; writing-mode: vertical-lr;">{{ item }}</div>
|
|
37
|
+
</template>
|
|
38
|
+
</VirtualScroller>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup>
|
|
43
|
+
import { ref } from 'vue';
|
|
44
|
+
|
|
45
|
+
const items = ref(Array.from({ length: 100000 }).map((_, i) => \`Item #\${i}\`));
|
|
46
|
+
<\/script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Grid
|
|
50
|
+
|
|
51
|
+
Scrolling can be enabled vertically and horizontally when orientation is set as both . In this mode, itemSize should be an array where first value is the height of an item and second is the width.
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<template>
|
|
55
|
+
<div class="flex justify-center">
|
|
56
|
+
<VirtualScroller :items="items" :itemSize="[50, 100]" orientation="both" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px">
|
|
57
|
+
<template v-slot:item="{ item, options }">
|
|
58
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">
|
|
59
|
+
<template v-for="(el, index) of item" :key="index">
|
|
60
|
+
<div style="width: 100px">{{ el }}</div>
|
|
61
|
+
</template>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
</VirtualScroller>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script setup>
|
|
69
|
+
import { ref } from 'vue';
|
|
70
|
+
|
|
71
|
+
const items = ref(Array.from({ length: 1000 }).map((_, i) => Array.from({ length: 1000 }).map((_j, j) => \`Item #\${i}_\${j}\`)));
|
|
72
|
+
<\/script>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Delay
|
|
76
|
+
|
|
77
|
+
The delay property adds a threshold to wait in milliseconds during scrolling for render optimization.
|
|
78
|
+
|
|
79
|
+
```vue
|
|
80
|
+
<template>
|
|
81
|
+
<div class="flex flex-wrap justify-center gap-8">
|
|
82
|
+
<div>
|
|
83
|
+
<span class="font-bold block mb-2">No Delay</span>
|
|
84
|
+
<VirtualScroller :items="items" :itemSize="50" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px">
|
|
85
|
+
<template v-slot:item="{ item, options }">
|
|
86
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">{{ item }}</div>
|
|
87
|
+
</template>
|
|
88
|
+
</VirtualScroller>
|
|
89
|
+
</div>
|
|
90
|
+
<div>
|
|
91
|
+
<span class="font-bold block mb-2">150ms</span>
|
|
92
|
+
<VirtualScroller :items="items" :itemSize="50" :delay="150" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px">
|
|
93
|
+
<template v-slot:item="{ item, options }">
|
|
94
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">{{ item }}</div>
|
|
95
|
+
</template>
|
|
96
|
+
</VirtualScroller>
|
|
97
|
+
</div>
|
|
98
|
+
<div>
|
|
99
|
+
<span class="font-bold block mb-2">500ms</span>
|
|
100
|
+
<VirtualScroller :items="items" :itemSize="50" :delay="500" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px">
|
|
101
|
+
<template v-slot:item="{ item, options }">
|
|
102
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">{{ item }}</div>
|
|
103
|
+
</template>
|
|
104
|
+
</VirtualScroller>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<script setup>
|
|
110
|
+
import { ref } from 'vue';
|
|
111
|
+
|
|
112
|
+
const items = ref(Array.from({ length: 100000 }).map((_, i) => \`Item #\${i}\`));
|
|
113
|
+
<\/script>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Loading
|
|
117
|
+
|
|
118
|
+
Busy state is enabled by adding showLoader property which blocks the UI with a modal by default. Alternatively, loader template can be used to customize items e.g. with Skeleton .
|
|
119
|
+
|
|
120
|
+
```vue
|
|
121
|
+
<template>
|
|
122
|
+
<div class="flex flex-wrap justify-center gap-8">
|
|
123
|
+
<div>
|
|
124
|
+
<span class="font-bold block mb-2">Modal</span>
|
|
125
|
+
<VirtualScroller :items="items" :itemSize="50" showLoader :delay="250" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px">
|
|
126
|
+
<template v-slot:item="{ item, options }">
|
|
127
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">{{ item }}</div>
|
|
128
|
+
</template>
|
|
129
|
+
</VirtualScroller>
|
|
130
|
+
</div>
|
|
131
|
+
<div>
|
|
132
|
+
<span class="font-bold block mb-2">Skeleton</span>
|
|
133
|
+
<VirtualScroller :items="items" :itemSize="50" showLoader :delay="250" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px">
|
|
134
|
+
<template v-slot:item="{ item, options }">
|
|
135
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">{{ item }}</div>
|
|
136
|
+
</template>
|
|
137
|
+
<template v-slot:loader="{ options }">
|
|
138
|
+
<div :class="['flex items-center p-2', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">
|
|
139
|
+
<Skeleton :width="options.even ? '60%' : '50%'" height="1.3rem" />
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
142
|
+
</VirtualScroller>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<script setup>
|
|
148
|
+
import { ref } from 'vue';
|
|
149
|
+
|
|
150
|
+
const items = ref(Array.from({ length: 100000 }).map((_, i) => \`Item #\${i}\`));
|
|
151
|
+
<\/script>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Lazy
|
|
155
|
+
|
|
156
|
+
Lazy mode is handy to deal with large datasets, instead of loading the entire data, small chunks of data is loaded on demand. To implement lazy loading, enable the lazy property and implement onLazyLoad callback to return data.
|
|
157
|
+
|
|
158
|
+
```vue
|
|
159
|
+
<template>
|
|
160
|
+
<div class="flex justify-center">
|
|
161
|
+
<VirtualScroller :items="lazyItems" :itemSize="50" showLoader :delay="250" :loading="lazyLoading" lazy @lazy-load="onLazyLoad" class="border border-surface-200 dark:border-surface-700 rounded" style="width: 200px; height: 200px">
|
|
162
|
+
<template v-slot:item="{ item, options }">
|
|
163
|
+
<div :class="['flex items-center p-2 text-sm', { 'bg-surface-100 dark:bg-surface-700': options.odd }]" style="height: 50px">{{ item }}</div>
|
|
164
|
+
</template>
|
|
165
|
+
</VirtualScroller>
|
|
166
|
+
</div>
|
|
167
|
+
</template>
|
|
168
|
+
|
|
169
|
+
<script setup>
|
|
170
|
+
import { ref } from 'vue';
|
|
171
|
+
|
|
172
|
+
const lazyItems = ref(Array.from({ length: 10000 }));
|
|
173
|
+
const lazyLoading = ref(false);
|
|
174
|
+
const loadLazyTimeout = ref();
|
|
175
|
+
const onLazyLoad = (event) => {
|
|
176
|
+
lazyLoading.value = true;
|
|
177
|
+
|
|
178
|
+
if (loadLazyTimeout.value) {
|
|
179
|
+
clearTimeout(loadLazyTimeout.value);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
//imitate delay of a backend call
|
|
183
|
+
loadLazyTimeout.value = setTimeout(() => {
|
|
184
|
+
const { first, last } = event;
|
|
185
|
+
const _lazyItems = [...lazyItems.value];
|
|
186
|
+
|
|
187
|
+
for (let i = first; i < last; i++) {
|
|
188
|
+
_lazyItems[i] = \`Item #\${i}\`;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
lazyItems.value = _lazyItems;
|
|
192
|
+
lazyLoading.value = false;
|
|
193
|
+
|
|
194
|
+
}, Math.random() * 1000 + 250);
|
|
195
|
+
};
|
|
196
|
+
<\/script>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Accessibility
|
|
200
|
+
|
|
201
|
+
Screen Reader VirtualScroller has no specific role is enforced, still you may use any aria role and attributes as any valid attribute is passed to the container element. Keyboard Support Component does not include any built-in interactive elements.
|
|
202
|
+
|
|
203
|
+
## Virtual Scroller API
|
|
204
|
+
|
|
205
|
+
### Props
|
|
206
|
+
|
|
207
|
+
| Name |Type |Default |Description |
|
|
208
|
+
| --- | --- | --- | --- |
|
|
209
|
+
| id | string | - | Unique identifier of the element. |
|
|
210
|
+
| style | any | - | Inline style of the component. |
|
|
211
|
+
| class | any | - | Style class of the component. |
|
|
212
|
+
| items | null \| any[] \| any[][] | - | An array of objects to display. |
|
|
213
|
+
| itemSize | number \| number[] | - | The height/width of item according to orientation. |
|
|
214
|
+
| scrollHeight | string | - | Height of the scroll viewport. |
|
|
215
|
+
| scrollWidth | string | - | Width of the scroll viewport. |
|
|
216
|
+
| orientation | HintedString<"both" \| "horizontal" \| "vertical"> | vertical | The orientation of scrollbar. |
|
|
217
|
+
| numToleratedItems | number | half the number of items shown in the view. | Determines how many additional elements to add to the DOM outside of the view. According to the scrolls made up and down, extra items are added in a certain algorithm in the form of multiples of this number. |
|
|
218
|
+
| delay | number | 0 | Delay in scroll before new data is loaded. |
|
|
219
|
+
| resizeDelay | number | 10 | Delay after window's resize finishes. |
|
|
220
|
+
| lazy | boolean | false | Defines if data is loaded and interacted with in lazy manner. |
|
|
221
|
+
| disabled | boolean | false | If disabled, the VirtualScroller feature is eliminated and the content is displayed directly. |
|
|
222
|
+
| loaderDisabled | boolean | false | Used to implement a custom loader instead of using the loader feature in the VirtualScroller. |
|
|
223
|
+
| showLoader | boolean | false | Whether to show loader. |
|
|
224
|
+
| showSpacer | boolean | true | Used to implement a custom spacer instead of using the spacer feature in the VirtualScroller. |
|
|
225
|
+
| loading | boolean | false | Whether to load items. |
|
|
226
|
+
| tabindex | string \| number | 0 | Index of the element in tabbing order. |
|
|
227
|
+
| inline | boolean | false | When enabled, positions the content as inline. |
|
|
228
|
+
| step | number | 0 | Used to specify how many items to load in each load method in lazy mode. |
|
|
229
|
+
| appendOnly | boolean | false | Used to append each loaded item to top without removing any items from the DOM. Using very large data may cause the browser to crash. |
|
|
230
|
+
| autoSize | boolean | false | Whether to dynamically change the height or width of scrollable container. |
|
|
231
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
232
|
+
| pt | PassThrough<VirtualScrollerPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
233
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
234
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
235
|
+
|
|
236
|
+
### Pass Through Options
|
|
237
|
+
|
|
238
|
+
| Name |Type |Description |
|
|
239
|
+
| --- | --- | --- |
|
|
240
|
+
| root | VirtualScrollerPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
241
|
+
| content | VirtualScrollerPassThroughOptionType | Used to pass attributes to the content's DOM element. |
|
|
242
|
+
| loader | VirtualScrollerPassThroughOptionType | Used to pass attributes to the loader's DOM element. |
|
|
243
|
+
| loadingIcon | VirtualScrollerPassThroughOptionType | Used to pass attributes to the loading icon's DOM element. |
|
|
244
|
+
| spacer | VirtualScrollerPassThroughOptionType | Used to pass attributes to the spacer's DOM element. |
|
|
245
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
246
|
+
|
|
247
|
+
### Theming
|
|
248
|
+
|
|
249
|
+
### CSS Classes
|
|
250
|
+
|
|
251
|
+
| Class |Description |
|
|
252
|
+
| --- | --- |
|
|
253
|
+
| p-virtualscroller | Class name of the root element |
|
|
254
|
+
| p-virtualscroller-content | Class name of the content element |
|
|
255
|
+
| p-virtualscroller-spacer | Class name of the spacer element |
|
|
256
|
+
| p-virtualscroller-loader | Class name of the loader element |
|
|
257
|
+
| p-virtualscroller-loading-icon | Class name of the loading icon element |
|
|
258
|
+
|
|
259
|
+
### Design Tokens
|
|
260
|
+
|
|
261
|
+
| Token |CSS Variable |Description |
|
|
262
|
+
| --- | --- | --- |
|
|
263
|
+
| virtualscroller.loader.mask.background | --p-virtualscroller-loader-mask-background | Background of loader mask |
|
|
264
|
+
| virtualscroller.loader.mask.color | --p-virtualscroller-loader-mask-color | Color of loader mask |
|
|
265
|
+
| virtualscroller.loader.icon.size | --p-virtualscroller-loader-icon-size | Size of the loader icon |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Auto Import
|
|
2
|
+
|
|
3
|
+
On-demand PrimeVue components with auto imports and tree-shaking.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
PrimeVue components need to be imported and configured individually. In the next section, we'll cleanup the code using auto imports.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
import { createApp } from "vue";
|
|
11
|
+
import PrimeVue from "primevue/config";
|
|
12
|
+
import InputText from 'primevue/inputtext';
|
|
13
|
+
import Button from 'primevue/button';
|
|
14
|
+
import App from './App.vue'
|
|
15
|
+
const app = createApp(App);
|
|
16
|
+
|
|
17
|
+
app.use(PrimeVue);
|
|
18
|
+
app.component('InputText', InputText);
|
|
19
|
+
app.component('Button', Button);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Unplugin
|
|
23
|
+
|
|
24
|
+
The unplugin-vue-components library can automatically import and register PrimeVue components with the help of @primevue/auto-import-resolver . Begin with installing the packages as dev dependencies. Next step would be adding the PrimeVueResolver at vite.config using the Components plugin. That's it, now the initialization code can be refactored as the following. For configuration like namespacing, visit the official documentation .
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
A complete example using PrimeVue with auto imports is available at the playground .
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Install PrimeVue with CDN
|
|
2
|
+
|
|
3
|
+
Setting up PrimeVue in a project using CDN.
|
|
4
|
+
|
|
5
|
+
## Script
|
|
6
|
+
|
|
7
|
+
You can use PrimeVue and Vue.js from a CDN with a script tag. This approach does not involve any build step, and is suitable for enhancing static HTML. This guide uses unpkg however other providers such as jsdeliver and cdnjs can also be used.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
https://unpkg.com/vue@3/dist/vue.global.js
|
|
11
|
+
https://unpkg.com/primevue@5.0.0-rc.2/umd/primevue.min.js
|
|
12
|
+
https://unpkg.com/@primeuix/themes@3.0.0-rc.1/umd/aura.js // see theming for alternatives
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Theming
|
|
16
|
+
|
|
17
|
+
Include the theme preset via a script element after adding PrimeVue, valid options are Aura, Lara, Nora and Material.
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
Get your PrimeUI license key which is required for the setup process.
|
|
22
|
+
|
|
23
|
+
## CreateApp
|
|
24
|
+
|
|
25
|
+
A complete example using a PrimeVue DatePicker.
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<!DOCTYPE html>
|
|
29
|
+
<html lang="en">
|
|
30
|
+
<head>
|
|
31
|
+
<title>PrimeVue + CDN</title>
|
|
32
|
+
<meta charset="UTF-8" />
|
|
33
|
+
<meta name="viewport" content="width=device-width" />
|
|
34
|
+
</head>
|
|
35
|
+
<body>
|
|
36
|
+
<script src="https://unpkg.com/vue@3/dist/vue.global.js"><\/script>
|
|
37
|
+
<script src="https://unpkg.com/primevue/umd/primevue.min.js"><\/script>
|
|
38
|
+
<script src="https://unpkg.com/@primeuix/themes/umd/aura.js"><\/script>
|
|
39
|
+
|
|
40
|
+
<div id="app">
|
|
41
|
+
<p-datepicker v-model="date"></p-datepicker>
|
|
42
|
+
<br /><br />
|
|
43
|
+
{{ date }}
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
const { createApp, ref } = Vue;
|
|
48
|
+
|
|
49
|
+
const app = createApp({
|
|
50
|
+
setup() {
|
|
51
|
+
const date = ref();
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
date
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
app.use(PrimeVue.Config, {
|
|
60
|
+
theme: {
|
|
61
|
+
preset: PrimeUIX.Themes.Aura
|
|
62
|
+
},
|
|
63
|
+
license: 'PRIMEUI-LICENSE-KEY'
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
app.component('p-datepicker', PrimeVue.DatePicker);
|
|
67
|
+
|
|
68
|
+
app.mount('#app');
|
|
69
|
+
<\/script>
|
|
70
|
+
</body>
|
|
71
|
+
</html>
|
|
72
|
+
```
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Application wide configuration for PrimeVue.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
Configuration is managed by the PrimeVue instance imported from primevue/config .
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
import PrimeVue from 'primevue/config';
|
|
11
|
+
const app = createApp(App);
|
|
12
|
+
|
|
13
|
+
app.use(PrimeVue, { /* options */ });
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## License
|
|
17
|
+
|
|
18
|
+
The PrimeUI license key , can be either a free community license or a commercial license.
|
|
19
|
+
|
|
20
|
+
```vue
|
|
21
|
+
import PrimeVue from 'primevue/config';
|
|
22
|
+
import Aura from '@primeuix/themes/aura';
|
|
23
|
+
|
|
24
|
+
const app = createApp(App);
|
|
25
|
+
|
|
26
|
+
app.use(PrimeVue, {
|
|
27
|
+
license: 'PRIMEUI-LICENSE-KEY'
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Theme
|
|
32
|
+
|
|
33
|
+
Style mode offers theming based on a design token based architecture. See the styled mode documentation for details such as building your own theme.
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
import PrimeVue from 'primevue/config';
|
|
37
|
+
import Aura from '@primeuix/themes/aura';
|
|
38
|
+
|
|
39
|
+
const app = createApp(App);
|
|
40
|
+
|
|
41
|
+
app.use(PrimeVue, {
|
|
42
|
+
theme: {
|
|
43
|
+
preset: Aura,
|
|
44
|
+
options: {
|
|
45
|
+
prefix: 'p',
|
|
46
|
+
darkModeSelector: 'system',
|
|
47
|
+
cssLayer: false,
|
|
48
|
+
cssVariables: true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Unstyled
|
|
55
|
+
|
|
56
|
+
Unstyled mode instructs the components not to add any built-in style classes so that they can be styled using custom css or libraries like Tailwind and Bootstrap. Visit Unstyled mode documentation for more information.
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
import { createApp } from "vue";
|
|
60
|
+
import PrimeVue from "primevue/config";
|
|
61
|
+
const app = createApp(App);
|
|
62
|
+
|
|
63
|
+
app.use(PrimeVue, { unstyled: true });
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Pass Through
|
|
67
|
+
|
|
68
|
+
Defines the shared pass through properties per component type. Visit the Pass Through Props documentation for more information.
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
import { createApp } from "vue";
|
|
72
|
+
import PrimeVue from "primevue/config";
|
|
73
|
+
const app = createApp(App);
|
|
74
|
+
|
|
75
|
+
app.use(PrimeVue, {
|
|
76
|
+
pt: {
|
|
77
|
+
slider: {
|
|
78
|
+
handle: { class: 'bg-primary text-primary-contrast' }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Pass Through Options
|
|
85
|
+
|
|
86
|
+
Used to configure the ptOptions properties of components and the usePassThrough method. The mergeSections defines whether the sections from the main configuration gets added and the mergeProps controls whether to override or merge the defined props. Defaults are true for mergeSections and false for mergeProps .
|
|
87
|
+
|
|
88
|
+
```vue
|
|
89
|
+
import { createApp } from "vue";
|
|
90
|
+
import PrimeVue from "primevue/config";
|
|
91
|
+
const app = createApp(App);
|
|
92
|
+
|
|
93
|
+
app.use(PrimeVue, {
|
|
94
|
+
ptOptions: {
|
|
95
|
+
mergeSections: true,
|
|
96
|
+
mergeProps: false
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Ripple
|
|
102
|
+
|
|
103
|
+
Ripple is an optional animation for the supported components such as buttons. It is disabled by default and needs to be enabled at your app's entry file (e.g. main.js) during the PrimeVue setup.
|
|
104
|
+
|
|
105
|
+
```vue
|
|
106
|
+
import { createApp } from "vue";
|
|
107
|
+
import PrimeVue from "primevue/config";
|
|
108
|
+
const app = createApp(App);
|
|
109
|
+
|
|
110
|
+
app.use(PrimeVue, { ripple: true });
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## InputVariant
|
|
114
|
+
|
|
115
|
+
Input fields come in two styles, default is outlined with borders around the field whereas filled alternative adds a background color to the field. Applying p-variant-filled to an ancestor of an input enables the filled style. If you prefer to use filled inputs in the entire application, use a global container such as the document body or the application element to apply the style class. Note that in case you add it to the application element, components that are teleported to the document body such as Dialog will not be able to display filled inputs as they are not a descendant of the application root element in the DOM tree, to resolve this case set inputVariant to filled at PrimeVue configuration as well.
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
import {createApp} from "vue";
|
|
119
|
+
import PrimeVue from "primevue/config";
|
|
120
|
+
const app = createApp(App);
|
|
121
|
+
|
|
122
|
+
app.use(PrimeVue, { inputVariant: "filled" });
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## ZIndex
|
|
126
|
+
|
|
127
|
+
ZIndexes are managed automatically to make sure layering of overlay components work seamlessly when combining multiple components. Still there may be cases where you'd like to configure the configure default values such as a custom layout where header section is fixed. In a case like this, dropdown needs to be displayed below the application header but a modal dialog should be displayed above. PrimeVue configuration offers the zIndex property to customize the default values for components categories. Default values are described below and can be customized when setting up PrimeVue.
|
|
128
|
+
|
|
129
|
+
```vue
|
|
130
|
+
import {createApp} from "vue";
|
|
131
|
+
import PrimeVue from "primevue/config";
|
|
132
|
+
const app = createApp(App);
|
|
133
|
+
|
|
134
|
+
app.use(PrimeVue, {
|
|
135
|
+
zIndex: {
|
|
136
|
+
modal: 1100, //dialog, drawer
|
|
137
|
+
overlay: 1000, //select, popover
|
|
138
|
+
menu: 1000, //overlay menus
|
|
139
|
+
tooltip: 1100 //tooltip
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Nonce
|
|
145
|
+
|
|
146
|
+
The nonce value to use on dynamically generated style elements in core.
|
|
147
|
+
|
|
148
|
+
## Set Locale
|
|
149
|
+
|
|
150
|
+
Second parameter of the use function can be used to initiate the locale during PrimeVue installation. The locale configuration is reactive so that any changes are instantly reflected in the UI. Suppose you are doing a multi language application and need to change the language dynamically.
|
|
151
|
+
|
|
152
|
+
## Repository
|
|
153
|
+
|
|
154
|
+
Ready to use settings for locales are available at the community supported PrimeLocale repository. We'd appreciate if you could contribute to this repository with pull requests and share it with the rest of the community.
|
|
155
|
+
|
|
156
|
+
## API
|
|
157
|
+
|
|
158
|
+
Configuration is managed by the Locale API imported from primevue/config . Locale Options Key Value startsWith Starts with contains Contains notContains Not contains endsWith Ends with equals Equals notEquals Not equals noFilter No Filter lt Less than lte Less than or equal to gt Greater than gte Greater than or equal to dateIs Date is dateIsNot Date is not dateBefore Date is before dateAfter Date is after clear Clear apply Apply matchAll Match All matchAny Match Any addRule Add Rule removeRule Remove Rule accept Yes reject No choose Choose upload Upload cancel Cancel completed Completed pending Pending fileSizeTypes ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] dayNames ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' dayNamesShort ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' dayNamesMin ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' monthNames ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' monthNamesShort ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' chooseYear Choose Year chooseMonth Choose Month chooseDate Choose Date prevDecade Previous Decade nextDecade Next Decade prevYear Previous Year nextYear Next Year prevMonth Previous Month nextMonth Next Month prevHour Previous Hour nextHour Next Hour prevMinute Previous Minute nextMinute Next Minute prevSecond Previous Second nextSecond Next Second am am pm pm today Today weekHeader Wk firstDayOfWeek 0 showMonthAfterYear false dateFormat mm/dd/yy weak Weak medium Medium strong Strong passwordPrompt Enter a password searchMessage {0} results are available selectionMessage {0} items selected emptySelectionMessage No selected item emptySearchMessage No results found fileChosenMessage {0} files noFileChosenMessage No file chosen emptyMessage No available options aria.trueLabel True aria.falseLabel False aria.nullLabel Not Selected aria.star 1 star aria.stars {star} stars aria.selectAll All items selected aria.unselectAll All items unselected aria.close Close aria.previous Previous aria.next Next aria.navigation Navigation aria.scrollTop Scroll Top aria.moveTop Move Top aria.moveUp Move Up aria.moveDown Move Down aria.moveBottom Move Bottom aria.moveToTarget Move to Target aria.moveToSource Move to Source aria.moveAllToTarget Move All to Target aria.moveAllToSource Move All to Source aria.pageLabel Page {page} aria.firstPageLabel First Page aria.lastPageLabel Last Page aria.nextPageLabel Next Page aria.prevPageLabel Previous Page aria.rowsPerPageLabel Rows per page aria.jumpToPageDropdownLabel Jump to Page Dropdown aria.jumpToPageInputLabel Jump to Page Input aria.selectRow Row Selected aria.unselectRow Row Unselected aria.expandRow Row Expanded aria.collapseRow Row Collapsed aria.showFilterMenu Show Filter Menu aria.hideFilterMenu Hide Filter Menu aria.filterOperator Filter Operator aria.filterConstraint Filter Constraint aria.editRow Row Edit aria.saveEdit Save Edit aria.cancelEdit Cancel Edit aria.listView List View aria.gridView Grid View aria.slide Slide aria.slideNumber {slideNumber} aria.zoomImage Zoom Image aria.zoomIn Zoom In aria.zoomOut Zoom Out aria.rotateRight Rotate Right aria.rotateLeft Rotate Left
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Custom Icons
|
|
2
|
+
|
|
3
|
+
PrimeVue components can be used with any icon library using the templating features.
|
|
4
|
+
|
|
5
|
+
## Material
|
|
6
|
+
|
|
7
|
+
Material icons is the official icon library based on Google Material Design.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<Select>
|
|
12
|
+
<template #dropdownicon>
|
|
13
|
+
<span class="material-icons">arrow_drop_down</span>
|
|
14
|
+
</template>
|
|
15
|
+
</Select>
|
|
16
|
+
</template>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## FontAwesome
|
|
20
|
+
|
|
21
|
+
Font Awesome is a popular icon library with a wide range of icons.
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<template>
|
|
25
|
+
<Select>
|
|
26
|
+
<template #dropdownicon>
|
|
27
|
+
<i class="fa-light fa-chevron-down"></i>
|
|
28
|
+
</template>
|
|
29
|
+
</Select>
|
|
30
|
+
</template>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## SVG
|
|
34
|
+
|
|
35
|
+
Inline SVGs are embedded inside the dom.
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<Select>
|
|
40
|
+
<template #dropdownicon>
|
|
41
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
42
|
+
<g id="chevron-down">
|
|
43
|
+
<path d="M12,15.25a.74.74,0,0,1-.53-.22l-5-5A.75.75,0,0,1,7.53,9L12,13.44,16.47,9A.75.75,0,0,1,17.53,10l-5,5A.74.74,0,0,1,12,15.25Z"/>
|
|
44
|
+
</g>
|
|
45
|
+
</svg>
|
|
46
|
+
</template>
|
|
47
|
+
</Select>
|
|
48
|
+
</template>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Image
|
|
52
|
+
|
|
53
|
+
Any type of image can be used as an icon.
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<template>
|
|
57
|
+
<Select>
|
|
58
|
+
<template #dropdownicon>
|
|
59
|
+
<img alt="dropdown icon" src="/assets/icons/arrow_down.png">
|
|
60
|
+
</template>
|
|
61
|
+
</Select>
|
|
62
|
+
</template>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Video Tutorial
|
|
66
|
+
|
|
67
|
+
A video tutorial to demonstrate how to customize icons.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Accessibility
|
|
2
|
+
|
|
3
|
+
PrimeVue has WCAG level compliance, refer to the accessibility documentation of each component for detailed information.
|
|
4
|
+
|
|
5
|
+
## Introduction
|
|
6
|
+
|
|
7
|
+
According to the World Health Organization, 15% of the world population has a disability to some degree. As a result, accessibility features in any context such as a ramp for wheelchair users or a multimedia with captions are crucial to ensure content can be consumed by anyone. Types of disabilities are diverse so you need to know your audience well and how they interact with the content created. There four main categories; Visual Impairments Blindness, low-level vision or color blindness are the common types of visual impairments. Screen magnifiers and the color blind mode are usually built-in features of the browsers whereas for people who rely on screen readers, page developers are required to make sure content is readable by the readers. Popular readers are NVDA , JAWS and ChromeVox . Hearing Impairments Deafness or hearing loss refers to the inability to hear sounds totally or partially. People with hearing impairments use assistive devices however it may not be enough when interacting with a web page. Common implementation is providing textual alternatives, transcripts and captions for content with audio. Mobility Impairments People with mobility impairments have disabilities related to movement due to loss of a limb, paralysis or other varying reasons. Assistive technologies like a head pointer is a device to interact with a screen whereas keyboard or a trackpad remain as solutions for people who are not able to utilize a mouse. Cognitive Impairments Cognitive impairments have a wider range that includes people with learning disabilities, depression and dyslexia. A well designed content also leads to better user experience for people without disabilities so designing for cognitive impairments result in better design for any user.
|
|
8
|
+
|
|
9
|
+
## WCAG
|
|
10
|
+
|
|
11
|
+
Correct page structure with the aid of assistive technologies are the core ingridients for an accessible web content. HTML is based on an accessible foundation, form controls can be used by keyboard by default and semantic HTML is easier to be processed by a screen reader. WCAG refers to Web Content Accessibility Guideline , a standard managed by the WAI (Web Accessibility Initiative) of W3C (World Wide Web Consortium). WCAG consists of recommendations for making the web content more accessible. PrimeVue components aim high level of WCAG compliancy in the near future. Various countries around the globe have governmental policies regarding web accessibility as well. Most well known of these are Section 508 in the US and Web Accessibility Directive of the European Union.
|
|
12
|
+
|
|
13
|
+
## Form Controls
|
|
14
|
+
|
|
15
|
+
Native form elements should be preferred instead of elements that are meant for other purposes like presentation. As an example, button below is rendered as a form control by the browser, can receive focus via tabbing and can be used with space key as well to trigger.
|
|
16
|
+
|
|
17
|
+
## Semantic HTML
|
|
18
|
+
|
|
19
|
+
HTML offers various element to organize content on a web page that screen readers are aware of. Preferring Semantic HTML for good semantics provide out of the box support for reader which is not possible when regular div elements with classes are used. Consider the following example that do not mean too much for readers.
|
|
20
|
+
|
|
21
|
+
## WAI ARIA
|
|
22
|
+
|
|
23
|
+
ARIA refers to "Accessible Rich Internet Applications" is a suite to fill the gap where semantic HTML is inadequate. These cases are mainly related to rich UI components/widgets. Although browser support for rich UI components such as a datepicker or colorpicker has been improved over the past years many web developers still utilize UI components derived from standard HTML elements created by them or by other projects like PrimeVue. These types of components must provide keyboard and screen reader support, the latter case is where the WAI-ARIA is utilized. ARIA consists of roles, properties and attributes. Roles define what the element is mainly used for e.g. checkbox , dialog , tablist whereas States and Properties define the metadata of the element like aria-checked , aria-disabled . Consider the following case of a native checkbox. It has built-in keyboard and screen reader support.
|
|
24
|
+
|
|
25
|
+
## Colors
|
|
26
|
+
|
|
27
|
+
Colors on a web page should aim a contrast ratio of at least 4.5:1 and consider a selection of colors that do not cause vibration. Good Contrast Color contrast between the background and the foreground content should be sufficient enough to ensure readability. Example below displays two cases with good and bad samples. GOOD BAD Vibration Color vibration is leads to an illusion of motion due to choosing colors that have low visibility against each other. Color combinations need to be picked with caution to avoid vibration. VIBRATE Dark Mode Highly saturated colors should be avoided when used within a dark design scheme as they cause eye strain. Instead desaturated colors should be preferred. Indigo 500 Indigo 200
|