@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,497 @@
|
|
|
1
|
+
# Styled Mode
|
|
2
|
+
|
|
3
|
+
Choose from a variety of pre-styled themes or develop your own.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
PrimeVue is a design agnostic library so unlike some other UI libraries it does not enforce a certain styling such as material design. Styling is decoupled from the components using the themes instead. A theme consists of two parts; base and preset . The base is the style rules with CSS variables as placeholders whereas the preset is a set of design tokens to feed a base by mapping the tokens to CSS variables. A base may be configured with different presets, currently Aura, Material, Lara and Nora are the available built-in options. The core of the styled mode architecture is based on a concept named design token , a preset defines the token configuration in 3 tiers; primitive , semantic and component . Learn more about design tokens at the Design Tokens Format Module specification. Primitive Tokens Primitive tokens have no context, a color palette is a good example for a primitive token such as blue-50 to blue-900 . A token named blue-500 may be used as the primary color, the background of a message however on its own, the name of the token does not indicate context. Usually they are utilized by the semantic tokens. Semantic Tokens Semantic tokens define content and their names indicate where they are utilized, a well known example of a semantic token is the primary.color . Semantic tokens map to primitive tokens or other semantic tokens. The colorScheme token group is a special variable to define tokens based on the color scheme active in the application, this allows defining different tokens based on the color scheme like dark mode. Component Tokens Component tokens are isolated tokens per component such as inputtext.background or button.color that map to the semantic tokens. As an example, button.background component token maps to the primary.color semantic token which maps to the green.500 primitive token. Best Practices Use primitive tokens when defining the core color palette and semantic tokens to specify the common design elements such as focus ring, primary colors and surfaces. Components tokens should only be used when customizing a specific component. By defining your own design tokens as a custom preset, you'll be able to define your own style without touching CSS. Overriding the PrimeVue components using style classes is not a best practice and should be the last resort, design tokens are the suggested approach.
|
|
8
|
+
|
|
9
|
+
## Theme
|
|
10
|
+
|
|
11
|
+
The theme property is used to customize the initial theme.
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
import PrimeVue from 'primevue/config';
|
|
15
|
+
import Aura from '@primeuix/themes/aura';
|
|
16
|
+
|
|
17
|
+
const app = createApp(App);
|
|
18
|
+
|
|
19
|
+
app.use(PrimeVue, {
|
|
20
|
+
|
|
21
|
+
theme: {
|
|
22
|
+
preset: Aura,
|
|
23
|
+
// Default options
|
|
24
|
+
options: {
|
|
25
|
+
prefix: 'p',
|
|
26
|
+
darkModeSelector: 'system',
|
|
27
|
+
cssLayer: false,
|
|
28
|
+
cssVariables: true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Options
|
|
35
|
+
|
|
36
|
+
The options property defines the how the CSS would be generated from the design tokens of the preset. prefix The prefix of the CSS variables, defaults to p . For instance, the primary.color design token would be var(--p-primary-color) . darkModeSelector The CSS rule to encapsulate the CSS variables of the dark mode, the default is the system to generate @media (prefers-color-scheme: dark) . If you need to make the dark mode toggleable based on the user selection define a class selector such as .app-dark and toggle this class at the document root. See the dark mode toggle section for an example. cssLayer Defines whether the styles should be defined inside a CSS layer by default or not. A CSS layer would be handy to declare a custom cascade layer for easier customization if necessary. The default is false . cssVariables Controls whether component design tokens are generated as CSS variables or inlined as static values. Primitive and semantic tokens are always generated as CSS variables.
|
|
37
|
+
|
|
38
|
+
## Presets
|
|
39
|
+
|
|
40
|
+
Aura, Material, Lara and Nora are the available built-in options, created to demonstrate the power of the design-agnostic theming. Aura is PrimeTek's own vision, Material follows Google Material Design v2, Lara is based on Bootstrap and Nora is inspired by enterprise applications. Visit the source code to learn more about the structure of presets. You may use them out of the box with modifications or utilize them as reference in case you need to build your own presets from scratch.
|
|
41
|
+
|
|
42
|
+
## Base Font Size
|
|
43
|
+
|
|
44
|
+
PrimeVue sizes its components in rem units relative to the document root font size, which it assumes to be 16px , the browser default. Earlier versions assumed 14px for historical reasons, so to avoid disrupting existing layouts every preset also ships a compat variant calibrated for a 14px root. The compat variants are maintained until June 2027 . When migrating an existing application that uses 14px base font to PrimeVue v5 or newer, the recommended path is to switch to the compat preset first to preserve the current appearance, then set the document root size to 16px and move to the standard (non-compat) preset once the rest of the application has been migrated to the 16px baseline. If your application already uses a 16px document root, no change is required and you can use the standard presets directly. Preset 16px 14px (Legacy) Aura @primeuix/themes/aura @primeuix/themes/aura-compat Lara @primeuix/themes/lara @primeuix/themes/lara-compat Material @primeuix/themes/material @primeuix/themes/material-compat Nora @primeuix/themes/nora @primeuix/themes/nora-compat
|
|
45
|
+
|
|
46
|
+
## Reserved Keys
|
|
47
|
+
|
|
48
|
+
Following keys are reserved in the preset scheme and cannot be used as a token name; primitive , semantic , components , directives , colorscheme , light , dark , common , root , states , and extend .
|
|
49
|
+
|
|
50
|
+
## Colors
|
|
51
|
+
|
|
52
|
+
Color palette of a preset is defined by the primitive design token group. You can access colors using CSS variables or the $dt utility.
|
|
53
|
+
|
|
54
|
+
## Dark Mode
|
|
55
|
+
|
|
56
|
+
PrimeVue uses the system as the default darkModeSelector in theme configuration. If you have a dark mode switch in your application, set the darkModeSelector to the selector you utilize such as .my-app-dark so that PrimeVue can fit in seamlessly with your color scheme. Following is a very basic example implementation of a dark mode switch, you may extend it further by involving prefers-color-scheme to retrieve it from the system initially and use localStorage to make it stateful. See this article for more information. In case you prefer to use dark mode all the time, apply the darkModeSelector initially and never change it. It is also possible to disable dark mode completely using false or none as the value of the selector.
|
|
57
|
+
|
|
58
|
+
## definePreset
|
|
59
|
+
|
|
60
|
+
The definePreset utility is used to customize an existing preset during the PrimeVue setup. The first parameter is the preset to customize and the second is the design tokens to override.
|
|
61
|
+
|
|
62
|
+
```vue
|
|
63
|
+
import PrimeVue from 'primevue/config';
|
|
64
|
+
import { definePreset } from '@primeuix/themes';
|
|
65
|
+
import Aura from '@primeuix/themes/aura';
|
|
66
|
+
|
|
67
|
+
const MyPreset = definePreset(Aura, {
|
|
68
|
+
//Your customizations, see the following sections for examples
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
app.use(PrimeVue, {
|
|
72
|
+
theme: {
|
|
73
|
+
preset: MyPreset
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Color Scheme
|
|
79
|
+
|
|
80
|
+
Tokens can be defined per color scheme using the light-dark keyword, allowing each token to hold scheme-specific values.
|
|
81
|
+
|
|
82
|
+
```vue
|
|
83
|
+
import PrimeVue from 'primevue/config';
|
|
84
|
+
import { definePreset } from '@primeuix/themes';
|
|
85
|
+
import Aura from '@primeuix/themes/aura';
|
|
86
|
+
|
|
87
|
+
const MyPreset = definePreset(Aura, {
|
|
88
|
+
semantic: {
|
|
89
|
+
primary: {
|
|
90
|
+
color: 'light-dark({primary.500}, {primary.400})',
|
|
91
|
+
contrastColor: 'light-dark(#ffffff, {surface.900})'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
app.use(PrimeVue, {
|
|
97
|
+
theme: {
|
|
98
|
+
preset: MyPreset
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Primary
|
|
104
|
+
|
|
105
|
+
The primary defines the main color palette, default value maps to the emerald primitive token. Let's setup to use indigo instead.
|
|
106
|
+
|
|
107
|
+
```vue
|
|
108
|
+
const MyPreset = definePreset(Aura, {
|
|
109
|
+
semantic: {
|
|
110
|
+
primary: {
|
|
111
|
+
50: '{indigo.50}',
|
|
112
|
+
100: '{indigo.100}',
|
|
113
|
+
200: '{indigo.200}',
|
|
114
|
+
300: '{indigo.300}',
|
|
115
|
+
400: '{indigo.400}',
|
|
116
|
+
500: '{indigo.500}',
|
|
117
|
+
600: '{indigo.600}',
|
|
118
|
+
700: '{indigo.700}',
|
|
119
|
+
800: '{indigo.800}',
|
|
120
|
+
900: '{indigo.900}',
|
|
121
|
+
950: '{indigo.950}'
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Surface
|
|
128
|
+
|
|
129
|
+
The color scheme palette that varies between light and dark modes is specified with the surface tokens. Example below uses stone for light mode and zinc for dark mode. With this setting, light mode, would have a grayscale tone and dark mode would include bluish tone.
|
|
130
|
+
|
|
131
|
+
```vue
|
|
132
|
+
const MyPreset = definePreset(Aura, {
|
|
133
|
+
semantic: {
|
|
134
|
+
surface: {
|
|
135
|
+
0: '#ffffff',
|
|
136
|
+
50: 'light-dark({stone.50}, {zinc.50})',
|
|
137
|
+
100: 'light-dark({stone.100}, {zinc.100})',
|
|
138
|
+
200: 'light-dark({stone.200}, {zinc.200})',
|
|
139
|
+
300: 'light-dark({stone.300}, {zinc.300})',
|
|
140
|
+
400: 'light-dark({stone.400}, {zinc.400})',
|
|
141
|
+
500: 'light-dark({stone.500}, {zinc.500})',
|
|
142
|
+
600: 'light-dark({stone.600}, {zinc.600})',
|
|
143
|
+
700: 'light-dark({stone.700}, {zinc.700})',
|
|
144
|
+
800: 'light-dark({stone.800}, {zinc.800})',
|
|
145
|
+
900: 'light-dark({stone.900}, {zinc.900})',
|
|
146
|
+
950: 'light-dark({stone.950}, {zinc.950})'
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Noir
|
|
153
|
+
|
|
154
|
+
The noir mode is a sleek, monochrome variant where the primary color is derived from the neutral surface palette instead of a distinct accent color. The example below maps the primary palette to surface tones and uses the light-dark function to define the light and dark values of the primary and highlight tokens in a single place;
|
|
155
|
+
|
|
156
|
+
```vue
|
|
157
|
+
const Noir = definePreset(Aura, {
|
|
158
|
+
semantic: {
|
|
159
|
+
primary: {
|
|
160
|
+
50: '{surface.50}',
|
|
161
|
+
100: '{surface.100}',
|
|
162
|
+
200: '{surface.200}',
|
|
163
|
+
300: '{surface.300}',
|
|
164
|
+
400: '{surface.400}',
|
|
165
|
+
500: '{surface.500}',
|
|
166
|
+
600: '{surface.600}',
|
|
167
|
+
700: '{surface.700}',
|
|
168
|
+
800: '{surface.800}',
|
|
169
|
+
900: '{surface.900}',
|
|
170
|
+
950: '{surface.950}',
|
|
171
|
+
color: 'light-dark({primary.950}, {primary.50})',
|
|
172
|
+
contrastColor: 'light-dark(#ffffff, {primary.950})',
|
|
173
|
+
hoverColor: 'light-dark({primary.800}, {primary.200})',
|
|
174
|
+
activeColor: 'light-dark({primary.700}, {primary.300})'
|
|
175
|
+
},
|
|
176
|
+
highlight: {
|
|
177
|
+
background: 'light-dark({primary.950}, {primary.50})',
|
|
178
|
+
focusBackground: 'light-dark({primary.700}, {primary.300})',
|
|
179
|
+
color: 'light-dark(#ffffff, {primary.950})',
|
|
180
|
+
focusColor: 'light-dark(#ffffff, {primary.950})'
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Forms
|
|
187
|
+
|
|
188
|
+
The design tokens of the form input components are derived from the form.field token group. This customization example changes border color to primary on hover. Any component that depends on this semantic token such as dropdown.hover.border.color and textarea.hover.border.color would receive the change.
|
|
189
|
+
|
|
190
|
+
```vue
|
|
191
|
+
const MyPreset = definePreset(Aura, {
|
|
192
|
+
semantic: {
|
|
193
|
+
formField: {
|
|
194
|
+
hoverBorderColor: '{primary.color}'
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Focus Ring
|
|
201
|
+
|
|
202
|
+
Focus ring defines the outline width, style, color and offset. Let's use a thicker ring with the primary color for the outline.
|
|
203
|
+
|
|
204
|
+
```vue
|
|
205
|
+
const MyPreset = definePreset(Aura, {
|
|
206
|
+
semantic: {
|
|
207
|
+
focusRing: {
|
|
208
|
+
width: '2px',
|
|
209
|
+
style: 'dashed',
|
|
210
|
+
color: '{primary.color}',
|
|
211
|
+
offset: '1px'
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Component
|
|
218
|
+
|
|
219
|
+
The design tokens of a specific component is defined at components layer. This configuration is global and applies to all card components, in case you need to customize a particular component on a page locally, view the Scoped CSS section for an example. Tip : Overriding component tokens is best suited for small adjustments. For heavy customization, building your own preset is the recommended approach.
|
|
220
|
+
|
|
221
|
+
```vue
|
|
222
|
+
const MyPreset = definePreset(Aura, {
|
|
223
|
+
components: {
|
|
224
|
+
card: {
|
|
225
|
+
root: {
|
|
226
|
+
background: 'light-dark({surface.0}, {surface.900})',
|
|
227
|
+
color: 'light-dark({surface.700}, {surface.0})'
|
|
228
|
+
},
|
|
229
|
+
subtitle: {
|
|
230
|
+
color: 'light-dark({surface.500}, {surface.400})'
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Typography
|
|
238
|
+
|
|
239
|
+
Typography tokens are defined at the semantic level for consistency and at the component level for specialization.
|
|
240
|
+
|
|
241
|
+
```vue
|
|
242
|
+
const MyPreset = definePreset(Aura, {
|
|
243
|
+
semantic: {
|
|
244
|
+
typography: {
|
|
245
|
+
lineHeight: '1.5',
|
|
246
|
+
fontFamily: 'inherit',
|
|
247
|
+
fontWeight: 'normal',
|
|
248
|
+
fontSize: '0.875rem'
|
|
249
|
+
},
|
|
250
|
+
formField: {
|
|
251
|
+
fontWeight: '{typography.font.weight}',
|
|
252
|
+
fontSize: '{typography.font.size}'
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
components: {
|
|
256
|
+
select: {
|
|
257
|
+
fontSize: '{form.field.font.size}',
|
|
258
|
+
fontWeight: '{form.field.font.weight}'
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Extend
|
|
265
|
+
|
|
266
|
+
The theming system can be extended by adding custom design tokens and additional styles. This feature provides a high degree of customization, allowing you to adjust styles according to your needs, as you are not limited to the default tokens. The example preset configuration adds a new accent button with custom button.accent.color and button.accent.inverse.color tokens. It is also possible to add tokens globally to share them within the components.
|
|
267
|
+
|
|
268
|
+
```vue
|
|
269
|
+
const MyPreset = definePreset(Aura, {
|
|
270
|
+
components: {
|
|
271
|
+
// custom button tokens and additional style
|
|
272
|
+
button: {
|
|
273
|
+
extend: {
|
|
274
|
+
accent: {
|
|
275
|
+
color: '#f59e0b',
|
|
276
|
+
inverseColor: '#ffffff'
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
css: ({ dt }) => \`
|
|
280
|
+
.p-button-accent {
|
|
281
|
+
background: \${dt('button.accent.color')};
|
|
282
|
+
color: \${dt('button.accent.inverse.color')};
|
|
283
|
+
transition-duration: \${dt('my.transition.fast')};
|
|
284
|
+
}
|
|
285
|
+
\`
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
// common tokens and styles
|
|
289
|
+
extend: {
|
|
290
|
+
my: {
|
|
291
|
+
transition: {
|
|
292
|
+
slow: '0.75s'
|
|
293
|
+
normal: '0.5s'
|
|
294
|
+
fast: '0.25s'
|
|
295
|
+
},
|
|
296
|
+
imageDisplay: 'block'
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
css: ({ dt }) => \`
|
|
300
|
+
/* Global CSS */
|
|
301
|
+
img {
|
|
302
|
+
display: \${dt('my.image.display')};
|
|
303
|
+
}
|
|
304
|
+
\`
|
|
305
|
+
});
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Scoped Tokens
|
|
309
|
+
|
|
310
|
+
Design tokens can be scoped to a certain component using the dt property. In this example, first switch uses the global tokens whereas second one overrides the global with its own tokens. This approach is recommended over the :deep() as it offers a cleaner API while avoiding the hassle of CSS rule overrides.
|
|
311
|
+
|
|
312
|
+
## usePreset
|
|
313
|
+
|
|
314
|
+
Replaces the current presets entirely, common use case is changing the preset dynamically at runtime.
|
|
315
|
+
|
|
316
|
+
```vue
|
|
317
|
+
import { usePreset } from '@primeuix/themes';
|
|
318
|
+
|
|
319
|
+
const onButtonClick() {
|
|
320
|
+
usePreset(MyPreset);
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## updatePreset
|
|
325
|
+
|
|
326
|
+
Merges the provided tokens to the current preset, an example would be changing the primary color palette dynamically.
|
|
327
|
+
|
|
328
|
+
```vue
|
|
329
|
+
import { updatePreset } from '@primeuix/themes';
|
|
330
|
+
|
|
331
|
+
const changePrimaryColor() {
|
|
332
|
+
updatePreset({
|
|
333
|
+
semantic: {
|
|
334
|
+
primary: {
|
|
335
|
+
50: '{indigo.50}',
|
|
336
|
+
100: '{indigo.100}',
|
|
337
|
+
200: '{indigo.200}',
|
|
338
|
+
300: '{indigo.300}',
|
|
339
|
+
400: '{indigo.400}',
|
|
340
|
+
500: '{indigo.500}',
|
|
341
|
+
600: '{indigo.600}',
|
|
342
|
+
700: '{indigo.700}',
|
|
343
|
+
800: '{indigo.800}',
|
|
344
|
+
900: '{indigo.900}',
|
|
345
|
+
950: '{indigo.950}'
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
})
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## updatePrimaryPalette
|
|
353
|
+
|
|
354
|
+
Updates the primary colors, this is a shorthand to do the same update using updatePreset .
|
|
355
|
+
|
|
356
|
+
```vue
|
|
357
|
+
import { updatePrimaryPalette } from '@primeuix/themes';
|
|
358
|
+
|
|
359
|
+
const changePrimaryColor() {
|
|
360
|
+
updatePrimaryPalette({
|
|
361
|
+
50: '{indigo.50}',
|
|
362
|
+
100: '{indigo.100}',
|
|
363
|
+
200: '{indigo.200}',
|
|
364
|
+
300: '{indigo.300}',
|
|
365
|
+
400: '{indigo.400}',
|
|
366
|
+
500: '{indigo.500}',
|
|
367
|
+
600: '{indigo.600}',
|
|
368
|
+
700: '{indigo.700}',
|
|
369
|
+
800: '{indigo.800}',
|
|
370
|
+
900: '{indigo.900}',
|
|
371
|
+
950: '{indigo.950}'
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## updateSurfacePalette
|
|
377
|
+
|
|
378
|
+
Updates the surface colors, this is a shorthand to do the same update using updatePreset .
|
|
379
|
+
|
|
380
|
+
```vue
|
|
381
|
+
import { updateSurfacePalette } from '@primeuix/themes';
|
|
382
|
+
|
|
383
|
+
const changeSurfaces() {
|
|
384
|
+
//changes surfaces both in light and dark mode
|
|
385
|
+
updateSurfacePalette({
|
|
386
|
+
50: '{zinc.50}',
|
|
387
|
+
// ...
|
|
388
|
+
950: '{zinc.950}'
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const changeLightSurfaces() {
|
|
393
|
+
//changes surfaces only in light
|
|
394
|
+
updateSurfacePalette({
|
|
395
|
+
light: {
|
|
396
|
+
50: '{zinc.50}',
|
|
397
|
+
// ...
|
|
398
|
+
950: '{zinc.950}'
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const changeDarkSurfaces() {
|
|
404
|
+
//changes surfaces only in dark mode
|
|
405
|
+
updateSurfacePalette({
|
|
406
|
+
dark: {
|
|
407
|
+
50: '{zinc.50}',
|
|
408
|
+
// ...
|
|
409
|
+
950: '{zinc.950}'
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## $dt
|
|
416
|
+
|
|
417
|
+
The $dt function returns the information about a token like the full path and value. This would be useful if you need to access tokens programmatically.
|
|
418
|
+
|
|
419
|
+
```vue
|
|
420
|
+
import { $dt } from '@primeuix/themes';
|
|
421
|
+
|
|
422
|
+
const duration = $dt('transition.duration');
|
|
423
|
+
/*
|
|
424
|
+
duration: {
|
|
425
|
+
name: '--transition-duration',
|
|
426
|
+
variable: 'var(--p-transition-duration)',
|
|
427
|
+
value: '0.2s'
|
|
428
|
+
}
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
const primaryColor = $dt('primary.color');
|
|
432
|
+
/*
|
|
433
|
+
primaryColor: {
|
|
434
|
+
name: '--primary-color',
|
|
435
|
+
variable: 'var(--p-primary-color)',
|
|
436
|
+
value: {
|
|
437
|
+
light: {
|
|
438
|
+
value: '#10b981',
|
|
439
|
+
paths: {
|
|
440
|
+
name: 'semantic.primary.color',
|
|
441
|
+
binding: {
|
|
442
|
+
name: 'primitive.emerald.500'
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
dark: {
|
|
447
|
+
value: '#34d399',
|
|
448
|
+
paths: {
|
|
449
|
+
name: 'semantic.primary.color',
|
|
450
|
+
binding: {
|
|
451
|
+
name: 'primitive.emerald.400'
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
*/
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## palette
|
|
461
|
+
|
|
462
|
+
Returns shades and tints of a given color from 50 to 950 as an object.
|
|
463
|
+
|
|
464
|
+
```vue
|
|
465
|
+
import { palette } from '@primeuix/themes';
|
|
466
|
+
|
|
467
|
+
// custom color
|
|
468
|
+
const values1 = palette('#10b981');
|
|
469
|
+
|
|
470
|
+
// copy an existing token set
|
|
471
|
+
const primaryColor = palette('{blue}');
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
## Specificity
|
|
475
|
+
|
|
476
|
+
The @layer is a standard CSS feature to define cascade layers for a customizable order of precedence. If you need to become more familiar with layers, visit the documentation at MDN to begin with. The cssLayer is disabled by default, when it is enabled at theme configuration, PrimeVue wraps the built-in style classes under the primevue cascade layer to make the library styles easy to override. CSS in your app without a layer has the highest CSS specificity, so you'll be able to override styles regardless of the location or how strong a class is written. Layers also make it easier to use CSS Modules, view the CSS Modules guide for examples.
|
|
477
|
+
|
|
478
|
+
## Reset
|
|
479
|
+
|
|
480
|
+
In case PrimeVue components have visual issues in your application, a Reset CSS may be the culprit. CSS layers would be an efficient solution that involves enabling the PrimeVue layer, wrapping the Reset CSS in another layer and defining the layer order. This way, your Reset CSS does not get in the way of PrimeVue components.
|
|
481
|
+
|
|
482
|
+
```vue
|
|
483
|
+
/* Order */
|
|
484
|
+
@layer reset, primevue;
|
|
485
|
+
|
|
486
|
+
/* Reset CSS */
|
|
487
|
+
@layer reset {
|
|
488
|
+
button,
|
|
489
|
+
input {
|
|
490
|
+
/* CSS to Reset */
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## CSS Modules
|
|
496
|
+
|
|
497
|
+
CSS modules are supported by enabling the module property on a style element within your SFC. Use the $style keyword to apply classes to a PrimeVue component. It is recommend to enable cssLayer when using CSS modules so that the PrimeVue styles have low CSS specificity.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Unstyled Mode
|
|
2
|
+
|
|
3
|
+
Theming PrimeVue with alternative styling approaches.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
The term unstyled is used to define an alternative styling approach instead of the default theming with design tokens. In unstyled mode the css variables of the design tokens and the css rule sets that utilize them are not included. Here is an example of an Unstyled Select, the core functionality and accessibility is provided whereas styling is not included. Unstyled components still need to be styled on your end, in the next sections, we'll cover the styling solutions for both modes.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
Unstyled mode is enabled for the whole suite by enabling unstyled option during PrimeVue installation. Alternatively even in the default styled mode, a particular component can still be used as unstyled by adding the unstyled prop of the component. Check
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
Here is a sample that styles a button component with Tailwind CSS using pass through attributes. Before beginning, head over to the the pass through section at button documentation to learn more about the components internals section. We'll style the root element with pass through attributes, and apply utility classes directly to the icon and label placed in the default slot. Search
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<Button unstyled pt:root="bg-teal-500 hover:bg-teal-700 active:bg-teal-900 cursor-pointer py-2 px-4 rounded-full border-0 flex items-center gap-2">
|
|
20
|
+
<Search class="text-white" :size="20" />
|
|
21
|
+
<span class="text-white font-bold text-lg">Search</span>
|
|
22
|
+
</Button>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup>
|
|
26
|
+
import Search from '@primeicons/vue/search';
|
|
27
|
+
<\/script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Global
|
|
31
|
+
|
|
32
|
+
A global configuration can be created at application level to avoid repetition via the global pt option so that the styles can be shared from a single location. A particular component can still override a global configuration with its own pt property.
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
import { createApp } from "vue";
|
|
36
|
+
import PrimeVue from "primevue/config";
|
|
37
|
+
const app = createApp(App);
|
|
38
|
+
|
|
39
|
+
app.use(PrimeVue, {
|
|
40
|
+
unstyled: true,
|
|
41
|
+
pt: {
|
|
42
|
+
button: {
|
|
43
|
+
root: 'bg-teal-500 hover:bg-teal-700 active:bg-teal-900 cursor-pointer py-2 px-4 rounded-full border-0 flex gap-2',
|
|
44
|
+
label: 'text-white font-bold text-lg',
|
|
45
|
+
icon: 'text-white text-xl'
|
|
46
|
+
},
|
|
47
|
+
panel: {
|
|
48
|
+
header: 'bg-primary text-primary-contrast border-primary',
|
|
49
|
+
content: 'border-primary text-lg text-primary-700',
|
|
50
|
+
title: 'bg-primary text-primary-contrast text-xl',
|
|
51
|
+
pcToggleButton: {
|
|
52
|
+
root: 'bg-primary text-primary-contrast hover:text-primary hover:bg-primary-contrast'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Install PrimeVue with Vite
|
|
2
|
+
|
|
3
|
+
Setting up PrimeVue in a Vite project.
|
|
4
|
+
|
|
5
|
+
## Download
|
|
6
|
+
|
|
7
|
+
PrimeVue is available for download on npm registry .
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
# Using npm
|
|
11
|
+
npm install primevue@5.0.0-rc.2 @primeuix/themes@3.0.0-rc.1
|
|
12
|
+
|
|
13
|
+
# Using yarn
|
|
14
|
+
yarn add primevue@5.0.0-rc.2 @primeuix/themes@3.0.0-rc.1
|
|
15
|
+
|
|
16
|
+
# Using pnpm
|
|
17
|
+
pnpm add primevue@5.0.0-rc.2 @primeuix/themes@3.0.0-rc.1
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Plugin
|
|
21
|
+
|
|
22
|
+
PrimeVue plugin is required to be installed as an application plugin to set up the default configuration . The plugin is lightweight, and only utilized for configuration purposes.
|
|
23
|
+
|
|
24
|
+
```vue
|
|
25
|
+
import { createApp } from 'vue';
|
|
26
|
+
import PrimeVue from 'primevue/config';
|
|
27
|
+
import Aura from '@primeuix/themes/aura';
|
|
28
|
+
|
|
29
|
+
const app = createApp(App);
|
|
30
|
+
app.use(PrimeVue, {
|
|
31
|
+
/* Configuration */
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Theme
|
|
36
|
+
|
|
37
|
+
Configure PrimeVue to use a theme like Aura.
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
import { createApp } from 'vue';
|
|
41
|
+
import PrimeVue from 'primevue/config';
|
|
42
|
+
import Aura from '@primeuix/themes/aura';
|
|
43
|
+
|
|
44
|
+
const app = createApp(App);
|
|
45
|
+
app.use(PrimeVue, {
|
|
46
|
+
theme: {
|
|
47
|
+
preset: Aura
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
Provide your PrimeUI license key .
|
|
55
|
+
|
|
56
|
+
```vue
|
|
57
|
+
import { createApp } from 'vue';
|
|
58
|
+
import PrimeVue from 'primevue/config';
|
|
59
|
+
import Aura from '@primeuix/themes/aura';
|
|
60
|
+
|
|
61
|
+
const app = createApp(App);
|
|
62
|
+
app.use(PrimeVue, {
|
|
63
|
+
theme: {
|
|
64
|
+
preset: Aura
|
|
65
|
+
},
|
|
66
|
+
license: 'PRIMEUI-LICENSE-KEY'
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Verify
|
|
71
|
+
|
|
72
|
+
Verify your setup by adding a component such as Button . Each component can be imported and registered individually so that you only include what you use for bundle optimization. Import path is available in the documentation of the corresponding component.
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<template>
|
|
76
|
+
<Button>Verify</Button>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script setup>
|
|
80
|
+
import Button from 'primevue/button';
|
|
81
|
+
<\/script>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Examples
|
|
85
|
+
|
|
86
|
+
We've created various samples for the popular options in the Vue ecosystem. Visit the primevue-examples repository for more samples including vite-quickstart and vite-ts-quickstart .
|
|
87
|
+
|
|
88
|
+
## Next Steps
|
|
89
|
+
|
|
90
|
+
Welcome to the Prime UI Ecosystem! Once you have PrimeVue up and running, we recommend exploring the following resources to gain a deeper understanding of the library. Global configuration Auto imports with tree-shaking Customization of styles Pass through attributes
|