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
> For comprehensive documentation on the RichText component including all props, advanced customization options, fallback handling, and TypeScript support, see the [RichText Component Reference](./6.1-richtext-component-react.md).
The HTML element to use when an unknown or unsupported element type is encountered. This provides graceful degradation for content with elements not explicitly handled.
210
-
211
-
#### Example: Custom Element Fallback
212
-
213
-
```tsx
214
-
// Use span for unknown elements (better for inline contexts)
215
-
<RichText
216
-
content={content.body?.json}
217
-
elementFallback="span"
218
-
/>
219
-
220
-
// Use section for semantic grouping
221
-
<RichText
222
-
content={content.body?.json}
223
-
elementFallback="section"
224
-
/>
225
-
```
226
-
227
-
#### Advanced Fallback with Custom Component
228
-
229
-
```tsx
230
-
// Create a custom fallback that logs unknown elements
231
-
const CustomFallbackElement = ({ children, element }:ElementProps) => {
232
-
console.warn('Unknown element type:', element.type);
If you encounter unknown HTML tags or elements not supported by the SDK, you can override them using the `elements` or `leafs` props to render custom React components.
339
+
340
+
> [!NOTE]
341
+
> Unknown elements and text marks are typically introduced when rich text content is created through the **Integration API (REST API)** rather than the CMS editor. When using the Integration API, developers can insert custom HTML elements or formatting that may not be recognized by the SDK's default element mappings. Additionally, some element attributes may not be fully supported when content is created via the Integration API, as the TinyMCE editor processing that normalizes and validates these attributes is bypassed.
342
+
343
+
```tsx
344
+
import {
345
+
RichText,
346
+
ElementProps,
347
+
LeafProps,
348
+
} from'@optimizely/cms-sdk/react/richText';
349
+
350
+
// Custom component for unknown block elements
351
+
const UnknownElement = ({ children, element }:ElementProps) => (
0 commit comments