Text
The Text
component allows the user to edit plain text.
📌
For usage with Next /App Router, please read the React Server Components Guide.
Properties
Here's the Typescript interface for the props of the Text
component:
interface TextProps {
propName?: string
renderBlock: React.FC
placeholder: string
renderPlaceholder?: React.FC
multiline?: boolean
softLineBreak?: boolean
metaFieldName?: 'title' | 'description' | 'language' // New in 3.3.0
customFieldName?: string // New in 3.3.0
}
Properties definition
Property | Definition |
---|---|
propName | The prop of the Brick component corresponding to this text. Mandatory unless you bind the value to a metaFieldName or customFieldName |
renderBlock | A React functional component used to render the text. Typically it wraps the children. |
placeholder | The placeholder to show when the text is empty. |
renderPlaceholder | A React functional component used to render the placeholder, if you need to change the default display. |
multiline | Default: false . If set to true allows multiline text. |
softLineBreak | Default: false . If set to true allows soft line breaks. |
metaFieldName | Bind the text value to a page Meta field (2-way data binding) |
customFieldName | Bind the text value to a page Custom field (2-way data binding) |
Usage example
<Text
propName="description"
renderBlock={(props: any) => (
<p className="text-xl font-extrabold" {...props.attributes}>
{props.children}
</p>
)}
placeholder="Enter the description..."
/>