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: README.md
+69Lines changed: 69 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,21 @@ Make sure to setup the following Providers at the root of your app:
42
42
43
43
The `EchoesProvider` is required to provide theming and configuration context for all Echoes components.
44
44
45
+
If your application uses a strict Content Security Policy (CSP), you can provide a nonce to the `EchoesProvider` to enable inline styles required by Echoes components:
<EchoesProvidernonce={nonce}>{/* your app */}</EchoesProvider>;
51
+
```
52
+
53
+
This nonce will be automatically applied to:
54
+
55
+
- Emotion's CSS-in-JS style tags
56
+
- react-joyride inline styles used in the Spotlight component
57
+
58
+
For more information about CSP configuration, see the [Content Security Policy](#content-security-policy) section.
59
+
45
60
#### Intl Provider
46
61
47
62
The `IntlProvider` from `react-intl` is necessary for translations. See [this page](https://formatjs.github.io/docs/react-intl/components#intlprovider) for more information.
@@ -205,6 +220,60 @@ If tooltips or other overlay components don't appear correctly, ensure you have
205
220
206
221
If you encounter errors about missing router context when using Link components or other routing-related components, make sure you have wrapped your app with a Router provider from `react-router-dom` (e.g., `BrowserRouter`, `HashRouter`, or `MemoryRouter`).
207
222
223
+
## Content Security Policy
224
+
225
+
Echoes React supports strict Content Security Policy (CSP) configurations. To use Echoes with a CSP that restricts inline styles, you need to configure nonces.
-`'nonce-RANDOM_VALUE'` - A cryptographically secure random nonce generated per request (required for Emotion CSS-in-JS and Spotlight/react-joyride inline styles)
245
+
-`'unsafe-hashes'` with three SHA-256 hashes - Required only for sonner toast notification animations
* It must be placed at the root of your application (or at least wrap all
56
70
* components that use the Echoes design system). To ensure all Echoes components work properly,
57
71
* the EchoesProvider should be placed inside the react-intl provider and react-router provider.
58
-
* Ideally, you should also wrap your application with a div that reset the [Stacking Context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context)
72
+
* Ideally, you should also wrap your application with a div that reset the
0 commit comments