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})
7
8// Prop value
9ReactNode

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})

Properties

  • name: The name for the property.
  • group: The group for this property. (optional)
  • tooltip: The tooltip for the property. (optional)

Example

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

Prop value

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

1ReactNode

Properties

  • n/a

Webflow properties panel

Rich Text property in the Webflow panel

Example

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

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

  • Handle missing content gracefully
  • Consider content styling and layout
  • Test with various HTML structures