You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/documentation-site/patternfly-docs/content/design-guidelines/styles/motion/motion-development.md
+89-30Lines changed: 89 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,52 +4,113 @@ section: design-foundations
4
4
source: development-guide
5
5
---
6
6
7
-
## Opt-in animations
7
+
## Enabling opt-in animations
8
8
9
-
We try to support animations by default in our components, but—to avoid introducing breaking changes—some animations require you to manually opt in. In order to function properly, opt-in animations require additional updates to your codebase. Depending on how your testing is set up, opt-in animation could cause test failures, so you must manually configure them appropriately.
9
+
We try to support animations by default in our components, but—to avoid introducing breaking changes—some animations require you to manually opt in. Opt-in animations require additional updates to your codebase and, depending on your testing setup, could cause test failures if not configured appropriately.
10
10
11
-
**Note:** In some edge cases, resource-intensive pages can cause browser memory issues where animations will fail to run correctly. For example, animated spinners are particularly memory intensive, so adding multiple spinners to a page might consume too much memory and disable all animations.
11
+
The following components contain opt-in animations, with links to examples for proper implementation:
12
12
13
-
The following components contain opt-in animations. To understand the opt-in implementation, view the linked example code.
- Tree view: [Example](/components/tree-view/) (all examples)
24
+
**Note:** In some edge cases, resource-intensive pages can cause browser memory issues where animations fail to run correctly. For example, animated spinners are particularly memory intensive, so a page with multiple spinners might consume too much memory and disable all animations.
25
25
26
-
### enable-animations codemod
26
+
### Bulk-enabling animations
27
27
28
-
We have also created an [enable-animations codemod](https://github.com/patternfly/pf-codemods/tree/main/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations), which adds the `hasAnimations` prop to components that require opt-in animations.
28
+
We offer the [enable-animations codemod](https://github.com/patternfly/pf-codemods/tree/main/packages/eslint-plugin-pf-codemods/src/rules/v6/enableAnimations) that automatically adds the `hasAnimations` prop to components that require opt-in.
29
29
30
-
Keep in mind that, depending on your codebase, this codemod could introduce breaking changes that require further attention. In particular, when you run the codemod you will be asked whether you want to opt into animations for table components, or just for the react-core package.
30
+
Be aware that, depending on your codebase, this codemod could introduce breaking changes that require further attention. When you run the codemod you will be asked whether to opt into animations only for the [@patternfly/react-core](https://www.npmjs.com/package/@patternfly/react-core) package or for [@patternfly/react-table](https://www.npmjs.com/package/@patternfly/react-table) as well.
31
31
32
-
To enable the optional animations run the following command:
32
+
To enable opt-in animations run the following command:
The `AnimationsProvider` is a React context provider that gives you global control over animation behavior in your application. Using it allows you to centrally manage animations across all PatternFly components in your codebase, making it easy to disable them for users who prefer reduced motion or to optimize performance.
39
+
40
+
#### Recommended setup and usage
41
+
42
+
Place the `AnimationsProvider` at the root of your application to provide global animation configuration for all PatternFly components, either passing in `hasAnimations: true` or `hasAnimations: false`:
When using the `AnimationsProvider`, you can still pass `hasAnimations` directly to a component to override the global setting of `true` or `false`. For example: `<AlertGroup isToast hasAnimations={false}>` will override a global setting of `true`.
64
+
65
+
You can also wrap components with the `AnimationsProvider` and control animations there:
For some scenarios, like creating a new [PatternFly extension](/extensions/about-extensions), you may need to implement custom motion behavior that doesn't already exist in PatternFly components. When you're creating a new animation, make sure that:
101
+
For some scenarios, like creating a new [PatternFly extension](/extensions/about-extensions), you might need to implement custom motion behavior. When creating a new animation, ensure the following:
39
102
- There is no existing support for the animation.
40
-
- The animation adheres to our motion principles and respects users' [`prefers-reduced-motion` settings.](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion)
103
+
- The animation adheres to our motion principles and respects [`prefers-reduced-motion` settings.](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion)
41
104
- Your implementation uses appropriate semantic motion tokens, as detailed in the following section.
42
105
43
106
## Motion tokens
44
107
45
-
PatternFly component animations are created using design tokens that cover the different elements of an animation, including duration, delay, and timing. Like we do with color tokens, we implement motion by using semantic tokens, which are built off of base tokens. Motion tokens begin with `--pf-t--global--motion--`
108
+
PatternFly component animations are created using design tokens that specify duration, delay, and timing. We implement motion by using semantic tokens, which are built off of base tokens. Semantic motion tokens begin with `--pf-t--global--motion--`
46
109
47
-
You can [search for motion tokens here.](/tokens/all-patternfly-tokens)
48
-
49
-
If you aren't familiar with our token system, [refer to this overview](/tokens/about-tokens).
110
+
When implementing custom motion, you should [familiarize yourself with our token system](/tokens/about-tokens) and [use the motion tokens outlined in our documentation.](/tokens/all-patternfly-tokens)
50
111
51
112
### Duration
52
-
Duration tokens specify the length of time that different animation should take to complete. There are predefined duration tokens based on the type of animation, shown in the following table;
113
+
Duration tokens specify the length of time that different animation should take to complete. We offer predefined duration tokens based on each type of animation.
53
114
54
115
|**Animation**|**Description**|**Tokens**|
55
116
| --- | --- | --- |
@@ -60,7 +121,7 @@ Duration tokens specify the length of time that different animation should take
60
121
<br />
61
122
62
123
### Delay
63
-
Delay tokens specify the length of time that should pass before an animation begins. Delay options include none, short, default, and long.
124
+
Delay tokens specify the length of time that should pass before an animation begins, including "none", "short", "default", and "long".
64
125
65
126
|**Token**|**Value**|
66
127
| --- | --- |
@@ -71,9 +132,7 @@ Delay tokens specify the length of time that should pass before an animation beg
71
132
<br />
72
133
73
134
### Timing
74
-
Timing-function tokens specify the easing path that an animation takes. These paths are defined by [cubic Bezier curves,](https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#cubic_b%C3%A9zier_easing_function) which define the start and end points of a curve, as well as its initial and final times and states.
75
-
76
-
The available options for timing are described in the following table:
135
+
Timing tokens specify the easing path that an animation takes, defined as [cubic Bezier curves,](https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#cubic_b%C3%A9zier_easing_function) that indicate the start and end points of a curve, as well as the initial and final times and states.
0 commit comments