@primereact/mcp 11.0.0 → 11.1.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/data/llms/headless/components/sidebar/api.json +1029 -54
- package/data/llms/headless/guides/misc/internationalization.md +282 -0
- package/data/llms/headless/guides/misc/locale.md +280 -0
- package/data/llms/llms-full.txt +9822 -1377
- package/data/llms/llms.txt +15 -0
- package/data/llms/primitive/components/sidebar/api.json +127 -33
- package/data/llms/primitive/guides/migration/updating-to-v11.md +2219 -0
- package/data/llms/primitive/guides/misc/internationalization.md +287 -0
- package/data/llms/primitive/guides/misc/locale.md +280 -0
- package/data/llms/styled/add-ons/designer/ci.md +273 -0
- package/data/llms/styled/add-ons/designer/guide.md +99 -0
- package/data/llms/styled/add-ons/designer/overview.md +194 -0
- package/data/llms/styled/add-ons/uikit/guide/v3.md +181 -0
- package/data/llms/styled/add-ons/uikit/guide/v4.md +163 -0
- package/data/llms/styled/add-ons/uikit/overview.md +204 -0
- package/data/llms/styled/components/datatable.md +8 -5
- package/data/llms/styled/components/menu.md +39 -41
- package/data/llms/styled/guides/configuration.md +198 -0
- package/data/llms/styled/guides/form/formik.md +448 -0
- package/data/llms/styled/guides/form/react-hook-form.md +503 -0
- package/data/llms/styled/guides/form/tanstack.md +502 -0
- package/data/llms/styled/guides/migration/updating-to-v11.md +2219 -0
- package/data/llms/styled/guides/misc/internationalization.md +379 -0
- package/data/llms/styled/guides/misc/locale.md +280 -0
- package/data/llms/tailwind/components/menu.md +5 -5
- package/data/llms/tailwind/components/tooltip.md +4 -13
- package/data/llms/tailwind/guides/misc/internationalization.md +287 -0
- package/data/llms/tailwind/guides/misc/locale.md +280 -0
- package/data/manifest.json +339 -24
- package/data/mcp-data.json +263 -8
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2219 @@
|
|
|
1
|
+
# Updating to v11
|
|
2
|
+
|
|
3
|
+
A component by component guide to moving an application from PrimeReact v10 to v11.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
PrimeReact v11 is a rewrite. Components are now function components built on hooks, styling moved to a design token system, and features that used to be props are now composed from parts.
|
|
8
|
+
|
|
9
|
+
The scale is smaller than that makes it sound. Of the 101 components in v10, **54 keep the same name in v11**. Most of the work is mechanical: new import paths, a compound API in place of long prop lists, and a different way of loading themes.
|
|
10
|
+
|
|
11
|
+
The sections below start with what affects every component, then work through the components themselves.
|
|
12
|
+
|
|
13
|
+
## Why migrate
|
|
14
|
+
|
|
15
|
+
Most v10 projects hit the same wall eventually. A design comes back with a badge next to a menu item, a footer button in a dropdown panel, one column header styled differently to the rest. None of it is hard, but none of it is a prop either, so it turns into a template function that hands markup back to the component, or a CSS selector aimed at a `p-*` class and a note to check it after the next upgrade.
|
|
16
|
+
|
|
17
|
+
v11 exports the parts instead. The menu item, the dropdown footer, the header cell are elements in the tree, so they take a class, a ref, an event handler, whatever the situation needs. Icons are children rather than class name strings, which means any icon library works without a template per instance.
|
|
18
|
+
|
|
19
|
+
Theming changed for the same reason. v10 themes were compiled SASS: a colour change meant a rebuild, and anything the variables missed meant writing CSS against class names that were never really part of the API. v11 uses design tokens, so values change at runtime and can be scoped to the whole app, one subtree or a single component.
|
|
20
|
+
|
|
21
|
+
The other difference is that styling is separable now. The unstyled components, the themed ones and the headless hooks are separate packages, so a project takes the layer it wants rather than the markup and the CSS together.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
v11 ships as several packages instead of one.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @primereact/ui @primeuix/themes
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Nothing needs to be uninstalled. The `primereact` package is now the unstyled primitive layer, and `@primereact/ui` depends on it. Removing it would break the install.
|
|
32
|
+
|
|
33
|
+
Three packages sit on top of each other, and an application picks the level it wants to work at.
|
|
34
|
+
|
|
35
|
+
| Package | What it provides | Renders DOM | Styled |
|
|
36
|
+
| ---------------------- | ----------------------------------------------------- | ----------- | ------ |
|
|
37
|
+
| `@primereact/headless` | State, events and accessibility as hooks | No | No |
|
|
38
|
+
| `primereact` | Primitive components built on those hooks | Yes | No |
|
|
39
|
+
| `@primereact/ui` | The same primitives with `@primereact/styles` applied | Yes | Yes |
|
|
40
|
+
|
|
41
|
+
Applications coming from v10 want `@primereact/ui`. It is the closest match to what v10 shipped: components that look finished without extra work. Reach for `primereact` when building a custom design system, and `@primereact/headless` when the markup is hand-written.
|
|
42
|
+
|
|
43
|
+
Both import paths resolve to the same component underneath:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { Button } from '@primereact/ui/button'; // themed
|
|
47
|
+
import { Button } from 'primereact/button'; // unstyled
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
A few more packages come along as dependencies. They rarely need to be installed directly, but they show up in imports and in type errors, so it helps to know what each one is.
|
|
51
|
+
|
|
52
|
+
| Package | Role |
|
|
53
|
+
| -------------------- | ---------------------------------------------------------------------------------- |
|
|
54
|
+
| `@primereact/core` | The provider, configuration, theming runtime and locale registry |
|
|
55
|
+
| `@primereact/hooks` | Standalone hooks such as `useMask`, `useKeyFilter`, `useFilter` and `useScrollTop` |
|
|
56
|
+
| `@primereact/styles` | The class name definitions `@primereact/ui` applies |
|
|
57
|
+
| `@primereact/types` | Type definitions for props, instances and pass-through options |
|
|
58
|
+
| `@primeuix/themes` | Token presets: Aura, Material, Lara, Nora |
|
|
59
|
+
|
|
60
|
+
Two of these are worth importing directly. `@primereact/core` holds `PrimeReactProvider` and the locale API, and `@primereact/hooks` holds the behaviour that used to live inside components like InputMask and KeyFilter.
|
|
61
|
+
|
|
62
|
+
Setup for Next.js, Vite, Astro, React Router and TanStack is covered in the [installation guide](/docs/styled/guides/installation).
|
|
63
|
+
|
|
64
|
+
## Theming
|
|
65
|
+
|
|
66
|
+
The v10 stylesheet imports no longer exist:
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
// v10. None of these resolve in v11.
|
|
70
|
+
import 'primereact/resources/themes/lara-light-cyan/theme.css';
|
|
71
|
+
import 'primereact/resources/primereact.min.css';
|
|
72
|
+
import 'primeflex/primeflex.css';
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The `primereact/resources` folder is gone, and with it the 56 prebuilt theme files and the `changeTheme()` helper. PrimeFlex is no longer part of the setup.
|
|
76
|
+
|
|
77
|
+
Themes come from `@primeuix/themes` as design token presets, applied through the provider:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { PrimeReactProvider } from '@primereact/core';
|
|
81
|
+
import Aura from '@primeuix/themes/aura';
|
|
82
|
+
|
|
83
|
+
<PrimeReactProvider theme={{ preset: Aura }}>
|
|
84
|
+
<App />
|
|
85
|
+
</PrimeReactProvider>;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Aura, Material, Lara and Nora ship as built-in presets.
|
|
89
|
+
|
|
90
|
+
### Why the model changed
|
|
91
|
+
|
|
92
|
+
Theming in v10 meant compiling SASS. A custom theme started as a copy of `theme.scss`, overrode a list of variables, and produced a CSS file that had to be rebuilt and shipped whenever anything changed. Adjusting one component usually meant hunting for the right selector, and anything the variables did not cover fell back to writing CSS against `p-*` classes and hoping those class names survived the next release.
|
|
93
|
+
|
|
94
|
+
The token model removes the build step. A preset is a plain object, evaluated at runtime into CSS variables, so there is no SASS toolchain and no compiled artifact to keep in sync.
|
|
95
|
+
|
|
96
|
+
Tokens are organised in three tiers, and knowing which tier to reach for is most of the learning curve:
|
|
97
|
+
|
|
98
|
+
| Tier | What it holds | Example |
|
|
99
|
+
| ------------- | ---------------------------------------------- | -------------------------------------------------- |
|
|
100
|
+
| **Primitive** | A raw palette with no meaning attached | `blue.500`, `zinc.100` |
|
|
101
|
+
| **Semantic** | Roles that map to primitives | `primary.color`, `surface.200`, `focus.ring.width` |
|
|
102
|
+
| **Component** | Per-component values that map to semantic ones | `button.root.borderRadius`, `card.subtitle.color` |
|
|
103
|
+
|
|
104
|
+
Changing one semantic token moves everything built on it. Setting `primary.color` recolours buttons, checkboxes, focus rings, links and progress bars in one line, where the SASS approach meant tracking down every place the old primary was used.
|
|
105
|
+
|
|
106
|
+
### What this makes possible
|
|
107
|
+
|
|
108
|
+
#### Dark mode in the same value
|
|
109
|
+
|
|
110
|
+
A token can carry both schemes at once with `light-dark()`, and `darkModeSelector` decides which one applies:
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
background: 'light-dark({surface.300}, {surface.700})';
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
v10 needed a separate compiled theme file per scheme.
|
|
117
|
+
|
|
118
|
+
#### Theme switching at runtime
|
|
119
|
+
|
|
120
|
+
Presets are objects, so changing theme is a state change. No stylesheet to swap, no flash while a new CSS file loads.
|
|
121
|
+
|
|
122
|
+
#### Overriding a single instance
|
|
123
|
+
|
|
124
|
+
Every component takes a `dt` prop for tokens scoped to that instance alone:
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
<ToggleSwitch.Root
|
|
128
|
+
defaultChecked
|
|
129
|
+
dt={{
|
|
130
|
+
root: {
|
|
131
|
+
checkedBackground: 'light-dark({amber.500}, {amber.400})',
|
|
132
|
+
checkedHoverBackground: 'light-dark({amber.600}, {amber.300})'
|
|
133
|
+
},
|
|
134
|
+
handle: {
|
|
135
|
+
checkedBackground: 'light-dark({amber.50}, {amber.900})'
|
|
136
|
+
}
|
|
137
|
+
}}
|
|
138
|
+
>
|
|
139
|
+
…
|
|
140
|
+
</ToggleSwitch.Root>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The keys are the component's own token sections. ToggleSwitch defines `root` and `handle`, and those are exactly the names a preset uses for the same component:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { definePreset } from '@primeuix/themes';
|
|
147
|
+
import Aura from '@primeuix/themes/aura';
|
|
148
|
+
|
|
149
|
+
// The same shape, applied globally instead of to one instance.
|
|
150
|
+
definePreset(Aura, {
|
|
151
|
+
components: {
|
|
152
|
+
toggleswitch: {
|
|
153
|
+
root: { checkedBackground: 'light-dark({amber.500}, {amber.400})' }
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
So `dt` is the preset syntax scoped to a single element. In v10 this meant a wrapper class plus a CSS override, with the dark mode rules written out a second time.
|
|
160
|
+
|
|
161
|
+
#### Updating tokens from code
|
|
162
|
+
|
|
163
|
+
`updatePreset`, `updatePrimaryPalette` and `updateSurfacePalette` change tokens after mount. A theme customizer or a per-tenant brand colour needs exactly that. `$dt` reads a token value when a calculation needs it.
|
|
164
|
+
|
|
165
|
+
#### Working from design tools
|
|
166
|
+
|
|
167
|
+
Tokens follow the [Design Tokens Format Module](https://www.designtokens.org/tr/drafts/format/) specification, so the same names exist in code and in design.
|
|
168
|
+
|
|
169
|
+
- The [Figma UI Kit](/docs/styled/add-ons/uikit/overview) uses these names, so a change made by a designer maps to the token a developer edits instead of being translated by hand.
|
|
170
|
+
- The [Theme Designer](/docs/styled/add-ons/designer/guide) edits tokens through a UI and exports a preset. With SASS this was not possible, since a theme only existed once compiled.
|
|
171
|
+
|
|
172
|
+
### Moving existing customizations
|
|
173
|
+
|
|
174
|
+
| v10 | Where it goes in v11 |
|
|
175
|
+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
176
|
+
| A SASS theme built from `theme.scss` | Variable overrides become token overrides in a preset. A rewrite, but usually a much shorter file, since a preset only lists what differs from the base. |
|
|
177
|
+
| CSS overrides against `p-*` classes | Still work. The class names survived. Keep them as the fallback, since a token reaches every component that uses it while a selector reaches one. |
|
|
178
|
+
| `changeTheme(current, next, linkId, cb)` | Gone. There is no `<link>` tag to swap. Pass a different preset to the provider. |
|
|
179
|
+
| Scale set with a font size on `:root` | A token, so it no longer depends on the cascade. |
|
|
180
|
+
| PrimeFlex classes | Not part of the setup. Any utility library works, since components do not depend on one. |
|
|
181
|
+
|
|
182
|
+
The [styled mode guide](/docs/styled/guides/theming/styled) covers `definePreset`, the full token reference, dark mode setup and the update utilities.
|
|
183
|
+
|
|
184
|
+
### Unstyled mode
|
|
185
|
+
|
|
186
|
+
v10 had one way to get unstyled components: the `unstyled` flag, set globally or per component. Both still work, and v11 adds two more entry points.
|
|
187
|
+
|
|
188
|
+
| Approach | When it fits |
|
|
189
|
+
| ---------------------------------- | ----------------------------------------------------------------------------- |
|
|
190
|
+
| `<PrimeReactProvider unstyled>` | The whole application is styled by something else |
|
|
191
|
+
| `unstyled` on a component | Most of the app is themed, one screen is not |
|
|
192
|
+
| Import from `primereact` | Building a design system on the primitives, with no theme layer in the bundle |
|
|
193
|
+
| Import from `@primereact/headless` | Hand-written markup as well as hand-written styling |
|
|
194
|
+
|
|
195
|
+
The last two are the difference from v10. There, unstyled mode meant the styled component with its class generation switched off, so the theming layer still shipped. In v11 the layers are separate packages, so importing from `primereact` means the styles never enter the bundle at all.
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
// Themed, then opted out for one instance.
|
|
199
|
+
import { Select } from '@primereact/ui/select';
|
|
200
|
+
<Select.Root unstyled />;
|
|
201
|
+
|
|
202
|
+
// Unstyled by construction. No theme layer involved.
|
|
203
|
+
import { Select } from 'primereact/select';
|
|
204
|
+
|
|
205
|
+
// No markup either. The hook returns state and prop getters.
|
|
206
|
+
import { useSelect } from '@primereact/headless/select';
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
All three render the same behaviour and the same accessibility attributes. They differ only in how much of the visual layer comes along.
|
|
210
|
+
|
|
211
|
+
### Pass Through
|
|
212
|
+
|
|
213
|
+
`pt`, `ptOptions` and `unstyled` all survived, and they work the same way.
|
|
214
|
+
|
|
215
|
+
What changed is what the slot keys point at. In v10 a `pt` key was the only handle on an internal element: `panel`, `wrapper`, `itemLabel`. In v11 that element is an exported part, so `pt` is one of two ways in, and usually the longer one.
|
|
216
|
+
|
|
217
|
+
```jsx
|
|
218
|
+
// v10. pt was the only way in.
|
|
219
|
+
<Dropdown pt={{ panel: { className: 'shadow-xl' } }} />
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
```jsx
|
|
223
|
+
// v11. The part takes props directly.
|
|
224
|
+
<Select.Popup className="shadow-xl" />
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
`pt` still earns its place for global configuration, where it applies to every instance of a component type through the provider. So a v10 `pt` preset needs its keys remapped to the new part names, while per-component uses are usually clearer as props on the part.
|
|
228
|
+
|
|
229
|
+
`ptOptions` with `mergeSections` and `mergeProps` carries over unchanged.
|
|
230
|
+
|
|
231
|
+
## Configuration
|
|
232
|
+
|
|
233
|
+
The global `PrimeReact` object from `primereact/api` is gone. It was already deprecated in v10. All configuration goes through `PrimeReactProvider`.
|
|
234
|
+
|
|
235
|
+
```jsx
|
|
236
|
+
// v10. Static assignment, or the provider's value object.
|
|
237
|
+
import PrimeReact from 'primereact/api';
|
|
238
|
+
PrimeReact.inputStyle = 'filled';
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```jsx
|
|
242
|
+
// v11
|
|
243
|
+
<PrimeReactProvider inputVariant="filled">
|
|
244
|
+
<App />
|
|
245
|
+
</PrimeReactProvider>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### What carried over
|
|
249
|
+
|
|
250
|
+
| v10 option | v11 |
|
|
251
|
+
| ------------------------ | ---------------------------------------------------------------- |
|
|
252
|
+
| `locale` | Same |
|
|
253
|
+
| `pt`, `ptOptions` | Same |
|
|
254
|
+
| `unstyled` | Same |
|
|
255
|
+
| `filterMatchModeOptions` | Same |
|
|
256
|
+
| `zIndex` | Same, minus the `toast` key. Toasts are positioned by `Toaster`. |
|
|
257
|
+
| `nonce` | `csp.nonce` |
|
|
258
|
+
| `inputStyle` | `inputVariant`, with the same `'outlined'` and `'filled'` values |
|
|
259
|
+
|
|
260
|
+
### What was dropped
|
|
261
|
+
|
|
262
|
+
| v10 option | Status |
|
|
263
|
+
| --------------------------------- | -------------------------------------------------------------------- |
|
|
264
|
+
| `appendTo` | Portals are explicit. `<Select.Portal>` and friends take the target. |
|
|
265
|
+
| `cssTransition` | Animation is CSS and the `Motion` primitive |
|
|
266
|
+
| `autoZIndex` | Handled by the overlay stack |
|
|
267
|
+
| `hideOverlaysOnDocumentScrolling` | Overlays reposition on scroll instead of hiding |
|
|
268
|
+
| `nullSortOrder` | Moved onto DataTable as a component prop |
|
|
269
|
+
| `styleContainer` | Replaced by `stylesheet` for SSR collection |
|
|
270
|
+
| `changeTheme()` | Themes are presets passed to the provider |
|
|
271
|
+
| `ripple` | Not supported in v11 |
|
|
272
|
+
|
|
273
|
+
### What is new
|
|
274
|
+
|
|
275
|
+
| v11 option | Purpose |
|
|
276
|
+
| ------------ | -------------------------------------------------- |
|
|
277
|
+
| `theme` | The design token preset and its options |
|
|
278
|
+
| `license` | Commercial license key |
|
|
279
|
+
| `stylesheet` | SSR style collection, used by the Next.js setup |
|
|
280
|
+
| `locales` | Register languages and select one in a single step |
|
|
281
|
+
| `defaults` | Default props per component type, application-wide |
|
|
282
|
+
| `csp` | `{ nonce }` for Content Security Policy |
|
|
283
|
+
|
|
284
|
+
`defaults` is new and useful during a migration. Instead of wrapping a component to change what it does by default, set it once on the provider:
|
|
285
|
+
|
|
286
|
+
```jsx
|
|
287
|
+
<PrimeReactProvider defaults={{ Button: { props: { size: 'small', severity: 'secondary' } } }}>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Event handlers work here as well, and they run alongside the one at the call site instead of replacing it, which suits cross-cutting concerns like analytics. The key is the component's registered name, and for compound components four spellings are accepted: `Checkbox.Root`, `CheckboxRoot`, a nested `{ Checkbox: { Root } }`, or lowercase.
|
|
291
|
+
|
|
292
|
+
## Locale
|
|
293
|
+
|
|
294
|
+
The locale helpers from `primereact/api` were replaced.
|
|
295
|
+
|
|
296
|
+
```js
|
|
297
|
+
// v10
|
|
298
|
+
import { locale, addLocale, updateLocaleOption, updateLocaleOptions, localeOption, localeOptions } from 'primereact/api';
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
```js
|
|
302
|
+
// v11
|
|
303
|
+
import { $t, $l, defineLocale, updateLocale, useLocale, Locale, LocaleService, en } from '@primereact/core/locale';
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
| v10 | v11 |
|
|
307
|
+
| -------------------------------------- | -------------------------------------------------------- |
|
|
308
|
+
| `locale('de')` | `Locale.use('de')`, or the `locale` prop on the provider |
|
|
309
|
+
| `addLocale('es', {…})` | `defineLocale('es', {…})` |
|
|
310
|
+
| `updateLocaleOption(key, value, lang)` | `updateLocale(lang, { key: value })` |
|
|
311
|
+
| `updateLocaleOptions({…}, lang)` | `updateLocale(lang, {…})` |
|
|
312
|
+
| `localeOption(key)` | `$t(key)`, or `t(key)` from `useLocale()` |
|
|
313
|
+
| `localeOptions(lang)` | `$l().get(lang)`, or `messages` from `useLocale()` |
|
|
314
|
+
|
|
315
|
+
Two things changed beyond the names. Locale state is now shared with other Prime libraries running in the same application, where before it was private to PrimeReact. And a registered language has to be complete: any key left out resolves to `undefined` instead of falling back to English, so hand-written translations should spread the exported `en` object first.
|
|
316
|
+
|
|
317
|
+
Component-level `locale` props are gone. DatePicker took one in v10. In v11 month names, day names, `firstDayOfWeek` and `dateFormat` all come from the active language.
|
|
318
|
+
|
|
319
|
+
The [internationalization guide](/docs/styled/guides/misc/internationalization) covers the full API, including ready-made translations from the PrimeLocale repository.
|
|
320
|
+
|
|
321
|
+
## Icons
|
|
322
|
+
|
|
323
|
+
v10 took icons as class name strings, which meant an icon font had to be loaded first:
|
|
324
|
+
|
|
325
|
+
```js
|
|
326
|
+
import 'primeicons/primeicons.css';
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
```jsx
|
|
330
|
+
<Button icon="pi pi-check" label="Save" />
|
|
331
|
+
<Menu model={[{ label: 'New', icon: 'pi pi-plus' }]} />
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
v11 components do not ship icons and do not import any icon package. Every icon in a v11 interface is supplied by the application:
|
|
335
|
+
|
|
336
|
+
```jsx
|
|
337
|
+
<Button>
|
|
338
|
+
<Check /> Save
|
|
339
|
+
</Button>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Where `Check` comes from is entirely up to the project. Lucide, Heroicons, Font Awesome, a hand-drawn SVG, an emoji or an `<img>` all work the same way, because the component only positions whatever it is handed.
|
|
343
|
+
|
|
344
|
+
That is also why `primeicons/primeicons.css` and the `pi pi-*` class strings leave the setup, along with the `PrimeIcons` constant that used to provide autocomplete over icon names.
|
|
345
|
+
|
|
346
|
+
### PrimeIcons as an option
|
|
347
|
+
|
|
348
|
+
The PrimeIcons set is still available, now as React components instead of a font:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
npm install @primeicons/react
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
```jsx
|
|
355
|
+
import { Check } from '@primeicons/react/check';
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
This is the package the showcase demos use, so examples throughout the documentation import from it. Nothing depends on it. Swapping in another icon library means changing the import, not the component.
|
|
359
|
+
|
|
360
|
+
It also behaves better than the font did: only the icons actually imported end up in the bundle, and an icon is a normal React element, so it takes `className`, `style`, event handlers and a `ref` like anything else.
|
|
361
|
+
|
|
362
|
+
## The Three Structural Changes
|
|
363
|
+
|
|
364
|
+
Almost every difference in the component sections below traces back to one of these.
|
|
365
|
+
|
|
366
|
+
### Class components became function components
|
|
367
|
+
|
|
368
|
+
v10 components were ES6 classes, so a `ref` gave back an instance with public methods:
|
|
369
|
+
|
|
370
|
+
```jsx
|
|
371
|
+
// v10
|
|
372
|
+
const toast = useRef(null);
|
|
373
|
+
toast.current.show({ severity: 'info', summary: 'Info' });
|
|
374
|
+
|
|
375
|
+
const dt = useRef(null);
|
|
376
|
+
dt.current.exportCSV();
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
v11 has no imperative instance API. What used to be a method call is now either state or a headless hook. Each component section below names the specific replacement. This is usually the most invasive part of a migration, because it changes how surrounding code is organized, not just how a component is written.
|
|
380
|
+
|
|
381
|
+
### Configuration by props became composition
|
|
382
|
+
|
|
383
|
+
A v10 component absorbed every feature as a prop. `DataTable` accepted around 149 of them, `Calendar` around 100, `Dropdown` around 70.
|
|
384
|
+
|
|
385
|
+
v11 splits that surface into parts:
|
|
386
|
+
|
|
387
|
+
```jsx
|
|
388
|
+
// v10
|
|
389
|
+
<Dropdown value={city} options={cities} optionLabel="name" placeholder="Select a City" onChange={(e) => setCity(e.value)} />
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
```jsx
|
|
393
|
+
// v11
|
|
394
|
+
<Select.Root value={city} options={cities} optionLabel="name" onValueChange={(e) => setCity(e.value)}>
|
|
395
|
+
<Select.Trigger>
|
|
396
|
+
<Select.Value placeholder="Select a City" />
|
|
397
|
+
<Select.Indicator>
|
|
398
|
+
<ChevronDown />
|
|
399
|
+
</Select.Indicator>
|
|
400
|
+
</Select.Trigger>
|
|
401
|
+
<Select.Portal>
|
|
402
|
+
<Select.Positioner>
|
|
403
|
+
<Select.Popup>
|
|
404
|
+
<Select.List />
|
|
405
|
+
</Select.Popup>
|
|
406
|
+
</Select.Positioner>
|
|
407
|
+
</Select.Portal>
|
|
408
|
+
</Select.Root>
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
The version underneath is longer because elements that were previously reachable only through `panelClassName`, `dropdownIcon` or `itemTemplate` are now written out, and each accepts props, refs and children. Data and behaviour props stayed on `Root`; the rest moved into parts, listed per component further down.
|
|
412
|
+
|
|
413
|
+
#### What the prop model could not do
|
|
414
|
+
|
|
415
|
+
The cost of the old approach shows up in requests that sound simple and had no clean answer:
|
|
416
|
+
|
|
417
|
+
- **A sticky action row at the bottom of a dropdown panel.** `panelFooterTemplate` returned markup, but it could not be given a `ref` to measure, or a scroll handler, or a `data-*` hook for tests. In v11 it is `<Select.Popup>` with a `<Select.Footer>` next to `<Select.List>`, and both are elements like any other.
|
|
418
|
+
- **A tooltip on one specific menu item.** The `model` array had no place for it. `item.template` meant rebuilding the whole item, losing the built-in keyboard handling. In v11 the item is JSX, so it can be wrapped in a `Tooltip` directly.
|
|
419
|
+
- **Rendering the popup somewhere other than the body.** `appendTo` took a target, but the subtree still moved invisibly. Anything that depended on where it landed, stacking context, focus order, click-outside checks, had to be reverse-engineered. `<Select.Portal>` puts that decision in the markup.
|
|
420
|
+
- **Styling the third column of a table header differently.** A `headerClassName` string applied to all of them. `<DataTable.THeadCell>` is a `<th>`, so ordinary CSS applies.
|
|
421
|
+
- **Replacing an icon with a spinner while loading.** `dropdownIcon` accepted a class name, and `loadingIcon` accepted another, but only if the component's own `loading` prop was driving it. `<Select.Indicator>` takes children, so the choice belongs to whatever state the application already has.
|
|
422
|
+
|
|
423
|
+
None of these needed a new prop in v11.
|
|
424
|
+
|
|
425
|
+
### Content comes from children
|
|
426
|
+
|
|
427
|
+
The third change follows from the second. Anything a v10 component accepted as a string or a template function is now written as children.
|
|
428
|
+
|
|
429
|
+
```jsx
|
|
430
|
+
// v10
|
|
431
|
+
<Button icon="pi pi-check" label="Save" />
|
|
432
|
+
<Card title="Report" footer={<Button label="Export" />}>Body</Card>
|
|
433
|
+
<Dropdown itemTemplate={(o) => <b>{o.name}</b>} />
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
```jsx
|
|
437
|
+
// v11
|
|
438
|
+
<Button><Check /> Save</Button>
|
|
439
|
+
<Card.Root>
|
|
440
|
+
<Card.Title>Report</Card.Title>
|
|
441
|
+
<Card.Content>Body</Card.Content>
|
|
442
|
+
<Card.Footer><Button>Export</Button></Card.Footer>
|
|
443
|
+
</Card.Root>
|
|
444
|
+
<Select.Option><b>{option.name}</b></Select.Option>
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
Labels, icons, headers, footers and item templates were all separate mechanisms in v10, each with its own prop and its own rules about what it accepted. In v11 they are the same mechanism: children of the part that owns that position.
|
|
448
|
+
|
|
449
|
+
## Keeping the v10 Component Shape
|
|
450
|
+
|
|
451
|
+
Compound components are more verbose at the call site. When an application has hundreds of `<Dropdown />` usages, rewriting each one into six nested parts is rarely worth it.
|
|
452
|
+
|
|
453
|
+
A thin wrapper restores the old shape while keeping the new internals. Create a file for the component, assemble the parts once, and forward the props:
|
|
454
|
+
|
|
455
|
+
```tsx title="components/select.tsx"
|
|
456
|
+
'use client';
|
|
457
|
+
import { ChevronDown } from '@primeicons/react';
|
|
458
|
+
import { Select as PRSelect, type SelectRootProps } from '@primereact/ui/select';
|
|
459
|
+
|
|
460
|
+
export function Select({ placeholder, ...props }: SelectRootProps & { placeholder?: string }) {
|
|
461
|
+
return (
|
|
462
|
+
<PRSelect.Root {...props}>
|
|
463
|
+
<PRSelect.Trigger>
|
|
464
|
+
<PRSelect.Value placeholder={placeholder} />
|
|
465
|
+
<PRSelect.Indicator>
|
|
466
|
+
<ChevronDown />
|
|
467
|
+
</PRSelect.Indicator>
|
|
468
|
+
</PRSelect.Trigger>
|
|
469
|
+
<PRSelect.Portal>
|
|
470
|
+
<PRSelect.Positioner>
|
|
471
|
+
<PRSelect.Popup>
|
|
472
|
+
<PRSelect.List />
|
|
473
|
+
</PRSelect.Popup>
|
|
474
|
+
</PRSelect.Positioner>
|
|
475
|
+
</PRSelect.Portal>
|
|
476
|
+
</PRSelect.Root>
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Call sites then look much like they did in v10:
|
|
482
|
+
|
|
483
|
+
```jsx
|
|
484
|
+
<Select value={city} options={cities} optionLabel="name" placeholder="Select a City" onValueChange={(e) => setCity(e.value)} />
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
The Tailwind variant of PrimeReact is built exactly this way. `packages/tailwind/src/select.tsx` wraps the primitive parts, bakes in the chevron and check icons, and re-exports them as named components. It is a good file to read before writing one.
|
|
488
|
+
|
|
489
|
+
The wrapper stays escapable. Any part not baked into it can still be passed as children, and the underlying parts remain importable for the screens that need full control. Migration can then proceed screen by screen instead of in one pass.
|
|
490
|
+
|
|
491
|
+
## Controlled State
|
|
492
|
+
|
|
493
|
+
The naming convention is consistent across every component in v11:
|
|
494
|
+
|
|
495
|
+
| Concept | v10 | v11 |
|
|
496
|
+
| ------- | ----------------------------- | ------------------------------------------------ |
|
|
497
|
+
| Value | `value` + `onChange` | `value` + `defaultValue` + `onValueChange` |
|
|
498
|
+
| Checked | `checked` + `onChange` | `checked` + `defaultChecked` + `onCheckedChange` |
|
|
499
|
+
| Open | `visible` + `onHide` | `open` + `defaultOpen` + `onOpenChange` |
|
|
500
|
+
| Active | `activeIndex` + `onTabChange` | `value` + `defaultValue` + `onValueChange` |
|
|
501
|
+
|
|
502
|
+
Every controlled prop now has a `default*` counterpart, so uncontrolled usage no longer needs a `useState` that exists only to satisfy the component. The mode is also locked at mount: a component that starts uncontrolled stays uncontrolled even if a value arrives later.
|
|
503
|
+
|
|
504
|
+
The event payload is familiar. Handlers still receive an event object, not a bare value:
|
|
505
|
+
|
|
506
|
+
```jsx
|
|
507
|
+
// v10
|
|
508
|
+
onChange={(e) => setCity(e.value)}
|
|
509
|
+
|
|
510
|
+
// v11
|
|
511
|
+
onValueChange={(e) => setCity(e.value)}
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
What changed is the prop name and the type name, `DropdownChangeEvent` became `SelectValueChangeEvent`. The `e.value` / `e.originalEvent` shape carried over.
|
|
515
|
+
|
|
516
|
+
## TypeScript
|
|
517
|
+
|
|
518
|
+
v10 exported a flat set of types per component: `DropdownProps`, `DropdownChangeEvent`, `DropdownPassThroughOptions`, plus the component class. v11 types follow the parts and ship from the same module as the component, so one import covers both:
|
|
519
|
+
|
|
520
|
+
```tsx
|
|
521
|
+
import { Select, type SelectRootProps, type SelectValueChangeEvent } from '@primereact/ui/select';
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
Names follow the same shape everywhere:
|
|
525
|
+
|
|
526
|
+
| Kind | Pattern | Example |
|
|
527
|
+
| -------- | -------------------------------- | ------------------------ |
|
|
528
|
+
| Props | `<Component><Part>Props` | `SelectRootProps` |
|
|
529
|
+
| Event | `<Component><Part><Action>Event` | `SelectValueChangeEvent` |
|
|
530
|
+
| Instance | `<Component><Part>Instance` | `SelectRootInstance` |
|
|
531
|
+
|
|
532
|
+
Instance types come up more often than they did in v10. A render-prop child receives one, so the function inside `<Select.List>` or `<DataTable.TBody>` is typed against the part's instance.
|
|
533
|
+
|
|
534
|
+
A couple of v10 habits no longer apply. Component classes are gone, so `React.RefObject<Dropdown>` becomes an element ref or an instance type. The shared `FormEvent<T>` base is gone too, and each event type stands on its own.
|
|
535
|
+
|
|
536
|
+
## Templates
|
|
537
|
+
|
|
538
|
+
Every `*Template` prop in v10 has a compound part in v11:
|
|
539
|
+
|
|
540
|
+
```jsx
|
|
541
|
+
// v10
|
|
542
|
+
<Dropdown itemTemplate={(option) => <div>{option.name}</div>} valueTemplate={selectedTemplate} panelFooterTemplate={footer} />
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
```jsx
|
|
546
|
+
// v11
|
|
547
|
+
<Select.List>
|
|
548
|
+
{categories.map((cat, index) => (
|
|
549
|
+
<Select.Option key={cat.value} index={index} uKey={cat.value}>
|
|
550
|
+
<span>{cat.label}</span>
|
|
551
|
+
<Tag severity="secondary" rounded>
|
|
552
|
+
{cat.count}
|
|
553
|
+
</Tag>
|
|
554
|
+
</Select.Option>
|
|
555
|
+
))}
|
|
556
|
+
</Select.List>
|
|
557
|
+
<Select.Footer>…</Select.Footer>
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
The part receives the same data the template did, but as a real element: it accepts `className`, `ref`, event handlers and its own children. Leaving `<Select.List />` empty renders the options from `Root` with no markup to write, and a function child is available when the list needs the component's own state, such as filtered results.
|
|
561
|
+
|
|
562
|
+
Pass Through survived alongside templates and is covered under [Theming](#pass-through). The v10 Dropdown exposed keys like `panel`, `wrapper` and `itemLabel`, while the v11 Select exposes its parts, `root`, `trigger`, `value`, `popup`, `list`, `option`. The [Pass Through guide](/docs/styled/guides/misc/passthrough) documents the current shape.
|
|
563
|
+
|
|
564
|
+
## Components
|
|
565
|
+
|
|
566
|
+
The sections below are in alphabetical order, under the v10 name so an existing codebase can be worked through as it reads. Each one lists what carried over unchanged, what was renamed, what became a part, and what has no counterpart.
|
|
567
|
+
|
|
568
|
+
Components not listed here kept their name and their props, and only need the new import path.
|
|
569
|
+
|
|
570
|
+
### Accordion
|
|
571
|
+
|
|
572
|
+
[Component documentation](/docs/styled/components/accordion)
|
|
573
|
+
|
|
574
|
+
Accordion changed the same way Tabs did: panels are addressed by `value` instead of index.
|
|
575
|
+
|
|
576
|
+
```jsx
|
|
577
|
+
// v11
|
|
578
|
+
<Accordion.Root defaultValue="first">
|
|
579
|
+
<Accordion.Panel value="first">
|
|
580
|
+
<Accordion.Header>
|
|
581
|
+
<Accordion.Trigger>Header I</Accordion.Trigger>
|
|
582
|
+
</Accordion.Header>
|
|
583
|
+
<Accordion.Content>…</Accordion.Content>
|
|
584
|
+
</Accordion.Panel>
|
|
585
|
+
</Accordion.Root>
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
`multiple` and `tabIndex` carry over. `activeIndex` → `value`, `onTabChange` → `onValueChange`, and `AccordionTab` → `<Accordion.Panel>`. The `expandIcon` / `collapseIcon` pair became `<Accordion.Indicator>`, or an icon inside the trigger styled by open state.
|
|
589
|
+
|
|
590
|
+
`onTabOpen` and `onTabClose` collapsed into `onValueChange`. New: root-level `disabled` and `openOnFocus`.
|
|
591
|
+
|
|
592
|
+
### AutoComplete
|
|
593
|
+
|
|
594
|
+
[Component documentation](/docs/styled/components/autocomplete)
|
|
595
|
+
|
|
596
|
+
Parts: Root, Input, Value, Trigger, Indicator, Arrow, Clear, Portal, Positioner, Popup, List, Option, OptionIndicator, Header, Footer, Empty.
|
|
597
|
+
|
|
598
|
+
Carried over: value, disabled, invalid, name, multiple, autoFocus, minLength, delay, forceSelection, optionGroupLabel, optionGroupChildren.
|
|
599
|
+
|
|
600
|
+
These renames touch every AutoComplete usage:
|
|
601
|
+
|
|
602
|
+
| v10 | v11 |
|
|
603
|
+
| ----------------- | -------------------- |
|
|
604
|
+
| `suggestions` | `options` |
|
|
605
|
+
| `completeMethod` | `onComplete` |
|
|
606
|
+
| `field` | `optionLabel` |
|
|
607
|
+
| `onChange` (text) | `onInputValueChange` |
|
|
608
|
+
| `onChange` (pick) | `onValueChange` |
|
|
609
|
+
|
|
610
|
+
The last two are the ones to watch. v10 routed both the typed text and the selection through a single `onChange`; v11 separates them.
|
|
611
|
+
|
|
612
|
+
| v10 | v11 |
|
|
613
|
+
| ----------------------------------------- | -------------------------------------------------------- |
|
|
614
|
+
| `dropdown`, `dropdownIcon` | `<AutoComplete.Trigger>` with `<AutoComplete.Indicator>` |
|
|
615
|
+
| `itemTemplate` | `<AutoComplete.Option>` |
|
|
616
|
+
| `selectedItemTemplate`, `removeTokenIcon` | `<AutoComplete.Value>` |
|
|
617
|
+
| `emptyMessage` | `<AutoComplete.Empty>` |
|
|
618
|
+
| `panelFooterTemplate` | `<AutoComplete.Footer>` |
|
|
619
|
+
| Input-level props | `<AutoComplete.Input as={InputText}>` |
|
|
620
|
+
|
|
621
|
+
Dropped: selectionLimit, virtualScrollerOptions, dropdownAutoFocus, transitionOptions.
|
|
622
|
+
|
|
623
|
+
The ref methods `focus()`, `getInput()`, `getOverlay()` are gone. Element access goes through refs on the individual parts.
|
|
624
|
+
|
|
625
|
+
### Avatar
|
|
626
|
+
|
|
627
|
+
[Component documentation](/docs/styled/components/avatar)
|
|
628
|
+
|
|
629
|
+
Parts: Root, Image, Fallback.
|
|
630
|
+
|
|
631
|
+
`image` and `imageAlt` became `<Avatar.Image>`, and `label` and `icon` became `<Avatar.Fallback>`. Which is also what `imageFallback` and `onImageError` turn into, since the fallback now renders when the image fails without needing a callback.
|
|
632
|
+
|
|
633
|
+
`shape` and `size` moved to the styled layer. `template` is gone because children cover it.
|
|
634
|
+
|
|
635
|
+
### Breadcrumb
|
|
636
|
+
|
|
637
|
+
[Component documentation](/docs/styled/components/breadcrumb)
|
|
638
|
+
|
|
639
|
+
```jsx
|
|
640
|
+
// v10
|
|
641
|
+
<BreadCrumb model={items} home={{ icon: 'pi pi-home', url: '/' }} />
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
```jsx
|
|
645
|
+
// v11
|
|
646
|
+
<Breadcrumb.Root>
|
|
647
|
+
<Breadcrumb.List>
|
|
648
|
+
<Breadcrumb.Item>
|
|
649
|
+
<Breadcrumb.Link href="/">
|
|
650
|
+
<Home />
|
|
651
|
+
</Breadcrumb.Link>
|
|
652
|
+
</Breadcrumb.Item>
|
|
653
|
+
<Breadcrumb.Separator />
|
|
654
|
+
<Breadcrumb.Item>
|
|
655
|
+
<Breadcrumb.Current>Current Page</Breadcrumb.Current>
|
|
656
|
+
</Breadcrumb.Item>
|
|
657
|
+
</Breadcrumb.List>
|
|
658
|
+
</Breadcrumb.Root>
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
Parts: Root, List, Item, Link, Current, Separator, Ellipsis.
|
|
662
|
+
|
|
663
|
+
The `model` array is gone. Items are written as markup, which is the pattern across the whole menu family in v11. A breadcrumb link can be a Next.js `<Link>`, a router link, or anything else, instead of a `url` string the component turns into an anchor.
|
|
664
|
+
|
|
665
|
+
`home` has no separate concept; the first item is the home item. `separatorIcon` became `<Breadcrumb.Separator>`, and an `Ellipsis` part was added for truncating long trails.
|
|
666
|
+
|
|
667
|
+
### Button
|
|
668
|
+
|
|
669
|
+
[Component documentation](/docs/styled/components/button)
|
|
670
|
+
|
|
671
|
+
Button is still a single element, not a compound component, so only props changed.
|
|
672
|
+
|
|
673
|
+
```jsx
|
|
674
|
+
// v10
|
|
675
|
+
<Button label="Save" icon="pi pi-check" severity="secondary" outlined />
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
```jsx
|
|
679
|
+
// v11
|
|
680
|
+
<Button severity="secondary" variant="outlined">
|
|
681
|
+
<Check /> Save
|
|
682
|
+
</Button>
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
`label` is gone. The text is children now, which is also what makes icon placement work without a dedicated prop. To put an icon after the text, write it after the text; `iconPos` has no v11 counterpart because ordering is expressed directly.
|
|
686
|
+
|
|
687
|
+
The three appearance booleans collapsed into one prop. `text`, `outlined` and `link` in v10 were separate flags that could contradict each other; v11 has `variant="text" | "outlined" | "link"`, and leaving it off gives the filled button.
|
|
688
|
+
|
|
689
|
+
Carried over unchanged: `severity`, `size`, `disabled`, `rounded`, `raised`, `plain`.
|
|
690
|
+
|
|
691
|
+
New in v11: `iconOnly`, which handles the square icon-button shape, and `fluid` for full width.
|
|
692
|
+
|
|
693
|
+
Two v10 props moved out of Button entirely. `badge` and `badgeClassName` became the `OverlayBadge` component wrapped around the button, and `tooltip` / `tooltipOptions` became the `Tooltip` component wrapped around the trigger:
|
|
694
|
+
|
|
695
|
+
```jsx
|
|
696
|
+
<OverlayBadge>
|
|
697
|
+
<Button iconOnly variant="text" severity="secondary" rounded aria-label="Notifications">
|
|
698
|
+
<Bell />
|
|
699
|
+
</Button>
|
|
700
|
+
<Badge severity="danger" shape="circle" size="small">
|
|
701
|
+
3
|
|
702
|
+
</Badge>
|
|
703
|
+
</OverlayBadge>
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
More markup for the simple case, but the badge is no longer restricted to buttons, and it takes the full Badge API (severity, shape, size) instead of the single string `badge` accepted.
|
|
707
|
+
|
|
708
|
+
### Calendar → DatePicker
|
|
709
|
+
|
|
710
|
+
[Component documentation](/docs/styled/components/datepicker)
|
|
711
|
+
|
|
712
|
+
Calendar carried around 100 props. DatePicker splits them across roughly 40 parts, so the mapping is long, but the pattern is the same as Select: data and behaviour stayed, appearance moved.
|
|
713
|
+
|
|
714
|
+
**Unchanged.** Date and time behaviour is untouched.
|
|
715
|
+
|
|
716
|
+
dateFormat, selectionMode, numberOfMonths, view, minDate, maxDate, showTime, timeOnly, hourFormat, stepHour, stepMinute, stepSecond, showSeconds, showWeek, selectOtherMonths, showOnFocus, autoFocus, disabled, name
|
|
717
|
+
|
|
718
|
+
**Renamed.**
|
|
719
|
+
|
|
720
|
+
| v10 | v11 |
|
|
721
|
+
| ------------------- | --------------- |
|
|
722
|
+
| `onChange` | `onValueChange` |
|
|
723
|
+
| `onSelect` | `onDateSelect` |
|
|
724
|
+
| `visible` | `open` |
|
|
725
|
+
| `onShow` / `onHide` | `onOpenChange` |
|
|
726
|
+
| `readOnlyInput` | `manualInput` |
|
|
727
|
+
|
|
728
|
+
**Moved into parts.**
|
|
729
|
+
|
|
730
|
+
| v10 | v11 |
|
|
731
|
+
| ----------------------- | ----------------------------------------------------------------------------------------- |
|
|
732
|
+
| `showIcon`, `icon` | `<DatePicker.Trigger>` |
|
|
733
|
+
| `dateTemplate` | Children of `<DatePicker.TableBodyCell>` |
|
|
734
|
+
| `headerTemplate` | `<DatePicker.Header>` |
|
|
735
|
+
| `footerTemplate` | `<DatePicker.Footer>` |
|
|
736
|
+
| `showButtonBar` | `<DatePicker.Buttonbar>` with `<DatePicker.Today>` and `<DatePicker.ClearTrigger>` |
|
|
737
|
+
| `monthNavigator` | `<DatePicker.SelectMonth>` |
|
|
738
|
+
| `yearNavigator` | `<DatePicker.SelectYear>` |
|
|
739
|
+
| `prevIcon` / `nextIcon` | Children of `<DatePicker.Prev>` / `<DatePicker.Next>` |
|
|
740
|
+
| `inline` | Drop the `Portal`, `Positioner` and `Popup` wrappers, render `<DatePicker.Body>` directly |
|
|
741
|
+
|
|
742
|
+
**Dropped.**
|
|
743
|
+
|
|
744
|
+
disabledDates, disabledDays, enabledDates, yearRange, mask, maskSlotChar, keepInvalid, showOtherMonths, hideOnRangeSelection, showMillisec, viewDate
|
|
745
|
+
|
|
746
|
+
**New.** `updateModelType`, `timeSeparator`, `onYearChange`, `closeOnEscape`, `trapped`, `fluid`, plus month and year grids through `<DatePicker.TableBody view="month">`.
|
|
747
|
+
|
|
748
|
+
`locale` is no longer a component prop. Month names, day names, `firstDayOfWeek` and `dateFormat` come from the global locale registry. See the [internationalization guide](/docs/styled/guides/misc/internationalization).
|
|
749
|
+
|
|
750
|
+
### Card
|
|
751
|
+
|
|
752
|
+
[Component documentation](/docs/styled/components/card)
|
|
753
|
+
|
|
754
|
+
```jsx
|
|
755
|
+
// v10
|
|
756
|
+
<Card title="Title" subTitle="Subtitle" header={<img src="…" />} footer={<Button label="Save" />}>
|
|
757
|
+
Content
|
|
758
|
+
</Card>
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
```jsx
|
|
762
|
+
// v11
|
|
763
|
+
<Card.Root>
|
|
764
|
+
<Card.Header>
|
|
765
|
+
<img src="…" />
|
|
766
|
+
</Card.Header>
|
|
767
|
+
<Card.Body>
|
|
768
|
+
<Card.Caption>
|
|
769
|
+
<Card.Title>Title</Card.Title>
|
|
770
|
+
<Card.Subtitle>Subtitle</Card.Subtitle>
|
|
771
|
+
</Card.Caption>
|
|
772
|
+
<Card.Content>Content</Card.Content>
|
|
773
|
+
<Card.Footer>
|
|
774
|
+
<Button>Save</Button>
|
|
775
|
+
</Card.Footer>
|
|
776
|
+
</Card.Body>
|
|
777
|
+
</Card.Root>
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
Parts: Root, Header, Body, Caption, Title, Subtitle, Content, Footer.
|
|
781
|
+
|
|
782
|
+
Every v10 prop was a slot in disguise, so all five: `title`, `subTitle`, `header`, `footer` and children, became parts. Card has no behavioural props left.
|
|
783
|
+
|
|
784
|
+
### Carousel
|
|
785
|
+
|
|
786
|
+
[Component documentation](/docs/styled/components/carousel)
|
|
787
|
+
|
|
788
|
+
Parts: Root, Content, Item, Prev, Next, Indicators, Indicator.
|
|
789
|
+
|
|
790
|
+
v11's Carousel is built on CSS scroll snapping, which changes several props: `circular` → `loop`, `numVisible` → `slidesPerPage`, and `responsiveOptions` is gone because breakpoints are ordinary responsive CSS now. New props follow the scroll-snap model: `align`, `snapType`, `spacing`, `autoSize`.
|
|
791
|
+
|
|
792
|
+
`value` with `itemTemplate` became explicit `<Carousel.Item>` children. `showNavigators` and `showIndicators` became the presence of `<Carousel.Prev>` / `<Carousel.Next>` and `<Carousel.Indicators>`.
|
|
793
|
+
|
|
794
|
+
Autoplay was dropped: `autoplayInterval` and the `startAutoplay()` / `stopAutoplay()` methods have no counterpart, so an auto-advancing carousel is a timer calling `onPageChange`.
|
|
795
|
+
|
|
796
|
+
### Checkbox
|
|
797
|
+
|
|
798
|
+
[Component documentation](/docs/styled/components/checkbox)
|
|
799
|
+
|
|
800
|
+
```jsx
|
|
801
|
+
// v10
|
|
802
|
+
<Checkbox checked={checked} onChange={(e) => setChecked(e.checked)} />
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
```jsx
|
|
806
|
+
// v11
|
|
807
|
+
<Checkbox.Root checked={checked} onCheckedChange={(e) => setChecked(e.checked)}>
|
|
808
|
+
<Checkbox.Box>
|
|
809
|
+
<Checkbox.Indicator match="checked">
|
|
810
|
+
<Check />
|
|
811
|
+
</Checkbox.Indicator>
|
|
812
|
+
</Checkbox.Box>
|
|
813
|
+
</Checkbox.Root>
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
Parts: Root, Box, Indicator.
|
|
817
|
+
|
|
818
|
+
Carried over: checked, value, name, disabled, readOnly, required, tabIndex, invalid, inputId, trueValue, falseValue.
|
|
819
|
+
|
|
820
|
+
`onChange` became `onCheckedChange`.
|
|
821
|
+
|
|
822
|
+
The `icon` prop became `<Checkbox.Indicator match="checked">`. The `match` prop shows up across the library: an indicator renders only in the state it names. A checkbox can carry separate marks for `checked`, `unchecked` and `indeterminate` without a single conditional.
|
|
823
|
+
|
|
824
|
+
New: `defaultChecked`, `indeterminate`, `size`, `variant`. Grouping is handled by the `CheckboxGroup` component instead of wiring `name` and state by hand.
|
|
825
|
+
|
|
826
|
+
### Chip
|
|
827
|
+
|
|
828
|
+
[Component documentation](/docs/styled/components/chip)
|
|
829
|
+
|
|
830
|
+
Parts: Root, Start, Label, End, Remove.
|
|
831
|
+
|
|
832
|
+
```jsx
|
|
833
|
+
// v11
|
|
834
|
+
<Chip.Root>
|
|
835
|
+
<Chip.Label>Apple</Chip.Label>
|
|
836
|
+
<Chip.Remove>
|
|
837
|
+
<Times />
|
|
838
|
+
</Chip.Remove>
|
|
839
|
+
</Chip.Root>
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
`label` → `<Chip.Label>`, `icon` and `image` → `<Chip.Start>`, `removable` and `removeIcon` → `<Chip.Remove>`. The `Start` and `End` parts accept anything, so an avatar, a badge or a spinner can sit in a chip without a template prop.
|
|
843
|
+
|
|
844
|
+
### Chips → InputTags
|
|
845
|
+
|
|
846
|
+
[Component documentation](/docs/styled/components/inputtags)
|
|
847
|
+
|
|
848
|
+
```jsx
|
|
849
|
+
// v10
|
|
850
|
+
<Chips value={value} onChange={(e) => setValue(e.value)} />
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
Parts: Root, Items, Control.
|
|
854
|
+
|
|
855
|
+
Unchanged: value, disabled, invalid, variant, max, allowDuplicate, addOnBlur, name, onAdd, onRemove.
|
|
856
|
+
|
|
857
|
+
`separator` became `delimiter`.
|
|
858
|
+
|
|
859
|
+
The chip markup is now a render-prop on `<InputTags.Items>`, which receives each item plus its remove handler, and the text input is supplied through `<InputTags.Control>`. That is why `removable` and `removeIcon` disappeared: both are decided by whatever the render-prop returns, usually `Chip.Root` / `Chip.Label` / `Chip.Remove`.
|
|
860
|
+
|
|
861
|
+
New: `inputValue` / `defaultInputValue` / `onInputValueChange` for controlling the text buffer, plus `addOnPaste` and `addOnTab`.
|
|
862
|
+
|
|
863
|
+
### ColorPicker → InputColor
|
|
864
|
+
|
|
865
|
+
[Component documentation](/docs/styled/components/inputcolor)
|
|
866
|
+
|
|
867
|
+
The rename understates the change: v10 shipped one saturation box with a hue strip, v11 exposes the pieces.
|
|
868
|
+
|
|
869
|
+
Parts: Root, Area, AreaBackground, AreaHandle, Slider, SliderTrack, SliderHandle, Swatch, SwatchBackground, TransparencyGrid, Input, EyeDropper.
|
|
870
|
+
|
|
871
|
+
| v10 | v11 |
|
|
872
|
+
| -------------- | ------------------------------------------------------ |
|
|
873
|
+
| `value` | Same |
|
|
874
|
+
| `format` | Same, but the default changed from `'hex'` to `'hsba'` |
|
|
875
|
+
| `onChange` | `onValueChange` |
|
|
876
|
+
| `defaultColor` | `defaultValue`, taking `parseColor('#276def')` |
|
|
877
|
+
|
|
878
|
+
Two defaults changed in ways that are easy to miss: `format` defaults to `'hsba'` instead of `'hex'`, and the component renders inline. The v10 popup form is built by wrapping `<InputColor.Root>` in a `Popover`, which is where `appendTo`, `panelClassName` and `onShow`/`onHide` went.
|
|
879
|
+
|
|
880
|
+
New: alpha and hue sliders through `<InputColor.Slider channel="alpha">`, a channel-bound text input through `<InputColor.Input channel="hex">` (also `rgb`, `hsl`, `oklch` channels), `<InputColor.EyeDropper>`, `<InputColor.TransparencyGrid>`, and `onValueChangeEnd` for committing only when a drag finishes.
|
|
881
|
+
|
|
882
|
+
### ConfirmDialog
|
|
883
|
+
|
|
884
|
+
[Confirmation example](/docs/styled/components/dialog#confirmation)
|
|
885
|
+
|
|
886
|
+
There is no `ConfirmDialog` component and no `confirmDialog()` service. Two replacements, depending on which part of v10's behaviour matters.
|
|
887
|
+
|
|
888
|
+
For a confirm attached to a trigger, compose a Dialog, `<Dialog.Content>` for the message, two `<Dialog.Close as={Button}>` for accept and reject. The `confirmation-demo` under Dialog shows it.
|
|
889
|
+
|
|
890
|
+
For the imperative case, a confirm raised from arbitrary code, `createOverlayManager` from `@primereact/core/overlay-manager` produces an `open(key, payload)` function and a `<Viewport />` to render into. It is a factory rather than a prebuilt confirm, so the payload type and the dialog markup are defined once in application code.
|
|
891
|
+
|
|
892
|
+
`accept`, `reject`, `acceptLabel`, `rejectLabel` and their icon and class variants are gone; those are props on the two buttons now.
|
|
893
|
+
|
|
894
|
+
### DataTable
|
|
895
|
+
|
|
896
|
+
[Component documentation](/docs/styled/components/datatable)
|
|
897
|
+
|
|
898
|
+
DataTable is the biggest change in the library. v10 exposed roughly 149 props on the table plus a `<Column>` component with its own set. v11 spreads the same functionality across more than 40 parts.
|
|
899
|
+
|
|
900
|
+
```jsx
|
|
901
|
+
// v10
|
|
902
|
+
<DataTable value={products} paginator rows={10}>
|
|
903
|
+
<Column field="code" header="Code" sortable />
|
|
904
|
+
<Column field="name" header="Name" body={(row) => <b>{row.name}</b>} />
|
|
905
|
+
</DataTable>
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
```jsx
|
|
909
|
+
// v11
|
|
910
|
+
<DataTable.Root data={products}>
|
|
911
|
+
<DataTable.TableContainer>
|
|
912
|
+
<DataTable.Table>
|
|
913
|
+
<DataTable.THead>
|
|
914
|
+
<DataTable.THeadRow>
|
|
915
|
+
<DataTable.THeadCell>
|
|
916
|
+
<DataTable.THeadTitle>Code</DataTable.THeadTitle>
|
|
917
|
+
</DataTable.THeadCell>
|
|
918
|
+
<DataTable.THeadCell>
|
|
919
|
+
<DataTable.THeadTitle>Name</DataTable.THeadTitle>
|
|
920
|
+
</DataTable.THeadCell>
|
|
921
|
+
</DataTable.THeadRow>
|
|
922
|
+
</DataTable.THead>
|
|
923
|
+
<DataTable.TBody>
|
|
924
|
+
{({ item }) => (
|
|
925
|
+
<DataTable.Row key={item.id}>
|
|
926
|
+
<DataTable.Cell>{item.code}</DataTable.Cell>
|
|
927
|
+
<DataTable.Cell>
|
|
928
|
+
<b>{item.name}</b>
|
|
929
|
+
</DataTable.Cell>
|
|
930
|
+
</DataTable.Row>
|
|
931
|
+
)}
|
|
932
|
+
</DataTable.TBody>
|
|
933
|
+
</DataTable.Table>
|
|
934
|
+
</DataTable.TableContainer>
|
|
935
|
+
</DataTable.Root>
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
#### Why `<Column>` had to go
|
|
939
|
+
|
|
940
|
+
v10's Column was not a component. The entire source file was this:
|
|
941
|
+
|
|
942
|
+
```js
|
|
943
|
+
export const Column = () => {};
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
It rendered nothing. DataTable walked `props.children` with `React.Children.toArray`, read `column.props` off each element, and built the table itself. `<Column>` was a configuration object wearing JSX syntax.
|
|
947
|
+
|
|
948
|
+
That distinction explains a set of limitations that were hard to work around:
|
|
949
|
+
|
|
950
|
+
- **Columns could not be extracted into their own file.** A `<PriceColumn />` that returned a `<Column>` broke the table, because DataTable was looking for `__TYPE: 'Column'` on its direct children, not for whatever a custom component rendered. Column definitions had to be written inline, in one place, every time.
|
|
951
|
+
- **Columns could not be composed or reused.** No wrapper, no `map` over a shared column config that returned custom components, no conditional column built from a helper. The only reuse available was copying props between call sites.
|
|
952
|
+
- **Column markup was limited to what `body` returned.** The `<td>` itself belonged to DataTable. Adding a `colSpan`, a `ref`, a `data-*` attribute or an event handler to the cell was not possible, only to what went inside it.
|
|
953
|
+
- **Headers were strings or a `header` template.** Anything beyond text meant a template function, and that function could not reach the `<th>` element around it.
|
|
954
|
+
|
|
955
|
+
In v11, `<DataTable.Cell>` is a `<td>` and `<DataTable.THeadCell>` is a `<th>`. A column is markup, so it can live in another file, be produced by a loop, wrapped by a component, or rendered conditionally:
|
|
956
|
+
|
|
957
|
+
```jsx
|
|
958
|
+
// A reusable column component. Not possible in v10.
|
|
959
|
+
function PriceCell({ value }) {
|
|
960
|
+
return <DataTable.Cell className="text-right tabular-nums">{value.toLocaleString('en-US', { style: 'currency', currency: 'USD' })}</DataTable.Cell>;
|
|
961
|
+
}
|
|
962
|
+
```
|
|
963
|
+
|
|
964
|
+
#### Column props became parts
|
|
965
|
+
|
|
966
|
+
| v10 `<Column>` prop | v11 |
|
|
967
|
+
| ----------------------- | ----------------------------------------------------- |
|
|
968
|
+
| `field`, `header` | `<DataTable.THeadCell>` with `<DataTable.THeadTitle>` |
|
|
969
|
+
| `body` | Children of `<DataTable.Cell>` |
|
|
970
|
+
| `footer` | `<DataTable.TFootCell>` |
|
|
971
|
+
| `sortable` | `<DataTable.Sort>` with `<DataTable.SortIndicator>` |
|
|
972
|
+
| `filter` and its family | `<DataTable.Filter>` |
|
|
973
|
+
| `selectionMode` | `<DataTable.Selection>` |
|
|
974
|
+
| `expander` | `<DataTable.RowToggle>` |
|
|
975
|
+
| `rowEditor` | `<DataTable.RowEditor>` |
|
|
976
|
+
| `editor` | `<DataTable.CellEditor>` |
|
|
977
|
+
| `rowReorder` | `<DataTable.RowReorder>` |
|
|
978
|
+
| `reorderable` | `<DataTable.ColumnReorder>` |
|
|
979
|
+
| `resizeable` | `<DataTable.ColumnResizer>` |
|
|
980
|
+
| `colSpan`, `rowSpan` | Native attributes on the cell |
|
|
981
|
+
|
|
982
|
+
#### Table props
|
|
983
|
+
|
|
984
|
+
| v10 | v11 |
|
|
985
|
+
| -------------- | ------------------ |
|
|
986
|
+
| `value` | `data` |
|
|
987
|
+
| `selection` | `selectionKeys` |
|
|
988
|
+
| `first` | `page` |
|
|
989
|
+
| `expandedRows` | `expandedKeys` |
|
|
990
|
+
| `editingRows` | `editingKeys` |
|
|
991
|
+
| `groupRowsBy` | `groupField` |
|
|
992
|
+
| `onPage` | `onPageChange` |
|
|
993
|
+
| `onSort` | `onSortChange` |
|
|
994
|
+
| `onRowToggle` | `onExpandedChange` |
|
|
995
|
+
|
|
996
|
+
Most behaviour props kept their names: dataKey, loading, lazy, totalRecords, scrollable, scrollHeight, sortField, sortOrder, removableSort, selectionMode, metaKeySelection, rows, paginator, reorderableColumns, resizableColumns, editMode, filters, globalFilter, rowHover, size, stripedRows, showGridlines.
|
|
997
|
+
|
|
998
|
+
The imperative methods need attention. `dt.current.exportCSV()` became the `<DataTable.Export>` part, backed by the `useDataTableExport` hook. The rest: `reset()`, `filter()`, `closeEditingCell()`, `saveState()`, `restoreState()`, have no direct replacement; they are handled through controlled state props or the feature hooks under `@primereact/headless/datatable/features`. State persistence via `stateKey` / `stateStorage` was dropped entirely, so saving and restoring table state is now application code.
|
|
999
|
+
|
|
1000
|
+
Also dropped: `responsiveLayout` and `breakpoint`, `virtualScrollerOptions` (virtualization is the `useVirtualizer` hook now), cell selection, `selectAll`, `currentPageReportTemplate`, and every `*Icon` prop.
|
|
1001
|
+
|
|
1002
|
+
New: `treeMode`, which is how TreeTable is written in v11, plus `<DataTable.ColumnToggle>` and keyboard navigation through `useDataTableKeyboard`.
|
|
1003
|
+
|
|
1004
|
+
### DataView
|
|
1005
|
+
|
|
1006
|
+
[Component documentation](/docs/styled/components/dataview)
|
|
1007
|
+
|
|
1008
|
+
Parts: Root, Header, Content, Footer, Empty.
|
|
1009
|
+
|
|
1010
|
+
DataView became a layout shell. `layout` carries over with `defaultLayout` and `onLayoutChange`, but the data props did not: `value`, `lazy`, `loading`, `sortField`, `sortOrder` and the entire paginator prop set are gone.
|
|
1011
|
+
|
|
1012
|
+
Items are rendered as children inside `<DataView.Content>`, and paging is a `Paginator` composed into `<DataView.Footer>`. The `DataViewLayoutOptions` sub-component has no equivalent. A `ToggleButtonGroup` driving `onLayoutChange` covers it.
|
|
1013
|
+
|
|
1014
|
+
### Dialog
|
|
1015
|
+
|
|
1016
|
+
[Component documentation](/docs/styled/components/dialog)
|
|
1017
|
+
|
|
1018
|
+
```jsx
|
|
1019
|
+
// v10
|
|
1020
|
+
const [visible, setVisible] = useState(false);
|
|
1021
|
+
|
|
1022
|
+
<Button label="Show" onClick={() => setVisible(true)} />
|
|
1023
|
+
<Dialog header="Edit Profile" visible={visible} style={{ width: '50vw' }} onHide={() => setVisible(false)}>
|
|
1024
|
+
…
|
|
1025
|
+
</Dialog>
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
```jsx
|
|
1029
|
+
// v11
|
|
1030
|
+
<Dialog.Root>
|
|
1031
|
+
<Dialog.Trigger as={Button}>Edit Profile</Dialog.Trigger>
|
|
1032
|
+
<Dialog.Portal>
|
|
1033
|
+
<Dialog.Backdrop />
|
|
1034
|
+
<Dialog.Positioner>
|
|
1035
|
+
<Dialog.Popup style={{ width: '24rem' }}>
|
|
1036
|
+
<Dialog.Header>
|
|
1037
|
+
<Dialog.Title>Edit Profile</Dialog.Title>
|
|
1038
|
+
<Dialog.HeaderActions>
|
|
1039
|
+
<Dialog.Close as={Button} rounded variant="text" iconOnly>
|
|
1040
|
+
<Times />
|
|
1041
|
+
</Dialog.Close>
|
|
1042
|
+
</Dialog.HeaderActions>
|
|
1043
|
+
</Dialog.Header>
|
|
1044
|
+
<Dialog.Content>…</Dialog.Content>
|
|
1045
|
+
<Dialog.Footer>
|
|
1046
|
+
<Dialog.Close as={Button} severity="secondary" variant="outlined">
|
|
1047
|
+
Cancel
|
|
1048
|
+
</Dialog.Close>
|
|
1049
|
+
</Dialog.Footer>
|
|
1050
|
+
</Dialog.Popup>
|
|
1051
|
+
</Dialog.Positioner>
|
|
1052
|
+
</Dialog.Portal>
|
|
1053
|
+
</Dialog.Root>
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
The `useState` disappeared. `<Dialog.Trigger>` opens and `<Dialog.Close>` closes, so the common case needs no state at all. Controlled usage is still available through `open` / `defaultOpen` / `onOpenChange` when something outside the dialog has to drive it.
|
|
1057
|
+
|
|
1058
|
+
Both `Trigger` and `Close` take `as={Button}`, so they are real buttons with the full Button API instead of a `closeIcon` prop and a fixed layout.
|
|
1059
|
+
|
|
1060
|
+
Carried over: modal, closeOnEscape, blockScroll, draggable, position, baseZIndex, keepInViewport.
|
|
1061
|
+
|
|
1062
|
+
| v10 | v11 |
|
|
1063
|
+
| ----------------------- | -------------------------------------------- |
|
|
1064
|
+
| `visible` | `open` |
|
|
1065
|
+
| `onHide` | `onOpenChange` |
|
|
1066
|
+
| `dismissableMask` | `dismissable` |
|
|
1067
|
+
| `maximized` | `fullScreen` |
|
|
1068
|
+
| `header` | `<Dialog.Header>` with `<Dialog.Title>` |
|
|
1069
|
+
| `footer` | `<Dialog.Footer>` |
|
|
1070
|
+
| `closable`, `closeIcon` | `<Dialog.Close>` |
|
|
1071
|
+
| `maximizable` | `<Dialog.Maximizable>` |
|
|
1072
|
+
| `icons` | `<Dialog.HeaderActions>` |
|
|
1073
|
+
| `appendTo` | `<Dialog.Portal>` |
|
|
1074
|
+
| mask | `<Dialog.Backdrop>` |
|
|
1075
|
+
| `*ClassName`, `*Style` | `className` and `style` on the matching part |
|
|
1076
|
+
|
|
1077
|
+
**Dropped.** `resizable` with its resize callbacks, `breakpoints`, `rtl`, `transitionOptions`, `onMaskClick`, `onShow`.
|
|
1078
|
+
|
|
1079
|
+
**New.** `scrollBehavior`, `autoZIndex`, `onExitComplete`, and the `Positioner` part.
|
|
1080
|
+
|
|
1081
|
+
### Divider
|
|
1082
|
+
|
|
1083
|
+
[Component documentation](/docs/styled/components/divider)
|
|
1084
|
+
|
|
1085
|
+
`layout` became `orientation`; `align` and `type` carry over unchanged.
|
|
1086
|
+
|
|
1087
|
+
### Dropdown → Select
|
|
1088
|
+
|
|
1089
|
+
[Component documentation](/docs/styled/components/select)
|
|
1090
|
+
|
|
1091
|
+
```jsx
|
|
1092
|
+
// v10
|
|
1093
|
+
<Dropdown value={city} onChange={(e) => setCity(e.value)} options={cities} optionLabel="name" placeholder="Select a City" />
|
|
1094
|
+
```
|
|
1095
|
+
|
|
1096
|
+
```jsx
|
|
1097
|
+
// v11
|
|
1098
|
+
<Select.Root value={city} onValueChange={(e) => setCity(e.value)} options={cities} optionLabel="name">
|
|
1099
|
+
<Select.Trigger>
|
|
1100
|
+
<Select.Value placeholder="Select a City" />
|
|
1101
|
+
<Select.Indicator>
|
|
1102
|
+
<ChevronDown />
|
|
1103
|
+
</Select.Indicator>
|
|
1104
|
+
</Select.Trigger>
|
|
1105
|
+
<Select.Portal>
|
|
1106
|
+
<Select.Positioner>
|
|
1107
|
+
<Select.Popup>
|
|
1108
|
+
<Select.List />
|
|
1109
|
+
</Select.Popup>
|
|
1110
|
+
</Select.Positioner>
|
|
1111
|
+
</Select.Portal>
|
|
1112
|
+
</Select.Root>
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
Parts: Root, Trigger, Value, Indicator, Clear, Arrow, Portal, Positioner, Popup, Header, Filter, List, Option, OptionIndicator, Empty, Footer.
|
|
1116
|
+
|
|
1117
|
+
The data props are untouched: options, optionLabel, optionValue, optionDisabled, optionGroupLabel, optionGroupChildren, disabled, invalid, variant, autoFocus, autoOptionFocus, selectOnFocus, focusOnHover.
|
|
1118
|
+
|
|
1119
|
+
`onChange` became `onValueChange`, `onShow` and `onHide` became `onOpenChange`, and `dataKey` became `optionKey`.
|
|
1120
|
+
|
|
1121
|
+
Everything visual moved to a part:
|
|
1122
|
+
|
|
1123
|
+
- `placeholder` → `<Select.Value placeholder>`
|
|
1124
|
+
- `valueTemplate` → children of `<Select.Value>`
|
|
1125
|
+
- `itemTemplate` → children of `<Select.Option>`
|
|
1126
|
+
- `dropdownIcon` → `<Select.Indicator>` with the icon as its child
|
|
1127
|
+
- `showClear` + `clearIcon` → `<Select.Clear>`
|
|
1128
|
+
- `emptyMessage` → `<Select.Empty>`
|
|
1129
|
+
- `panelFooterTemplate` → `<Select.Footer>`
|
|
1130
|
+
- `panelClassName` / `panelStyle` → `className` / `style` on `<Select.Popup>`
|
|
1131
|
+
- `appendTo` → `<Select.Portal>`
|
|
1132
|
+
- `scrollHeight` → a `max-height` on `<Select.List>`
|
|
1133
|
+
|
|
1134
|
+
Two changes need more than a rename.
|
|
1135
|
+
|
|
1136
|
+
**Filtering is now explicit.** v10 accepted `filter`, `filterBy`, `filterMatchMode` and `filterDelay` and did the work internally. v11 gives `<Select.Header>` with a `<Select.Filter>` input and expects the `options` array to be filtered in application code. More lines, but the filter is no longer a black box: fuzzy matching, remote search or a debounce all become ordinary code instead of a prop that either fits the requirement or doesn't.
|
|
1137
|
+
|
|
1138
|
+
**`editable` has no counterpart.** A Select that accepts free text is `AutoComplete` in v11.
|
|
1139
|
+
|
|
1140
|
+
Dropped without replacement: `maxLength`, `loading`, `loadingIcon`, `resetFilterOnHide`, `useOptionAsValue`, `showFilterClear`.
|
|
1141
|
+
|
|
1142
|
+
New: `multiple` (which is how MultiSelect is written now), `metaKeySelection`, `closeOnEscape`, `trapped`, `size`, `fluid`, and the whole `<Select.Positioner>` placement system.
|
|
1143
|
+
|
|
1144
|
+
### Fieldset
|
|
1145
|
+
|
|
1146
|
+
[Component documentation](/docs/styled/components/fieldset)
|
|
1147
|
+
|
|
1148
|
+
Parts: Root, Legend, Title, Trigger, Indicator, Content.
|
|
1149
|
+
|
|
1150
|
+
The same shape as Panel, including the inverted state prop: `legend` became `<Fieldset.Legend>` with `<Fieldset.Title>`, `toggleable` became the presence of `<Fieldset.Trigger>`, and `collapsed` became `open` with `defaultOpen` defaulting to `true`.
|
|
1151
|
+
|
|
1152
|
+
### FileUpload
|
|
1153
|
+
|
|
1154
|
+
[Component documentation](/docs/styled/components/fileupload)
|
|
1155
|
+
|
|
1156
|
+
Parts: Root, Content, Trigger, Upload, Clear, ItemGroup, Item, ItemPreview, ItemInfo, ItemName, ItemSize, ItemRemove.
|
|
1157
|
+
|
|
1158
|
+
The upload machinery carries over: name, url, multiple, accept, auto, maxFileSize, withCredentials, customUpload, uploadHandler, onSelect, onBeforeUpload, onUpload, onError, onProgress, onBeforeSend.
|
|
1159
|
+
|
|
1160
|
+
The three buttons became parts: `chooseLabel` and `chooseOptions` are `<FileUpload.Trigger>`, with `<FileUpload.Upload>` and `<FileUpload.Clear>` alongside. The file row is `<FileUpload.Item>` with `ItemPreview`, `ItemInfo`, `ItemName`, `ItemSize` and `ItemRemove` inside it, replacing `itemTemplate`.
|
|
1161
|
+
|
|
1162
|
+
`mode="basic"` is gone as a flag: a basic uploader is one that renders only `<FileUpload.Trigger>`.
|
|
1163
|
+
|
|
1164
|
+
The ref methods `getFiles()`, `setFiles()` and `getUploadedFiles()` are replaced by the render-prop on `Root`, which exposes the same state.
|
|
1165
|
+
|
|
1166
|
+
New: `fileLimit` with matching validation messages.
|
|
1167
|
+
|
|
1168
|
+
### FloatLabel and IconField
|
|
1169
|
+
|
|
1170
|
+
[Component documentation](/docs/styled/components/floatlabel)
|
|
1171
|
+
|
|
1172
|
+
`FloatLabel` gained a `variant` prop with `over`, `in` and `on` values, covering what v10 split across separate components.
|
|
1173
|
+
|
|
1174
|
+
`IconField` has `Root` and `Inset` parts. `iconPosition` is gone: an `<IconField.Inset>` written before the input renders on the left, after it on the right. The separate `InputIcon` component from v10 is replaced by `Inset`.
|
|
1175
|
+
|
|
1176
|
+
### FocusTrap and StyleClass
|
|
1177
|
+
|
|
1178
|
+
[Component documentation](/docs/styled/components/focustrap)
|
|
1179
|
+
|
|
1180
|
+
`StyleClass` kept its whole API: `nodeRef`, `selector`, and the enter/leave class name props. The deprecated `enterClassName` and `leaveClassName` aliases were removed. New: `hiddenClassName`, `hideOnResize`, `resizeSelector`.
|
|
1181
|
+
|
|
1182
|
+
`FocusTrap` gained real props where v10 had only `children`: `trapped`, `autoFocus`, `initialFocusRef`, `onEscape`, `onTabFirst`, `onTabLast`.
|
|
1183
|
+
|
|
1184
|
+
### Galleria → Gallery
|
|
1185
|
+
|
|
1186
|
+
[Single image example](/docs/styled/components/gallery#single)
|
|
1187
|
+
|
|
1188
|
+
Parts: Root, Backdrop, Content, Item, Prev, Next, Header, Footer, Thumbnail, ThumbnailContent, ThumbnailItem, ZoomIn, ZoomOut, ZoomToggle, RotateLeft, RotateRight, FlipX, FlipY, Download, FullScreen.
|
|
1189
|
+
|
|
1190
|
+
`value` with `item` and `thumbnail` render-props became explicit children: items are mapped to `<Gallery.Item>` and thumbnails to `<Gallery.ThumbnailItem>`. `activeIndex` carries over with a new `defaultActiveIndex`, `onItemChange` became `onActiveIndexChange`, and `fullScreen` became `fullscreen` with `onFullscreenChange`.
|
|
1191
|
+
|
|
1192
|
+
Gallery gained an image viewer: zoom, rotate, flip and download parts that v10 did not have. This is also what replaces the v10 `Image` component. The `single-demo` shows a one-image preview with the full toolbar.
|
|
1193
|
+
|
|
1194
|
+
What it lost is the slideshow side: `autoPlay`, `transitionInterval`, `circular`, `numVisible`, `responsiveOptions`, `thumbnailsPosition` and the indicator dots have no counterparts.
|
|
1195
|
+
|
|
1196
|
+
### Inplace
|
|
1197
|
+
|
|
1198
|
+
[Component documentation](/docs/styled/components/inplace)
|
|
1199
|
+
|
|
1200
|
+
Parts: Root, Display, Content, Close.
|
|
1201
|
+
|
|
1202
|
+
`InplaceDisplay` and `InplaceContent` became `<Inplace.Display>` and `<Inplace.Content>`. `active` gained `open` / `defaultOpen` / `onOpenChange` alongside it, and `closable` / `closeIcon` became `<Inplace.Close>`.
|
|
1203
|
+
|
|
1204
|
+
### InputNumber
|
|
1205
|
+
|
|
1206
|
+
[Component documentation](/docs/styled/components/inputnumber)
|
|
1207
|
+
|
|
1208
|
+
Parts: Root, Group, Input, Increment, Decrement.
|
|
1209
|
+
|
|
1210
|
+
The formatting engine is untouched: format, locale, mode, prefix, suffix, currency, currencyDisplay, useGrouping, minFractionDigits, maxFractionDigits, roundingMode, min, max, step, allowEmpty.
|
|
1211
|
+
|
|
1212
|
+
The spinner buttons became parts: `showButtons`, `incrementButtonIcon` and `incrementButtonClassName` are now `<InputNumber.Increment>`, with `<InputNumber.Decrement>` alongside it, and `buttonLayout` became `layout` on `Root`. Input-level props go on `<InputNumber.Input>`.
|
|
1213
|
+
|
|
1214
|
+
New: `highlightOnFocus`, `variant`, `fluid`.
|
|
1215
|
+
|
|
1216
|
+
### InputOtp
|
|
1217
|
+
|
|
1218
|
+
[Component documentation](/docs/styled/components/inputotp)
|
|
1219
|
+
|
|
1220
|
+
Parts: Root, Text.
|
|
1221
|
+
|
|
1222
|
+
`length` is gone, the number of cells is the number of `<InputOtp.Text index={n}>` children. `inputTemplate` disappears with it, since each cell is already an element that accepts `as` and children.
|
|
1223
|
+
|
|
1224
|
+
`value`, `mask`, `disabled` and `integerOnly` carry over; `onChange` became `onValueChange`.
|
|
1225
|
+
|
|
1226
|
+
### InputSwitch → ToggleSwitch
|
|
1227
|
+
|
|
1228
|
+
[Component documentation](/docs/styled/components/toggleswitch)
|
|
1229
|
+
|
|
1230
|
+
```jsx
|
|
1231
|
+
// v10
|
|
1232
|
+
<InputSwitch checked={checked} onChange={(e) => setChecked(e.value)} />
|
|
1233
|
+
```
|
|
1234
|
+
|
|
1235
|
+
```jsx
|
|
1236
|
+
// v11
|
|
1237
|
+
<ToggleSwitch.Root checked={checked} onCheckedChange={(e) => setChecked(e.checked)}>
|
|
1238
|
+
<ToggleSwitch.Control>
|
|
1239
|
+
<ToggleSwitch.Handle />
|
|
1240
|
+
</ToggleSwitch.Control>
|
|
1241
|
+
</ToggleSwitch.Root>
|
|
1242
|
+
```
|
|
1243
|
+
|
|
1244
|
+
Parts: Root, Control, Handle.
|
|
1245
|
+
|
|
1246
|
+
Carried over: disabled, invalid, tabIndex, inputId, required, onFocus, onBlur.
|
|
1247
|
+
|
|
1248
|
+
`onChange` became `onCheckedChange`, and `defaultChecked` is available for uncontrolled use.
|
|
1249
|
+
|
|
1250
|
+
Icons that indicate on/off state go inside `<ToggleSwitch.Handle>`. V10 had no way to do this without pass-through styling.
|
|
1251
|
+
|
|
1252
|
+
Dropped: trueValue, falseValue, name, autoFocus.
|
|
1253
|
+
|
|
1254
|
+
### InputText
|
|
1255
|
+
|
|
1256
|
+
[Component documentation](/docs/styled/components/inputtext)
|
|
1257
|
+
|
|
1258
|
+
A single component, not a compound one. `invalid` and `variant` carry over, native input attributes pass straight through.
|
|
1259
|
+
|
|
1260
|
+
`keyfilter` and `validateOnly` are gone: key filtering is the `useKeyFilter` hook now, applied to any input. `tooltip` became the `Tooltip` component wrapped around the field.
|
|
1261
|
+
|
|
1262
|
+
New: `size`, `fluid`, `as`.
|
|
1263
|
+
|
|
1264
|
+
### InputTextarea → Textarea
|
|
1265
|
+
|
|
1266
|
+
[Component documentation](/docs/styled/components/textarea)
|
|
1267
|
+
|
|
1268
|
+
A rename plus a shorter prop list.
|
|
1269
|
+
|
|
1270
|
+
```jsx
|
|
1271
|
+
<Textarea rows={5} cols={30} autoResize />
|
|
1272
|
+
```
|
|
1273
|
+
|
|
1274
|
+
`autoResize`, `invalid` and `variant` carry over. Native textarea attributes pass straight through, so `onInput`, `onKeyDown`, `onPaste` and friends are no longer listed as props. `keyfilter` moved to the `useKeyFilter` hook.
|
|
1275
|
+
|
|
1276
|
+
New: `size`, `fluid`, and `as` for rendering a different element.
|
|
1277
|
+
|
|
1278
|
+
### Knob
|
|
1279
|
+
|
|
1280
|
+
[Component documentation](/docs/styled/components/knob)
|
|
1281
|
+
|
|
1282
|
+
Parts: Root, Range, Value, Text.
|
|
1283
|
+
|
|
1284
|
+
Nearly everything carries over: value, size, step, min, max, strokeWidth, rangeColor, valueColor, textColor, readOnly, disabled.
|
|
1285
|
+
|
|
1286
|
+
`onChange` became `onValueChange`, and the handler receives an event object rather than the value alone. Uncontrolled use needs `defaultValue`, which v10 did not have.
|
|
1287
|
+
|
|
1288
|
+
`valueTemplate` became `<Knob.Text>`, and `showValue` became the presence or absence of that part. The colour props also exist per part, so `<Knob.Range color="…">` and `<Knob.Value color="…">` work alongside the root-level ones.
|
|
1289
|
+
|
|
1290
|
+
Dropped: `name`. New: `invalid`, `ariaLabel`, `ariaLabelledby`.
|
|
1291
|
+
|
|
1292
|
+
The colour defaults now resolve through design tokens, so a Knob follows the active theme without configuration.
|
|
1293
|
+
|
|
1294
|
+
### Listbox
|
|
1295
|
+
|
|
1296
|
+
[Component documentation](/docs/styled/components/listbox)
|
|
1297
|
+
|
|
1298
|
+
Parts: Root, Header, Filter, List, Option, OptionIndicator, Footer, Empty.
|
|
1299
|
+
|
|
1300
|
+
Data props carry over unchanged: options, optionLabel, optionValue, optionDisabled, optionGroupLabel, optionGroupChildren, multiple, metaKeySelection, selectOnFocus, focusOnHover.
|
|
1301
|
+
|
|
1302
|
+
`dataKey` became `optionKey` and `onChange` became `onValueChange`.
|
|
1303
|
+
|
|
1304
|
+
Filtering follows the same rule as Select: `<Listbox.Filter>` supplies the input, application code filters the array. The `filterBy`, `filterMatchMode` and `filterLocale` props are gone.
|
|
1305
|
+
|
|
1306
|
+
One default changed: `autoOptionFocus` is now `true`, where v10 defaulted to `false`.
|
|
1307
|
+
|
|
1308
|
+
### Menu and the `model` prop
|
|
1309
|
+
|
|
1310
|
+
[Component documentation](/docs/styled/components/menu)
|
|
1311
|
+
|
|
1312
|
+
Every v10 menu component took a `model` array of item descriptors:
|
|
1313
|
+
|
|
1314
|
+
```jsx
|
|
1315
|
+
// v10
|
|
1316
|
+
const items = [{ label: 'New', icon: 'pi pi-plus', command: () => create() }, { separator: true }, { label: 'Export', items: [{ label: 'CSV', command: () => exportCsv() }] }];
|
|
1317
|
+
|
|
1318
|
+
<Menu model={items} popup ref={menu} />;
|
|
1319
|
+
```
|
|
1320
|
+
|
|
1321
|
+
No v11 menu component accepts `model`. Menus are markup:
|
|
1322
|
+
|
|
1323
|
+
```jsx
|
|
1324
|
+
// v11
|
|
1325
|
+
<Menu.Root>
|
|
1326
|
+
<Menu.Trigger as={Button}>Options</Menu.Trigger>
|
|
1327
|
+
<Menu.Portal>
|
|
1328
|
+
<Menu.Positioner>
|
|
1329
|
+
<Menu.Popup>
|
|
1330
|
+
<Menu.List>
|
|
1331
|
+
<Menu.Item onClick={create}>
|
|
1332
|
+
<Plus /> New
|
|
1333
|
+
</Menu.Item>
|
|
1334
|
+
<Menu.Separator />
|
|
1335
|
+
<Menu.Submenu>
|
|
1336
|
+
<Menu.SubmenuTrigger>
|
|
1337
|
+
Export <Menu.SubmenuIndicator />
|
|
1338
|
+
</Menu.SubmenuTrigger>
|
|
1339
|
+
<Menu.Portal>
|
|
1340
|
+
<Menu.Positioner>
|
|
1341
|
+
<Menu.Popup>
|
|
1342
|
+
<Menu.List>
|
|
1343
|
+
<Menu.Item onClick={exportCsv}>CSV</Menu.Item>
|
|
1344
|
+
</Menu.List>
|
|
1345
|
+
</Menu.Popup>
|
|
1346
|
+
</Menu.Positioner>
|
|
1347
|
+
</Menu.Portal>
|
|
1348
|
+
</Menu.Submenu>
|
|
1349
|
+
</Menu.List>
|
|
1350
|
+
</Menu.Popup>
|
|
1351
|
+
</Menu.Positioner>
|
|
1352
|
+
</Menu.Portal>
|
|
1353
|
+
</Menu.Root>
|
|
1354
|
+
```
|
|
1355
|
+
|
|
1356
|
+
The translation is mechanical:
|
|
1357
|
+
|
|
1358
|
+
| v10 model key | v11 |
|
|
1359
|
+
| ---------------- | ------------------------- |
|
|
1360
|
+
| `item.label` | Children of `<Menu.Item>` |
|
|
1361
|
+
| `item.icon` | An icon element |
|
|
1362
|
+
| `item.command` | `onClick` |
|
|
1363
|
+
| `item.items` | A nested `<Menu.Submenu>` |
|
|
1364
|
+
| `item.separator` | `<Menu.Separator>` |
|
|
1365
|
+
| `item.template` | Just write the markup |
|
|
1366
|
+
|
|
1367
|
+
This is more code than a `model` array, no question. What it buys is that a menu item is a React element: it can be a router `<Link>`, hold a badge or a keyboard shortcut hint, be conditionally rendered, or take a `ref`. In v10 anything beyond the fixed item shape required a `template` function, and a router link meant intercepting `command` to call `navigate()`. Losing middle-click and open-in-new-tab in the process.
|
|
1368
|
+
|
|
1369
|
+
Menu parts:
|
|
1370
|
+
|
|
1371
|
+
Root, Trigger, Portal, Positioner, Popup, List, Group, Label, Item, Separator, Arrow, Submenu, SubmenuTrigger, SubmenuIndicator, CheckboxItem, CheckboxItemIndicator, RadioItem, RadioItemGroup, RadioItemIndicator
|
|
1372
|
+
|
|
1373
|
+
`popup` is no longer a flag either. A popup menu includes the `Trigger` / `Portal` / `Positioner` / `Popup` wrappers; an inline menu renders `<Menu.List>` directly under `Root`.
|
|
1374
|
+
|
|
1375
|
+
The imperative `menu.current.toggle(e)` is replaced by `<Menu.Trigger>` or by controlling `open` / `onOpenChange`.
|
|
1376
|
+
|
|
1377
|
+
New: `openOnHover` with `openDelay` and `closeDelay`, plus `CheckboxItem` and `RadioItem` parts that v10 had no equivalent for.
|
|
1378
|
+
|
|
1379
|
+
### Menubar, MegaMenu, TieredMenu and ContextMenu
|
|
1380
|
+
|
|
1381
|
+
[NavBar example](/docs/styled/components/navigationmenu#navbar)
|
|
1382
|
+
|
|
1383
|
+
`TieredMenu` is `Menu` with `Submenu` nesting. There is no separate component.
|
|
1384
|
+
|
|
1385
|
+
`MegaMenu` and `Menubar` are `NavigationMenu` wrapping one `Menu.Root` per top-level entry. The "mega" layout is grid classes on `<Menu.List>` rather than a two-dimensional `model` array. `start` and `end` are gone: arbitrary JSX goes inside `NavigationMenu` as siblings.
|
|
1386
|
+
|
|
1387
|
+
One thing v10 handled that v11 does not: the Menubar's built-in mobile hamburger. The navbar demo composes it from `Drawer` plus `Accordion` at the mobile breakpoint.
|
|
1388
|
+
|
|
1389
|
+
`ContextMenu` keeps `global` and the same part list as `Menu`. `cm.current.show(event)` is replaced by wrapping the target in `<ContextMenu.Trigger>`, which binds the right-click itself.
|
|
1390
|
+
|
|
1391
|
+
Dropped across the family: `scrollHeight`, `breakpoint`, `transitionOptions`, and the `submenuIcon` / `menuIcon` props, which became indicator parts.
|
|
1392
|
+
|
|
1393
|
+
### Message and Messages
|
|
1394
|
+
|
|
1395
|
+
[Dynamic example](/docs/styled/components/message#dynamic)
|
|
1396
|
+
|
|
1397
|
+
`Message` parts: `Root`, `Icon`, `Content`, `Text`, `Close`.
|
|
1398
|
+
|
|
1399
|
+
`severity` carries over. `text` became `<Message.Text>`, `icon` became `<Message.Icon>`, and closability is the presence of `<Message.Close>` instead of a `closable` prop. New: `variant`, `size`, and `life` for auto-dismiss.
|
|
1400
|
+
|
|
1401
|
+
`Messages`, the plural component with its `show()`, `replace()` and `clear()` ref API, has no counterpart. An array of messages in state, mapped to `Message.Root`, covers the declarative case. For fire-and-forget notifications the intended replacement is `Toast` with the `toast()` function.
|
|
1402
|
+
|
|
1403
|
+
### MeterGroup
|
|
1404
|
+
|
|
1405
|
+
[Component documentation](/docs/styled/components/metergroup)
|
|
1406
|
+
|
|
1407
|
+
Parts: Root, Meters, Meter, Labels, Label, Marker, Text.
|
|
1408
|
+
|
|
1409
|
+
`min`, `max` and `orientation` carry over. The `values` array became one `<MeterGroup.Meter value color>` per datum, and the label list became `<MeterGroup.Labels>` with `Label`, `Marker` and `Text` inside.
|
|
1410
|
+
|
|
1411
|
+
`labelPosition` and `labelOrientation` are gone: position is where the element is written, and `Labels` has its own `orientation`. The `start`, `end`, `meter` and `labelList` templates left with them, since each is a part now.
|
|
1412
|
+
|
|
1413
|
+
One detail the demos all include: `aria-valuenow` goes on `Root` explicitly, where v10 derived it.
|
|
1414
|
+
|
|
1415
|
+
### MultiSelect → Select with `multiple`
|
|
1416
|
+
|
|
1417
|
+
[Multiple example](/docs/styled/components/select#multiple)
|
|
1418
|
+
|
|
1419
|
+
MultiSelect is not a separate component in v11.
|
|
1420
|
+
|
|
1421
|
+
```jsx
|
|
1422
|
+
// v10
|
|
1423
|
+
<MultiSelect value={selected} onChange={(e) => setSelected(e.value)} options={cities} optionLabel="name" display="chip" maxSelectedLabels={3} />
|
|
1424
|
+
```
|
|
1425
|
+
|
|
1426
|
+
```jsx
|
|
1427
|
+
// v11
|
|
1428
|
+
<Select.Root multiple value={selected} onValueChange={(e) => setSelected(e.value)} options={cities} optionLabel="name">
|
|
1429
|
+
…
|
|
1430
|
+
</Select.Root>
|
|
1431
|
+
```
|
|
1432
|
+
|
|
1433
|
+
The parts and prop names are the Select ones above. What differs from a plain Select is how the trigger label is produced: `display`, `maxSelectedLabels` and `selectedItemsLabel` are gone, and the label is computed in application code as children of `<Select.Value>`. The `chip-demo` and `multiple-demo` under Select show both styles.
|
|
1434
|
+
|
|
1435
|
+
Checkbox-style option marks are `<Select.OptionIndicator>`, replacing `checkboxIcon` and `itemCheckboxIcon`.
|
|
1436
|
+
|
|
1437
|
+
`selectAll` and `showSelectAll` have no built-in counterpart. A select-all control goes in `<Select.Header>` and drives the value directly.
|
|
1438
|
+
|
|
1439
|
+
### OrganizationChart
|
|
1440
|
+
|
|
1441
|
+
[Component documentation](/docs/styled/components/organizationchart)
|
|
1442
|
+
|
|
1443
|
+
Parts: Root, Nodes, Node, Content, Label, Toggle, ToggleIndicator, Selection.
|
|
1444
|
+
|
|
1445
|
+
`value` carries over, and `selectionMode` keeps its name while gaining a third value: `'single'`, `'multiple'` and now `'checkbox'`, which is what the `Selection` part renders.
|
|
1446
|
+
|
|
1447
|
+
| v10 | v11 |
|
|
1448
|
+
| ---------------------------- | ------------------------------------------------------------ |
|
|
1449
|
+
| `selection` | `selectionKeys`, `defaultSelectionKeys`, `onSelectionChange` |
|
|
1450
|
+
| `expanded` flag on each node | `collapsedKeys`, `defaultCollapsedKeys`, `onCollapsedChange` |
|
|
1451
|
+
| `nodeTemplate` | `<OrganizationChart.Node>` with `Content` and `Label` inside |
|
|
1452
|
+
| `togglerIcon` | `<OrganizationChart.Toggle>` with `<ToggleIndicator>` |
|
|
1453
|
+
|
|
1454
|
+
The gain is that collapse state left the data. v10 stored `expanded` on each node object, mixing view state into the structure being rendered.
|
|
1455
|
+
|
|
1456
|
+
A straight rewrite misses two things. `<OrganizationChart.Nodes>` takes a render function rather than static children, and each `<OrganizationChart.Node>` needs a `uKey` for selection and collapse keys to resolve against.
|
|
1457
|
+
|
|
1458
|
+
```jsx
|
|
1459
|
+
<OrganizationChart.Nodes>{({ node }) => <OrganizationChart.Node uKey={node.key}>…</OrganizationChart.Node>}</OrganizationChart.Nodes>
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
Dropped: `onNodeSelect` and `onNodeUnselect`. Selection changes come through `onSelectionChange` only.
|
|
1463
|
+
|
|
1464
|
+
New: `gap`, which takes a number or an `[x, y]` pair and defaults to `[40, 56]`.
|
|
1465
|
+
|
|
1466
|
+
### OverlayPanel → Popover
|
|
1467
|
+
|
|
1468
|
+
[Component documentation](/docs/styled/components/popover)
|
|
1469
|
+
|
|
1470
|
+
OverlayPanel was opened and closed through its ref, so this one changes how the surrounding code is written.
|
|
1471
|
+
|
|
1472
|
+
```jsx
|
|
1473
|
+
// v10
|
|
1474
|
+
const op = useRef(null);
|
|
1475
|
+
|
|
1476
|
+
<Button label="Image" onClick={(e) => op.current.toggle(e)} />
|
|
1477
|
+
<OverlayPanel ref={op}>
|
|
1478
|
+
<img src="…" />
|
|
1479
|
+
</OverlayPanel>
|
|
1480
|
+
```
|
|
1481
|
+
|
|
1482
|
+
```jsx
|
|
1483
|
+
// v11
|
|
1484
|
+
<Popover.Root>
|
|
1485
|
+
<Popover.Trigger as={Button}>Image</Popover.Trigger>
|
|
1486
|
+
<Popover.Portal>
|
|
1487
|
+
<Popover.Positioner>
|
|
1488
|
+
<Popover.Popup>
|
|
1489
|
+
<Popover.Content>
|
|
1490
|
+
<img src="…" />
|
|
1491
|
+
</Popover.Content>
|
|
1492
|
+
</Popover.Popup>
|
|
1493
|
+
</Popover.Positioner>
|
|
1494
|
+
</Popover.Portal>
|
|
1495
|
+
</Popover.Root>
|
|
1496
|
+
```
|
|
1497
|
+
|
|
1498
|
+
`op.current.toggle(e)`, `.show()`, `.hide()` and `.align()` are all replaced by `<Popover.Trigger>` plus the `open` / `onOpenChange` pair. The ref and the click handler both go away.
|
|
1499
|
+
|
|
1500
|
+
Positioning, which `align()` handled implicitly, is now declarative on `<Popover.Positioner>`: `side`, `align`, `sideOffset`, `alignOffset`, `flip`, `shift` and `strategy`. An `anchor` prop covers the case where the popover attaches to something other than its trigger.
|
|
1501
|
+
|
|
1502
|
+
Parts: Root, Trigger, Portal, Positioner, Popup, Arrow, Header, Title, Content, Description, Footer, Close.
|
|
1503
|
+
|
|
1504
|
+
New relative to v10: `Arrow`, `Header`, `Title`, `Description` and `Footer` parts, `trapped` for focus management, and `onExitComplete`.
|
|
1505
|
+
|
|
1506
|
+
### Paginator
|
|
1507
|
+
|
|
1508
|
+
[Component documentation](/docs/styled/components/paginator)
|
|
1509
|
+
|
|
1510
|
+
The counting changed, so a mechanical rename leaves the pagination off by a page.
|
|
1511
|
+
|
|
1512
|
+
v10 tracked a record offset: `first` was the index of the first record on the page, and `rows` the page size. v11 tracks a page number: `page` is 1-based, and `itemsPerPage` is the size. Code that passed `first={20}` for the third page of ten now passes `page={3}`.
|
|
1513
|
+
|
|
1514
|
+
Parts: Root, Content, First, Prev, Pages, Page, Ellipsis, Next, Last.
|
|
1515
|
+
|
|
1516
|
+
| v10 | v11 |
|
|
1517
|
+
| -------------- | -------------- |
|
|
1518
|
+
| `totalRecords` | `total` |
|
|
1519
|
+
| `rows` | `itemsPerPage` |
|
|
1520
|
+
| `first` | `page` |
|
|
1521
|
+
| `pageLinkSize` | `siblings` |
|
|
1522
|
+
|
|
1523
|
+
The `template` string that selected which controls appeared is gone, controls are the parts that get rendered. `rowsPerPageOptions` with its dropdown, `currentPageReportTemplate` and the jump-to-page input all left with it; each is composed from existing components when needed.
|
|
1524
|
+
|
|
1525
|
+
New: `siblings` and `edges` for controlling how many page links show, `showEllipsis`, and `disabled`.
|
|
1526
|
+
|
|
1527
|
+
### Panel
|
|
1528
|
+
|
|
1529
|
+
[Component documentation](/docs/styled/components/panel)
|
|
1530
|
+
|
|
1531
|
+
```jsx
|
|
1532
|
+
// v10
|
|
1533
|
+
<Panel header="Header" toggleable collapsed={collapsed} onToggle={(e) => setCollapsed(e.value)}>
|
|
1534
|
+
Content
|
|
1535
|
+
</Panel>
|
|
1536
|
+
```
|
|
1537
|
+
|
|
1538
|
+
```jsx
|
|
1539
|
+
// v11
|
|
1540
|
+
<Panel.Root>
|
|
1541
|
+
<Panel.Header>
|
|
1542
|
+
<Panel.Title>Header</Panel.Title>
|
|
1543
|
+
<Panel.Trigger>
|
|
1544
|
+
<Panel.Indicator />
|
|
1545
|
+
</Panel.Trigger>
|
|
1546
|
+
</Panel.Header>
|
|
1547
|
+
<Panel.Content>Content</Panel.Content>
|
|
1548
|
+
<Panel.Footer>…</Panel.Footer>
|
|
1549
|
+
</Panel.Root>
|
|
1550
|
+
```
|
|
1551
|
+
|
|
1552
|
+
Parts: Root, Header, Title, Trigger, Indicator, Content, Footer.
|
|
1553
|
+
|
|
1554
|
+
`toggleable` is no longer a flag, including a `<Panel.Trigger>` is what makes a panel collapsible, and omitting it makes a static panel.
|
|
1555
|
+
|
|
1556
|
+
The state prop inverted, which is easy to miss because both versions compile: v10's `collapsed` became v11's `open`, with `defaultOpen` for uncontrolled use. A panel written as `collapsed={true}` becomes `open={false}`, and `defaultOpen` is `true`, so a panel with no state prop starts expanded. `onExpand` and `onCollapse` became `onOpen` and `onClose`, with `onOpenChange` covering both.
|
|
1557
|
+
|
|
1558
|
+
`expandIcon` / `collapseIcon` became `<Panel.Indicator>` or an icon inside the trigger.
|
|
1559
|
+
|
|
1560
|
+
`headerTemplate` and `footerTemplate` are gone because `<Panel.Header>` and `<Panel.Footer>` already accept arbitrary children. A `Footer` part was added, which v10 only had as a prop.
|
|
1561
|
+
|
|
1562
|
+
### Password → InputPassword
|
|
1563
|
+
|
|
1564
|
+
[Component documentation](/docs/styled/components/inputpassword)
|
|
1565
|
+
|
|
1566
|
+
InputPassword is a single component, not a compound one, and it renders `as={InputText}` by default.
|
|
1567
|
+
|
|
1568
|
+
`toggleMask` became a controlled `mask` boolean with `defaultMask` and `onMaskChange`, so the eye icon is now supplied by the application instead of built in. Usually through `IconField`.
|
|
1569
|
+
|
|
1570
|
+
The strength meter is gone as a feature. These have no counterparts:
|
|
1571
|
+
|
|
1572
|
+
feedback, promptLabel, weakLabel, mediumLabel, strongLabel, mediumRegex, strongRegex, header, content, footer
|
|
1573
|
+
|
|
1574
|
+
A strength panel is built with a `Popover`, and the `strength-demo` and `requirements-demo` pages show two versions of it. The trade is real: the built-in meter was one prop, but its rules were fixed and its markup was not reachable.
|
|
1575
|
+
|
|
1576
|
+
### ProgressBar
|
|
1577
|
+
|
|
1578
|
+
[Component documentation](/docs/styled/components/progressbar)
|
|
1579
|
+
|
|
1580
|
+
Parts: Root, Track, Indicator, Label, Value.
|
|
1581
|
+
|
|
1582
|
+
`value`, `mode` and `showValue` carry over on `Root`. `displayValueTemplate` became `<ProgressBar.Value>`, and `color` moved to the theme layer rather than being a prop.
|
|
1583
|
+
|
|
1584
|
+
### ProgressSpinner
|
|
1585
|
+
|
|
1586
|
+
[Component documentation](/docs/styled/components/progressspinner)
|
|
1587
|
+
|
|
1588
|
+
Parts: Root, Track, Range, Value.
|
|
1589
|
+
|
|
1590
|
+
`strokeWidth` carries over, now a number instead of a string. `fill` and `animationDuration` moved to CSS and tokens.
|
|
1591
|
+
|
|
1592
|
+
v11 added a determinate mode: `value`, `min` and `max`. Which v10 did not have.
|
|
1593
|
+
|
|
1594
|
+
### RadioButton
|
|
1595
|
+
|
|
1596
|
+
[Component documentation](/docs/styled/components/radiobutton)
|
|
1597
|
+
|
|
1598
|
+
Parts: `Root`, `Box`, `Indicator`. The same shape as Checkbox, with `onChange` → `onCheckedChange` and a `RadioButtonGroup` component for grouping.
|
|
1599
|
+
|
|
1600
|
+
### Rating
|
|
1601
|
+
|
|
1602
|
+
[Component documentation](/docs/styled/components/rating)
|
|
1603
|
+
|
|
1604
|
+
Parts: Root, Option, On, Off.
|
|
1605
|
+
|
|
1606
|
+
`stars` is gone, the star count is the number of `<Rating.Option index={n}>` children. `onIcon` and `offIcon` became `<Rating.On>` and `<Rating.Off>`, so the "on" state can be any element instead of an icon class.
|
|
1607
|
+
|
|
1608
|
+
Two changes to watch: `allowHalf` now defaults to `true`, and the cancel affordance (`cancel`, `cancelIcon`) was dropped.
|
|
1609
|
+
|
|
1610
|
+
### ScrollPanel → ScrollArea
|
|
1611
|
+
|
|
1612
|
+
[Component documentation](/docs/styled/components/scrollarea)
|
|
1613
|
+
|
|
1614
|
+
Parts: Root, Viewport, Content, Scrollbar, Handle, Corner.
|
|
1615
|
+
|
|
1616
|
+
v10 had almost no API here: `style`, `className` and `step`. v11 exposes the structure: content goes inside `<ScrollArea.Viewport>` and `<ScrollArea.Content>`, and each scrollbar is a `<ScrollArea.Scrollbar orientation="vertical">` with a `<ScrollArea.Handle>`.
|
|
1617
|
+
|
|
1618
|
+
The `refresh()` method is gone; sizing is observed automatically. New: a `variant` for scrollbar visibility, `mask`, and a `Corner` part.
|
|
1619
|
+
|
|
1620
|
+
### SelectButton → ToggleButtonGroup
|
|
1621
|
+
|
|
1622
|
+
[Component documentation](/docs/styled/components/togglebuttongroup)
|
|
1623
|
+
|
|
1624
|
+
```jsx
|
|
1625
|
+
// v10
|
|
1626
|
+
<SelectButton value={value} onChange={(e) => setValue(e.value)} options={['Off', 'On']} />
|
|
1627
|
+
```
|
|
1628
|
+
|
|
1629
|
+
```jsx
|
|
1630
|
+
// v11
|
|
1631
|
+
<ToggleButtonGroup value={value} onValueChange={(e) => setValue(e.value)}>
|
|
1632
|
+
<ToggleButton.Root value="off">Off</ToggleButton.Root>
|
|
1633
|
+
<ToggleButton.Root value="on">On</ToggleButton.Root>
|
|
1634
|
+
</ToggleButtonGroup>
|
|
1635
|
+
```
|
|
1636
|
+
|
|
1637
|
+
`value`, `multiple`, `allowEmpty`, `disabled` and `invalid` carry over. The options array does not. Items are written as children now, so `options`, `optionLabel`, `optionValue`, `optionDisabled` and `itemTemplate` are gone. Per-item `disabled` sits on the individual `ToggleButton.Root`.
|
|
1638
|
+
|
|
1639
|
+
v10's `unselectable` is the inverse of `allowEmpty`, which defaults to `true`.
|
|
1640
|
+
|
|
1641
|
+
### Sidebar → Drawer
|
|
1642
|
+
|
|
1643
|
+
[Component documentation](/docs/styled/components/drawer)
|
|
1644
|
+
|
|
1645
|
+
v10's `Sidebar` is v11's `Drawer`. There is also a component named `sidebar` in v11, but it is an application navigation shell, a different thing entirely. Mixing them up is the most likely mistake in this whole guide.
|
|
1646
|
+
|
|
1647
|
+
```jsx
|
|
1648
|
+
// v10
|
|
1649
|
+
<Sidebar visible={visible} onHide={() => setVisible(false)}>
|
|
1650
|
+
…
|
|
1651
|
+
</Sidebar>
|
|
1652
|
+
```
|
|
1653
|
+
|
|
1654
|
+
Parts: Root, Trigger, Portal, Backdrop, Popup, Header, Title, Close, Content, Footer.
|
|
1655
|
+
|
|
1656
|
+
Carried over: position, modal, blockScroll, dismissable, baseZIndex.
|
|
1657
|
+
|
|
1658
|
+
| v10 | v11 |
|
|
1659
|
+
| ---------- | ------------------- |
|
|
1660
|
+
| `visible` | `open` |
|
|
1661
|
+
| `onHide` | `onOpenChange` |
|
|
1662
|
+
| `header` | `<Drawer.Header>` |
|
|
1663
|
+
| close icon | `<Drawer.Close>` |
|
|
1664
|
+
| mask | `<Drawer.Backdrop>` |
|
|
1665
|
+
| `appendTo` | `<Drawer.Portal>` |
|
|
1666
|
+
|
|
1667
|
+
`fullScreen` is gone; sizing is done with a class on `<Drawer.Popup>`. A `Footer` part was added.
|
|
1668
|
+
|
|
1669
|
+
### Slider
|
|
1670
|
+
|
|
1671
|
+
[Component documentation](/docs/styled/components/slider)
|
|
1672
|
+
|
|
1673
|
+
Parts: Root, Track, Range, Handle.
|
|
1674
|
+
|
|
1675
|
+
`value`, `min`, `max`, `step`, `orientation` and `disabled` carry over. `onChange` became `onValueChange`, `onSlideEnd` became `onValueChangeEnd`.
|
|
1676
|
+
|
|
1677
|
+
The `range` prop is gone. A range slider is two `<Slider.Handle>` children. Which also means three or more handles work without any API change.
|
|
1678
|
+
|
|
1679
|
+
New: `minStepsBetweenHandles`, `readOnly`, `invalid`.
|
|
1680
|
+
|
|
1681
|
+
### SpeedDial
|
|
1682
|
+
|
|
1683
|
+
[Component documentation](/docs/styled/components/speeddial)
|
|
1684
|
+
|
|
1685
|
+
Parts: Root, Trigger, List, Item, Action.
|
|
1686
|
+
|
|
1687
|
+
`direction`, `type`, `radius`, `transitionDelay` and `hideOnClickOutside` carry over with the same defaults. `visible` and `onVisibleChange` carry over, joined by `defaultVisible`.
|
|
1688
|
+
|
|
1689
|
+
`model` became children, with one caveat specific to SpeedDial: `<SpeedDial.Item>` takes an explicit `index`, which the radial positioning math needs.
|
|
1690
|
+
|
|
1691
|
+
`showIcon` / `hideIcon` and `buttonTemplate` became `<SpeedDial.Trigger as={Button}>`, and the rotate animation is a CSS class such as `data-open:rotate-45` rather than the `rotateAnimation` prop.
|
|
1692
|
+
|
|
1693
|
+
The `mask` props are gone. A mask is a `Motion` sibling rendered from the same visible state.
|
|
1694
|
+
|
|
1695
|
+
### Splitter
|
|
1696
|
+
|
|
1697
|
+
[Component documentation](/docs/styled/components/splitter)
|
|
1698
|
+
|
|
1699
|
+
Parts: Root, Panel, Gutter, Handle.
|
|
1700
|
+
|
|
1701
|
+
| v10 | v11 |
|
|
1702
|
+
| -------------------------- | -------------------------------------------------- |
|
|
1703
|
+
| `layout` | `orientation` |
|
|
1704
|
+
| `<SplitterPanel size>` | `sizes` and `defaultSizes` on the root |
|
|
1705
|
+
| `gutterSize` | Gone. Thickness is styling on `<Splitter.Gutter>`. |
|
|
1706
|
+
| `stateKey`, `stateStorage` | Gone. Persisting sizes is application code now. |
|
|
1707
|
+
|
|
1708
|
+
`minSize` did not move. It stays on the panel, joined by new `maxSize`, `collapsible` and `collapsedSize`.
|
|
1709
|
+
|
|
1710
|
+
The change that breaks a straight copy is the gutter. v10 inserted one between panels automatically; v11 expects it in the markup, so a splitter with only panels renders but does not resize:
|
|
1711
|
+
|
|
1712
|
+
```jsx
|
|
1713
|
+
<Splitter.Root>
|
|
1714
|
+
<Splitter.Panel minSize={20}>…</Splitter.Panel>
|
|
1715
|
+
<Splitter.Gutter>
|
|
1716
|
+
<Splitter.Handle />
|
|
1717
|
+
</Splitter.Gutter>
|
|
1718
|
+
<Splitter.Panel>…</Splitter.Panel>
|
|
1719
|
+
</Splitter.Root>
|
|
1720
|
+
```
|
|
1721
|
+
|
|
1722
|
+
New: `onResizeStart` and `onResize` alongside `onResizeEnd`, an `onCollapse` callback, `disabled` on both the root and individual gutters, and a `panels` config array on the root as an alternative to declaring sizes per child.
|
|
1723
|
+
|
|
1724
|
+
### Steps → Stepper
|
|
1725
|
+
|
|
1726
|
+
[Steps only example](/docs/styled/components/stepper#steps-only)
|
|
1727
|
+
|
|
1728
|
+
`Steps` is the Stepper without its panels.
|
|
1729
|
+
|
|
1730
|
+
```jsx
|
|
1731
|
+
// v11
|
|
1732
|
+
<Stepper.Root defaultValue="1">
|
|
1733
|
+
<Stepper.List>
|
|
1734
|
+
<Stepper.Step value="1">
|
|
1735
|
+
<Stepper.Header>
|
|
1736
|
+
<Stepper.Number>1</Stepper.Number>
|
|
1737
|
+
<Stepper.Title>Personal</Stepper.Title>
|
|
1738
|
+
</Stepper.Header>
|
|
1739
|
+
</Stepper.Step>
|
|
1740
|
+
<Stepper.Separator />
|
|
1741
|
+
</Stepper.List>
|
|
1742
|
+
</Stepper.Root>
|
|
1743
|
+
```
|
|
1744
|
+
|
|
1745
|
+
Parts: Root, List, Step, Header, Number, Title, Separator, Item, Content, Panel, Panels.
|
|
1746
|
+
|
|
1747
|
+
`activeIndex` became `value` and takes a string key instead of an index, matching Tabs and Accordion. `onSelect` became `onValueChange`. v10's `readOnly` inverted into `linear`, which defaults to `false`.
|
|
1748
|
+
|
|
1749
|
+
Steps-only is not a mode flag. It is what happens when the `Panels` parts are left out.
|
|
1750
|
+
|
|
1751
|
+
### TabView → Tabs
|
|
1752
|
+
|
|
1753
|
+
[Component documentation](/docs/styled/components/tabs)
|
|
1754
|
+
|
|
1755
|
+
```jsx
|
|
1756
|
+
// v10
|
|
1757
|
+
<TabView>
|
|
1758
|
+
<TabPanel header="Header I">Content I</TabPanel>
|
|
1759
|
+
<TabPanel header="Header II">Content II</TabPanel>
|
|
1760
|
+
</TabView>
|
|
1761
|
+
```
|
|
1762
|
+
|
|
1763
|
+
```jsx
|
|
1764
|
+
// v11
|
|
1765
|
+
<Tabs.Root defaultValue="one">
|
|
1766
|
+
<Tabs.List>
|
|
1767
|
+
<Tabs.Tab value="one">Header I</Tabs.Tab>
|
|
1768
|
+
<Tabs.Tab value="two">Header II</Tabs.Tab>
|
|
1769
|
+
<Tabs.Indicator />
|
|
1770
|
+
</Tabs.List>
|
|
1771
|
+
<Tabs.Panels>
|
|
1772
|
+
<Tabs.Panel value="one">Content I</Tabs.Panel>
|
|
1773
|
+
<Tabs.Panel value="two">Content II</Tabs.Panel>
|
|
1774
|
+
</Tabs.Panels>
|
|
1775
|
+
</Tabs.Root>
|
|
1776
|
+
```
|
|
1777
|
+
|
|
1778
|
+
The important change is identity. v10 addressed tabs by index, v11 by a `value` string, so reordering tabs no longer silently changes which one is selected.
|
|
1779
|
+
|
|
1780
|
+
| v10 | v11 |
|
|
1781
|
+
| ------------- | ------------------------------- |
|
|
1782
|
+
| `activeIndex` | `value` with `defaultValue` |
|
|
1783
|
+
| `onTabChange` | `onValueChange` |
|
|
1784
|
+
| `<TabPanel>` | `<Tabs.Tab>` and `<Tabs.Panel>` |
|
|
1785
|
+
|
|
1786
|
+
Tab headers are children of `<Tabs.Tab>`, so `header`, `headerTemplate`, `leftIcon` and `rightIcon` are gone, an icon is simply written inside the tab. The ink bar is `<Tabs.Indicator>`, and the scroll buttons are `<Tabs.Prev>` / `<Tabs.Next>`.
|
|
1787
|
+
|
|
1788
|
+
Dropped: `renderActiveOnly`, `closable` with `onTabClose`, `scrollable` (Prev/Next parts cover it), `onBeforeTabChange`.
|
|
1789
|
+
|
|
1790
|
+
New: `selectOnFocus` and `scrollStrategy`.
|
|
1791
|
+
|
|
1792
|
+
### Terminal
|
|
1793
|
+
|
|
1794
|
+
[Component documentation](/docs/styled/components/terminal)
|
|
1795
|
+
|
|
1796
|
+
Parts: Root, Welcome, CommandList, Command, CommandPromptLabel, CommandValue, CommandResponse, Prompt, PromptLabel, PromptValue.
|
|
1797
|
+
|
|
1798
|
+
Terminal has a behavioural break, not just an API change. v10 routed command responses through `TerminalService`, a global event bus: a command was emitted, and any listener anywhere could respond. v11 replaces it with an `onCommand` callback on the component.
|
|
1799
|
+
|
|
1800
|
+
The practical difference is that responses are now local and typed instead of arriving through a singleton. Code that subscribed to `TerminalService` from another module needs restructuring, not renaming.
|
|
1801
|
+
|
|
1802
|
+
`welcomeMessage` became `<Terminal.Welcome>`, and `prompt` carries over.
|
|
1803
|
+
|
|
1804
|
+
### Timeline
|
|
1805
|
+
|
|
1806
|
+
[Component documentation](/docs/styled/components/timeline)
|
|
1807
|
+
|
|
1808
|
+
Parts: Root, Event, Opposite, Separator, Marker, Connector, Content.
|
|
1809
|
+
|
|
1810
|
+
`align` carries over, `layout` became `orientation`. The `value` array with `content`, `opposite` and `marker` templates became explicit `<Timeline.Event>` children.
|
|
1811
|
+
|
|
1812
|
+
`Connector` is a new part: the line between markers can be styled or replaced per event, which the template approach could not do.
|
|
1813
|
+
|
|
1814
|
+
### Toast
|
|
1815
|
+
|
|
1816
|
+
[Component documentation](/docs/styled/components/toast)
|
|
1817
|
+
|
|
1818
|
+
Toast changed more than any other component, and mostly for the better.
|
|
1819
|
+
|
|
1820
|
+
```jsx
|
|
1821
|
+
// v10
|
|
1822
|
+
const toast = useRef(null);
|
|
1823
|
+
|
|
1824
|
+
const show = () => toast.current.show({ severity: 'info', summary: 'Info', detail: 'Message Content' });
|
|
1825
|
+
|
|
1826
|
+
<Toast ref={toast} />
|
|
1827
|
+
<Button onClick={show} label="Show" />
|
|
1828
|
+
```
|
|
1829
|
+
|
|
1830
|
+
```jsx
|
|
1831
|
+
// v11
|
|
1832
|
+
import { toast, Toaster } from '@primereact/ui/toaster';
|
|
1833
|
+
|
|
1834
|
+
<Button
|
|
1835
|
+
onClick={() =>
|
|
1836
|
+
toast({
|
|
1837
|
+
title: 'Successfully completed',
|
|
1838
|
+
description: 'The task was completed successfully.',
|
|
1839
|
+
group: 'basic'
|
|
1840
|
+
})
|
|
1841
|
+
}
|
|
1842
|
+
>
|
|
1843
|
+
Create toast
|
|
1844
|
+
</Button>;
|
|
1845
|
+
```
|
|
1846
|
+
|
|
1847
|
+
`toast()` is a module-level function. No ref, no component instance to reach, so a toast can be raised from an event handler, a service module or a route loader without threading a ref through the tree. Alongside it: `toast.success`, `toast.info`, `toast.warn`, `toast.error`, plus `toast.update`, `toast.dismiss` and `toast.promise`.
|
|
1848
|
+
|
|
1849
|
+
The message shape changed: `summary` → `title`, `detail` → `description`, and `life` moved to the `Toaster` as a `timeout`.
|
|
1850
|
+
|
|
1851
|
+
Rendering is now explicit. A `<Toaster.Root>` with a `<Toaster.Region>` render-prop maps over `toaster.toasts` and renders a `<Toast.Root>` for each. That is more setup than dropping `<Toast ref={toast} />` into a layout, but it is what makes per-severity icons, an action button and custom layouts possible without pass-through overrides:
|
|
1852
|
+
|
|
1853
|
+
```jsx
|
|
1854
|
+
<Toast.Icon match="success">
|
|
1855
|
+
<Check />
|
|
1856
|
+
</Toast.Icon>
|
|
1857
|
+
<Toast.Icon match="error">
|
|
1858
|
+
<Times />
|
|
1859
|
+
</Toast.Icon>
|
|
1860
|
+
```
|
|
1861
|
+
|
|
1862
|
+
New on the Toaster: `limit`, `gap`, and `mode` for stacked or expanded presentation.
|
|
1863
|
+
|
|
1864
|
+
### ToggleButton
|
|
1865
|
+
|
|
1866
|
+
[Component documentation](/docs/styled/components/togglebutton)
|
|
1867
|
+
|
|
1868
|
+
Parts: Root, Indicator.
|
|
1869
|
+
|
|
1870
|
+
The semantics changed along with the names: `checked` became `pressed` and `onChange` became `onPressedChange`, because v11 renders a real `<button>` with `aria-pressed` rather than a checkbox-like control.
|
|
1871
|
+
|
|
1872
|
+
`onLabel` / `offLabel` and `onIcon` / `offIcon` collapsed into `<ToggleButton.Indicator>` plus children, with ordering deciding icon position, `iconPos` is gone.
|
|
1873
|
+
|
|
1874
|
+
### Toolbar
|
|
1875
|
+
|
|
1876
|
+
[Component documentation](/docs/styled/components/toolbar)
|
|
1877
|
+
|
|
1878
|
+
```jsx
|
|
1879
|
+
// v10
|
|
1880
|
+
<Toolbar start={leftContent} center={centerContent} end={rightContent} />
|
|
1881
|
+
```
|
|
1882
|
+
|
|
1883
|
+
```jsx
|
|
1884
|
+
// v11
|
|
1885
|
+
<Toolbar.Root>
|
|
1886
|
+
<Toolbar.Start>…</Toolbar.Start>
|
|
1887
|
+
<Toolbar.Center>…</Toolbar.Center>
|
|
1888
|
+
<Toolbar.End>…</Toolbar.End>
|
|
1889
|
+
</Toolbar.Root>
|
|
1890
|
+
```
|
|
1891
|
+
|
|
1892
|
+
Parts: `Root`, `Start`, `Center`, `End`. The deprecated v10 `left` and `right` aliases are gone along with the `start`/`center`/`end` props they duplicated.
|
|
1893
|
+
|
|
1894
|
+
### Tooltip
|
|
1895
|
+
|
|
1896
|
+
[Component documentation](/docs/styled/components/tooltip)
|
|
1897
|
+
|
|
1898
|
+
```jsx
|
|
1899
|
+
// v10
|
|
1900
|
+
<Button label="Save" tooltip="Save the form" tooltipOptions={{ position: 'top' }} />
|
|
1901
|
+
```
|
|
1902
|
+
|
|
1903
|
+
```jsx
|
|
1904
|
+
// v11
|
|
1905
|
+
<Tooltip.Root>
|
|
1906
|
+
<Tooltip.Trigger as={Button}>Save</Tooltip.Trigger>
|
|
1907
|
+
<Tooltip.Portal>
|
|
1908
|
+
<Tooltip.Positioner side="top">
|
|
1909
|
+
<Tooltip.Popup>Save the form</Tooltip.Popup>
|
|
1910
|
+
</Tooltip.Positioner>
|
|
1911
|
+
</Tooltip.Portal>
|
|
1912
|
+
</Tooltip.Root>
|
|
1913
|
+
```
|
|
1914
|
+
|
|
1915
|
+
Parts: Root, Trigger, Portal, Positioner, Popup, Arrow, Manager.
|
|
1916
|
+
|
|
1917
|
+
The `tooltip` prop that appeared on nearly every v10 component is gone everywhere. Tooltips wrap the element instead, so their content can be markup instead of a string.
|
|
1918
|
+
|
|
1919
|
+
| v10 | v11 | Note |
|
|
1920
|
+
| ----------- | ------------------ | --------------------------- |
|
|
1921
|
+
| `position` | `side` and `align` | On `<Tooltip.Positioner>` |
|
|
1922
|
+
| `showDelay` | `openDelay` | Default is now 600ms, was 0 |
|
|
1923
|
+
| `hideDelay` | `closeDelay` | Default is now 100ms, was 0 |
|
|
1924
|
+
| `autoHide` | `interactive` | Defaults to `true` |
|
|
1925
|
+
|
|
1926
|
+
`Tooltip.Manager` is new: an optional provider that shares timing across tooltips, so moving between adjacent triggers skips the open delay.
|
|
1927
|
+
|
|
1928
|
+
Dropped: `showEvent`, `hideEvent`, `mouseTrack`, `my` / `at`, `showOnDisabled`, `appendTo`.
|
|
1929
|
+
|
|
1930
|
+
### Tree
|
|
1931
|
+
|
|
1932
|
+
[Component documentation](/docs/styled/components/tree)
|
|
1933
|
+
|
|
1934
|
+
Parts: Root, Header, Content, Nodes, Node, Label, Toggle, ToggleIndicator, Selection, Filter, DropIndicator, Loading, Empty, Footer.
|
|
1935
|
+
|
|
1936
|
+
`value`, `selectionMode`, `metaKeySelection`, `loading` and the expand/collapse callbacks carry over. Selection and expansion gained the uncontrolled halves: `defaultExpandedKeys` and `defaultSelectionKeys`.
|
|
1937
|
+
|
|
1938
|
+
Drag and drop was rebuilt: the single `dragdropScope` string became `draggable` and `droppable` with `draggableScope` / `droppableScope`, plus `onMove` and a `validateMove` callback that can reject a drop.
|
|
1939
|
+
|
|
1940
|
+
Templates became parts: `nodeTemplate` → `<Tree.Node>`, `togglerTemplate` and the expand/collapse icons → `<Tree.Toggle>` with `<Tree.ToggleIndicator>`, `checkboxIcon` → `<Tree.Selection>`, `emptyMessage` → `<Tree.Empty>`.
|
|
1941
|
+
|
|
1942
|
+
Filtering moved to the `useTreeFilter` hook, so `filter`, `filterBy`, `filterMode` and their relatives are gone. `propagateSelectionUp` and `propagateSelectionDown` were dropped as well.
|
|
1943
|
+
|
|
1944
|
+
### TreeSelect → Select with a Tree
|
|
1945
|
+
|
|
1946
|
+
[Tree example](/docs/styled/components/select#tree)
|
|
1947
|
+
|
|
1948
|
+
TreeSelect is a composition: a `Select` whose popup holds a `Tree`.
|
|
1949
|
+
|
|
1950
|
+
The Select supplies `Trigger`, `Value`, `Portal`, `Positioner` and `Popup`; the Tree supplies the nodes and selection. The display label is computed in application code from the selected key. The demo walks the node path to build it.
|
|
1951
|
+
|
|
1952
|
+
`nodeTemplate` and `togglerTemplate` become Tree parts, `panelHeaderTemplate` and `panelFooterTemplate` become `<Select.Header>` and `<Select.Footer>`.
|
|
1953
|
+
|
|
1954
|
+
### TreeTable → DataTable with `treeMode`
|
|
1955
|
+
|
|
1956
|
+
[TreeTable documentation](/docs/styled/components/treetable)
|
|
1957
|
+
|
|
1958
|
+
TreeTable is not a separate component in v11. A tree table is a DataTable with `treeMode` set and nested `children` on the data nodes, using the same parts as any other table.
|
|
1959
|
+
|
|
1960
|
+
```jsx
|
|
1961
|
+
<DataTable.Root data={nodes} treeMode expandedKeys={expandedKeys} onExpandedChange={(e) => setExpandedKeys(e.value)}>
|
|
1962
|
+
…
|
|
1963
|
+
<DataTable.TBody>
|
|
1964
|
+
{({ item }) => (
|
|
1965
|
+
<DataTable.Row key={item.key}>
|
|
1966
|
+
<DataTable.Cell>
|
|
1967
|
+
<DataTable.RowToggle>
|
|
1968
|
+
<DataTable.RowToggleIndicator match="expanded">
|
|
1969
|
+
<ChevronDown />
|
|
1970
|
+
</DataTable.RowToggleIndicator>
|
|
1971
|
+
<DataTable.RowToggleIndicator match="collapsed">
|
|
1972
|
+
<ChevronRight />
|
|
1973
|
+
</DataTable.RowToggleIndicator>
|
|
1974
|
+
</DataTable.RowToggle>
|
|
1975
|
+
{item.data.name}
|
|
1976
|
+
</DataTable.Cell>
|
|
1977
|
+
</DataTable.Row>
|
|
1978
|
+
)}
|
|
1979
|
+
</DataTable.TBody>
|
|
1980
|
+
</DataTable.Root>
|
|
1981
|
+
```
|
|
1982
|
+
|
|
1983
|
+
In v10 these were two separate implementations. `DataTable.js` was around 2,100 lines and `TreeTable.js` around 1,450, each with its own sorting, filtering, paging, selection, column resizing and reordering. The consequences were visible from the outside:
|
|
1984
|
+
|
|
1985
|
+
- Features arrived in one and not the other. A DataTable capability was not automatically a TreeTable capability, and the prop lists drifted apart.
|
|
1986
|
+
- The two had separate bug surfaces. The same logical bug could exist in both and be fixed in one.
|
|
1987
|
+
- Switching a flat table to a hierarchical one meant rewriting the component, not adding a prop.
|
|
1988
|
+
|
|
1989
|
+
In v11 there is one table. Turning on `treeMode` keeps every part, every feature and every piece of state exactly where it was, so a flat table becomes a tree by adding a prop and a toggle part.
|
|
1990
|
+
|
|
1991
|
+
Expansion state is `expandedKeys` with `defaultExpandedKeys`, and the toggle is `<DataTable.RowToggle>` holding `<DataTable.RowToggleIndicator match="expanded">` and its collapsed counterpart. The `<Column>` translation is the one described in the DataTable section above.
|
|
1992
|
+
|
|
1993
|
+
Dropped alongside the DataTable list: `propagateSelectionUp`, `propagateSelectionDown` and `frozenWidth`.
|
|
1994
|
+
|
|
1995
|
+
### VirtualScroller
|
|
1996
|
+
|
|
1997
|
+
`VirtualScroller` is not available in v11 yet. The package directories exist but are empty.
|
|
1998
|
+
|
|
1999
|
+
Virtualization is being worked on as the `useVirtualizer` hook, which the consumer applies to a list instead of the component embedding it. Until it ships, lists that relied on `virtualScrollerOptions` in DataTable, Listbox, Select or Tree have no built-in equivalent.
|
|
2000
|
+
|
|
2001
|
+
### Display components
|
|
2002
|
+
|
|
2003
|
+
These stayed single elements, so the migration is a rename or two at most.
|
|
2004
|
+
|
|
2005
|
+
| Component | Carried over | Changed |
|
|
2006
|
+
| ------------- | --------------------------------------------------------------- | ---------------------------------------- |
|
|
2007
|
+
| `Skeleton` | `shape`, `size`, `width`, `height`, `borderRadius`, `animation` | Nothing |
|
|
2008
|
+
| `Badge` | `severity`, `size` | `value` is children now. Gained `shape`. |
|
|
2009
|
+
| `Tag` | `severity`, `rounded` | `value` and `icon` are children now. |
|
|
2010
|
+
| `Divider` | `align`, `type` | `layout` is `orientation` |
|
|
2011
|
+
| `AvatarGroup` | Wraps `Avatar` children as before | Nothing |
|
|
2012
|
+
| `ButtonGroup` | Wraps `Button` children as before | Nothing |
|
|
2013
|
+
| `InputGroup` | Wraps input children as before | Nothing |
|
|
2014
|
+
|
|
2015
|
+
```jsx
|
|
2016
|
+
// v10
|
|
2017
|
+
<Tag value="New" severity="success" icon="pi pi-check" />
|
|
2018
|
+
<Badge value="8" severity="danger" />
|
|
2019
|
+
```
|
|
2020
|
+
|
|
2021
|
+
```jsx
|
|
2022
|
+
// v11
|
|
2023
|
+
<Tag severity="success">
|
|
2024
|
+
<Check /> New
|
|
2025
|
+
</Tag>
|
|
2026
|
+
<Badge severity="danger">8</Badge>
|
|
2027
|
+
```
|
|
2028
|
+
|
|
2029
|
+
The v10 pattern of attaching a badge to another component through a `badge` prop is the new `OverlayBadge` component.
|
|
2030
|
+
|
|
2031
|
+
## Hooks
|
|
2032
|
+
|
|
2033
|
+
v10 shipped a set of hooks from `primereact/hooks`. v11 moved them to `@primereact/hooks` and reworked the list. Each one has its own page in the [hooks documentation](/docs/hooks/gettingstarted/introduction).
|
|
2034
|
+
|
|
2035
|
+
**Same name, same purpose.**
|
|
2036
|
+
|
|
2037
|
+
useEventListener, useIntersectionObserver, useMatchMedia, useMountEffect, useUnmountEffect, useUpdateEffect, usePrevious
|
|
2038
|
+
|
|
2039
|
+
**Renamed.**
|
|
2040
|
+
|
|
2041
|
+
| v10 | v11 |
|
|
2042
|
+
| ------------ | ----------------- |
|
|
2043
|
+
| `useStorage` | `useLocalStorage` |
|
|
2044
|
+
|
|
2045
|
+
**No longer provided.** Most of these were general-purpose utilities rather than anything specific to a UI library, and are a few lines to write or available from any hook collection:
|
|
2046
|
+
|
|
2047
|
+
useClickOutside, useCounter, useDebounce, useDisplayOrder, useFavicon, useGlobalOnEscapeKey, useInterval, useMouse, useMove, useResizeListener, useTimeout
|
|
2048
|
+
|
|
2049
|
+
`useLocale` was replaced by the locale API described above. `useStyle`, `useMergeProps`, `useOverlayListener` and `useOverlayScrollListener` were internal plumbing that the new architecture handles inside the components.
|
|
2050
|
+
|
|
2051
|
+
**New in v11.** Several of these carry behaviour that used to be locked inside a component:
|
|
2052
|
+
|
|
2053
|
+
| Hook | What it does |
|
|
2054
|
+
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
2055
|
+
| `useMask` | Input masking, replacing the `InputMask` component |
|
|
2056
|
+
| `useKeyFilter` | Key filtering, replacing the `KeyFilter` component |
|
|
2057
|
+
| `useFilter`, `useTreeFilter` | The filtering that components used to do internally |
|
|
2058
|
+
| `useScrollTop` | Replacing the `ScrollTop` component |
|
|
2059
|
+
| `useControlledState` | The controlled and uncontrolled pattern components use |
|
|
2060
|
+
| `useSortableList` | Drag-to-reorder behaviour |
|
|
2061
|
+
| `useHotKey` | Keyboard shortcuts |
|
|
2062
|
+
| `useIsMobile`, `useDirection`, `useVisibilityChange` | Environment state |
|
|
2063
|
+
| `useNumberFormatter`, `useViewTransition`, `usePresence`, `useQueueTask`, `useMounted`, `useId` | Smaller utilities used across components |
|
|
2064
|
+
|
|
2065
|
+
## Component Map
|
|
2066
|
+
|
|
2067
|
+
### Same name
|
|
2068
|
+
|
|
2069
|
+
These 54 keep their v10 name. The API still changed, most became compound, but imports and mental model carry over:
|
|
2070
|
+
|
|
2071
|
+
Accordion, AutoComplete, Avatar, AvatarGroup, Badge, Breadcrumb, Button, ButtonGroup, Card, Carousel, Checkbox, Chip, ContextMenu, DataTable, DataView, Dialog, Divider, Fieldset, FileUpload, FloatLabel, FocusTrap, IconField, Inplace, InputNumber, InputOtp, InputText, Knob, Listbox, Menu, Message, MeterGroup, OrganizationChart, Paginator, Panel, ProgressBar, ProgressSpinner, RadioButton, Rating, Sidebar, Skeleton, Slider, SpeedDial, Splitter, Stepper, StyleClass, Tag, Terminal, Timeline, Toast, ToggleButton, Toolbar, Tooltip, Tree, VirtualScroller
|
|
2072
|
+
|
|
2073
|
+
`Sidebar` is the exception worth repeating: the name survived but the meaning did not. v10's `Sidebar` is v11's `Drawer`.
|
|
2074
|
+
|
|
2075
|
+
### Renamed
|
|
2076
|
+
|
|
2077
|
+
| v10 | v11 |
|
|
2078
|
+
| ---------------------- | ------------------- |
|
|
2079
|
+
| `Dropdown` | `Select` |
|
|
2080
|
+
| `Calendar` | `DatePicker` |
|
|
2081
|
+
| `OverlayPanel` | `Popover` |
|
|
2082
|
+
| `Sidebar` | `Drawer` |
|
|
2083
|
+
| `InputSwitch` | `ToggleSwitch` |
|
|
2084
|
+
| `TabView` + `TabPanel` | `Tabs` |
|
|
2085
|
+
| `InputTextarea` | `Textarea` |
|
|
2086
|
+
| `Password` | `InputPassword` |
|
|
2087
|
+
| `Chips` | `InputTags` |
|
|
2088
|
+
| `ColorPicker` | `InputColor` |
|
|
2089
|
+
| `Galleria` | `Gallery` |
|
|
2090
|
+
| `ScrollPanel` | `ScrollArea` |
|
|
2091
|
+
| `SelectButton` | `ToggleButtonGroup` |
|
|
2092
|
+
|
|
2093
|
+
### Folded into another component
|
|
2094
|
+
|
|
2095
|
+
Still available, written differently. Each one has a working example in the linked documentation.
|
|
2096
|
+
|
|
2097
|
+
| v10 | v11 | Example |
|
|
2098
|
+
| ------------------------------ | -------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
2099
|
+
| `MultiSelect` | `Select` with `multiple` | [Multiple](/docs/styled/components/select#multiple) |
|
|
2100
|
+
| `TreeTable` | `DataTable` with `treeMode` | [TreeTable](/docs/styled/components/treetable) |
|
|
2101
|
+
| `Column`, `ColumnGroup`, `Row` | DataTable cell and row parts | [DataTable](/docs/styled/components/datatable) |
|
|
2102
|
+
| `TabPanel` | `Tabs.Panel` | [Tabs](/docs/styled/components/tabs) |
|
|
2103
|
+
| `AccordionTab` | `Accordion.Panel` | [Accordion](/docs/styled/components/accordion) |
|
|
2104
|
+
| `StepperPanel` | `Stepper.Panel` | [Stepper](/docs/styled/components/stepper) |
|
|
2105
|
+
| `Steps` | `Stepper`, steps-only mode | [Steps only](/docs/styled/components/stepper#steps-only) |
|
|
2106
|
+
| `TieredMenu` | `Menu` with nested submenus | [Tiered menu](/docs/styled/components/menu#tiered-menu) |
|
|
2107
|
+
| `MegaMenu`, `Menubar` | `NavigationMenu` | [Mega menu](/docs/styled/components/navigationmenu#mega-menu) |
|
|
2108
|
+
| `Messages` | An array rendered as `Message` | [Dynamic](/docs/styled/components/message#dynamic) |
|
|
2109
|
+
| `SplitButton` | `ButtonGroup` with `Menu` | [Split button](/docs/styled/components/buttongroup#split-button) |
|
|
2110
|
+
| `SelectButton` | `ToggleButtonGroup` | [ToggleButtonGroup](/docs/styled/components/togglebuttongroup) |
|
|
2111
|
+
| `Image` | `Gallery`, single item | [Single](/docs/styled/components/gallery#single) |
|
|
2112
|
+
| `CascadeSelect` | `Select` with `Menu` | [Cascade](/docs/styled/components/select#cascade) |
|
|
2113
|
+
| `TreeSelect` | `Select` with tree-shaped options | [Tree](/docs/styled/components/select#tree) |
|
|
2114
|
+
| `ConfirmDialog` | `Dialog`, or the overlay manager for the imperative form | [Confirmation](/docs/styled/components/dialog#confirmation) |
|
|
2115
|
+
|
|
2116
|
+
### Became hooks
|
|
2117
|
+
|
|
2118
|
+
Behaviour without markup attached, so it composes with any input:
|
|
2119
|
+
|
|
2120
|
+
| v10 | v11 | Example |
|
|
2121
|
+
| ----------- | -------------- | ---------------------------------------------- |
|
|
2122
|
+
| `InputMask` | `useMask` | [InputMask](/docs/styled/components/inputmask) |
|
|
2123
|
+
| `KeyFilter` | `useKeyFilter` | [KeyFilter](/docs/styled/components/keyfilter) |
|
|
2124
|
+
| `ScrollTop` | `useScrollTop` | [useScrollTop](/docs/hooks/use-scrolltop) |
|
|
2125
|
+
| `OrderList` | `useOrderList` | [OrderList](/docs/styled/components/orderlist) |
|
|
2126
|
+
| `PickList` | `usePickList` | [PickList](/docs/styled/components/picklist) |
|
|
2127
|
+
|
|
2128
|
+
`useMask` on an `InputText` does what `InputMask` did, and the same hook works on any other input. `OrderList` and `PickList` return their reordering logic and leave the list rendering to `Listbox` and `Button`, so neither is a fixed layout anymore.
|
|
2129
|
+
|
|
2130
|
+
Filtering moved the same way. The `filter`, `filterBy`, `filterMatchMode` and `filterLocale` props that appeared on Dropdown, MultiSelect, Listbox, Tree, OrderList and PickList are gone; `useFilter` and `useTreeFilter` provide the matching logic, and the component supplies a `Filter` part for the input. Remote search, fuzzy matching and debouncing become ordinary code rather than a prop that either fits or doesn't.
|
|
2131
|
+
|
|
2132
|
+
### Moved to PrimeUI Pro
|
|
2133
|
+
|
|
2134
|
+
The heavier components that wrapped third-party libraries are part of the commercial [PrimeUI Pro](https://primeuipro.dev) suite:
|
|
2135
|
+
|
|
2136
|
+
| v10 | Pro package |
|
|
2137
|
+
| -------- | ------------------------ |
|
|
2138
|
+
| `Chart` | `@primeuipro/chart` |
|
|
2139
|
+
| `Editor` | `@primeuipro/texteditor` |
|
|
2140
|
+
|
|
2141
|
+
Pro also adds components v10 never had. A Scheduler and a Task Board, with a PDF Viewer, Diagram, Grid and Gantt Chart listed as coming.
|
|
2142
|
+
|
|
2143
|
+
### Not available yet
|
|
2144
|
+
|
|
2145
|
+
`VirtualScroller` has package directories in place but no implementation. Work is underway on the `useVirtualizer` hook, applied by the consumer rather than embedded in each list. Until it lands, `virtualScrollerOptions` in DataTable, Listbox, Select and Tree has no equivalent.
|
|
2146
|
+
|
|
2147
|
+
### Removed
|
|
2148
|
+
|
|
2149
|
+
These twelve are not part of v11 and are not planned. Most were single-purpose components whose behaviour is now a short composition of existing parts, so porting them would have added a wrapper and nothing else.
|
|
2150
|
+
|
|
2151
|
+
| v10 | Build it with |
|
|
2152
|
+
| -------------------- | ------------------------------------------------------------------------------------- |
|
|
2153
|
+
| `ConfirmPopup` | `Popover` with its `Header`, `Title`, `Description`, `Footer` and `Close` parts |
|
|
2154
|
+
| `BlockUI` | `Dialog` in modal mode with `Dialog.Backdrop`, or a `ProgressSpinner` over the region |
|
|
2155
|
+
| `PanelMenu` | `Accordion` wrapping `Menu`, the pairing the navbar demo already uses |
|
|
2156
|
+
| `TabMenu` | `Tabs`, with routing wired in application code |
|
|
2157
|
+
| `DeferredContent` | The `useIntersectionObserver` hook with conditional rendering, or `AnimateOnScroll` |
|
|
2158
|
+
| `DataScroller` | `DataView` with `useScrollTop` or an intersection observer driving the next page |
|
|
2159
|
+
| `TriStateCheckbox` | `Checkbox` with `indeterminate`, cycling the value |
|
|
2160
|
+
| `MultiStateCheckbox` | `Checkbox` with `indeterminate`, or `ToggleButtonGroup` for more than three states |
|
|
2161
|
+
|
|
2162
|
+
The remaining four have no equivalent building block:
|
|
2163
|
+
|
|
2164
|
+
| v10 | Note |
|
|
2165
|
+
| ----------- | --------------------------------------------------------------------- |
|
|
2166
|
+
| `SlideMenu` | `Menu` covers nested navigation, but not the sliding panel stack |
|
|
2167
|
+
| `Mention` | `AutoComplete` covers suggestion lists, but not inline `@` triggering |
|
|
2168
|
+
| `Dock` | No counterpart |
|
|
2169
|
+
| `Ripple` | The effect is not part of v11 |
|
|
2170
|
+
|
|
2171
|
+
### New in v11
|
|
2172
|
+
|
|
2173
|
+
Components with no v10 counterpart:
|
|
2174
|
+
|
|
2175
|
+
AnimateOnScroll, CheckboxGroup, Collapsible, Compare, Fluid, IftaLabel, InputGroup, Label, NavigationMenu, OverlayBadge, RadioButtonGroup, Toaster, VisuallyHidden
|
|
2176
|
+
|
|
2177
|
+
## Summary of the New Model
|
|
2178
|
+
|
|
2179
|
+
Migrating costs real time. This is what the new structure gives back.
|
|
2180
|
+
|
|
2181
|
+
| Area | v10 | v11 |
|
|
2182
|
+
| ---------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
2183
|
+
| **Icons** | A class name string, so an icon font, no props, fixed position | Any element: an SVG from any library, an `<img>`, a spinner, an emoji |
|
|
2184
|
+
| **Templates** | A function returning markup the component then placed | The part _is_ the markup, taking `className`, `onClick`, `ref`, `data-*`, children |
|
|
2185
|
+
| **State slots** | Several `*Icon` props, hoping the internal conditions matched | `match` renders a slot only in the state it names |
|
|
2186
|
+
| **Portals** | `appendTo` quietly moved a subtree elsewhere in the DOM | `<Select.Portal>` says so in the markup |
|
|
2187
|
+
| **Positioning** | Automatic placement plus an `align()` method | `<Popover.Positioner side align flip shift>`, the same part in every overlay |
|
|
2188
|
+
| **Polymorphism** | Fixed elements, or a `*Template` prop to replace one | `as` on every part: `<Dialog.Trigger as={Button}>` is a real Button |
|
|
2189
|
+
| **Reach** | The right `pt` key, or a CSS selector against `p-*` classes | Every internal element is a named export |
|
|
2190
|
+
|
|
2191
|
+
State-matched slots replace the conditional rendering that used to surround icon props:
|
|
2192
|
+
|
|
2193
|
+
```jsx
|
|
2194
|
+
<Toast.Icon match="success">
|
|
2195
|
+
<Check />
|
|
2196
|
+
</Toast.Icon>
|
|
2197
|
+
<Toast.Icon match="error">
|
|
2198
|
+
<Times />
|
|
2199
|
+
</Toast.Icon>
|
|
2200
|
+
```
|
|
2201
|
+
|
|
2202
|
+
And `as` keeps a part's behaviour while changing what it renders, so a trigger is a real Button with the full Button API instead of a fixed element with a handful of styling props:
|
|
2203
|
+
|
|
2204
|
+
```jsx
|
|
2205
|
+
<Dialog.Trigger as={Button} severity="secondary" variant="outlined">
|
|
2206
|
+
Open
|
|
2207
|
+
</Dialog.Trigger>
|
|
2208
|
+
```
|
|
2209
|
+
|
|
2210
|
+
## Next Steps
|
|
2211
|
+
|
|
2212
|
+
- [Installation](/docs/styled/guides/installation), framework-specific setup
|
|
2213
|
+
- [Configuration](/docs/styled/guides/configuration), provider options, theme, locale, CSP
|
|
2214
|
+
- [Styled mode](/docs/styled/guides/theming/styled), building a theme preset from design tokens
|
|
2215
|
+
- [Internationalization](/docs/styled/guides/misc/internationalization), the replacement for `primereact/api` locale helpers
|
|
2216
|
+
- [Pass Through](/docs/styled/guides/misc/passthrough), the current slot keys
|
|
2217
|
+
- [Accessibility](/docs/styled/guides/misc/accessibility), what components provide out of the box
|
|
2218
|
+
|
|
2219
|
+
Questions about a specific component are best answered by its own documentation page, where every part is listed with its props.
|