Text

Add a Text property to your component for designers to input plain text content.

Syntax

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

Prop Definition

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

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

You can use props.String as an alias for the props.Text prop type.

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 Text property",
8 props: {
9 title: props.Text({
10 name: "Title",
11 group: "Content",
12 defaultValue: "Hello World!"
13 })
14 }
15});

Prop Value

The Text prop provides a string value to your React component.

PropType.Text
1string

Properties

  • n/a

Webflow properties panel

Text property in the Webflow panel

Example

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

When to use

Use a Text prop when you want designers to:

  • Input simple text content
  • Set titles, labels, or descriptions

Best practices

  • Provide meaningful default values so the component renders when added to the canvas
  • Use descriptive prop names