Rich Text

Add a Rich Text property to your component so designers can create formatted content with HTML markup.

Syntax

1// Prop definition
2props.RichText({
3 name: string,
4 group?: string,
5 tooltip?: string,
6 defaultValue?: string,
7})
8
9// Prop value
10ReactNode

Prop definition

Define the Rich Text prop in your Webflow code component with a name. Optionally, you can add a group and tooltip text.

1props.RichText({
2 name: string,
3 group?: string,
4 tooltip?: string,
5 defaultValue?: string,
6})

Properties

  • name: The name for the property.
  • group: The group for this property. (optional)
  • tooltip: The tooltip for the property. (optional)
  • defaultValue: Default value for all component instances. (optional)

Example

MyComponent.webflow.tsx
1import { declareComponent } from '@webflow/react';
2import { props } from '@webflow/data-types';
3import { MyComponent } from "./MyComponent";
4
5export default declareComponent(MyComponent, {
6 name: "MyComponent",
7 description: "A component with a Rich Text property",
8 props: {
9 content: props.RichText({
10 name: "Content",
11 group: "Content"
12 })
13 }
14});

Prop value

The Rich Text prop provides formatted HTML content to your React component as a ReactNode.

PropType.RichText
1ReactNode

Properties

  • n/a

Webflow properties panel

Rich Text property in the Webflow panel

Example

MyComponent.tsx
1import React from "react";
2
3interface MyComponentProps {
4content?: React.ReactNode;
5}
6
7export const MyComponent = ({ content }: MyComponentProps) => {
8return (
9 <div className="content-wrapper">
10 {content}
11 </div>
12);
13}

When to use

Use a Rich Text prop when you want designers to:

  • Create formatted content with bold, italic, links
  • Add structured content like headings and lists
  • Include HTML markup in their content

Best practices

  • Provide meaningful default values so the component renders when added to the canvas
  • Handle missing content gracefully
  • Consider content styling and layout
  • Test with various HTML structures