This component displays some HTML content. The content is “rich” (i.e. unescaped) by default.


This component leverages the dangerouslySetInnerHTML attribute, but uses the DomPurify library to sanitize the HTML before rendering it. It means it is safe from Cross-Site Scripting (XSS) attacks - but it’s still a good practice to sanitize the value server-side.


import { RichTextField } from 'react-admin';

<RichTextField source="body" />


Prop Required Type Default Description
stripTags Optional boolean false If true, remove all HTML tags and render text only

<RichTextField> also accepts the common field props.


The stripTags prop allows to remove all HTML markup, preventing some display glitches (which is especially useful in list views, or when truncating the content).

import { RichTextField } from 'react-admin';

<RichTextField source="body" stripTags />