> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Text

## Article: Text

## Article Link: https://dev.wix.com/docs/site-extensions/editor-react-components/editor-react-types/reference/text.md

## Article Content:

import { Property, PropertyList, ExpandableSection } from "@wix/docs-ui/content";

# Text

A plain text string the Wix user edits in the editor. Use it for any single-value field that
holds unformatted text, such as a heading, a label, or a short caption.

## Component

In your component code, import the `Text` type from `@wix/editor-react-types`:

```ts
import type { Text } from '@wix/editor-react-types';
```

At runtime it's a plain string, so your code reads and writes it directly:

```ts
type Text = string
```

### Usage

Your code either consumes a value of type `Text` or produces one:

::::tabs
:::Consumers
In a component that receives a `Text`, render the string directly:

```tsx
import type { Text } from '@wix/editor-react-types';

function Banner({ heading }: { heading?: Text }) {
  return <h2>{heading}</h2>;
}
```
:::
:::Producers
When your code produces a `Text`, for a context or a function return, assign a string:

```ts
import type { Text } from '@wix/editor-react-types';

const heading: Text = 'Summer Sale';
```
:::
::::

## Manifest

In your manifest, declare the field with the `text` dataType:

```json
{ "dataType": "text" }
```

### Declaration

Declare a `text` field in one of these ways, depending on where the value comes from:

::::tabs
:::Data-property
Declare it as a data property when the Wix user should edit the `heading` in a panel. It takes
`dataType`, `displayName`, an optional `defaultValue`, and the options that follow:

```json
{
  "heading": {
    "dataType": "text",
    "displayName": "Banner Heading",
    "defaultValue": "Summer Sale",
    "text": {
      "minLength": 2,
      "maxLength": 100
    }
  }
}
```

#### Options

A `text` data property accepts a `text` options object. It constrains what the Wix user can enter.

<PropertyList bordered>
  <Property
    name="minLength"
    description="The minimum number of characters allowed."
  />
  <Property
    name="maxLength"
    description="The maximum number of characters allowed."
  />
  <Property
    name="pattern"
    description="A regex the value must match. Max length 100."
  />
</PropertyList>
:::
:::Context-item
Declare it as a context item when your component supplies the text to descendant
components. It takes just `dataType` and `displayName`:

```json
{
  "heading": {
    "dataType": "text",
    "displayName": "Banner Heading"
  }
}
```
:::
:::Function-parameter-and-return
Declare it on a function when the function accepts or returns text. It takes `dataType` and
an optional `displayName`, and a parameter may also set `optional`:

```json
{
  "parameters": [
    {
      "dataType": "text",
      "displayName": "Banner Heading"
    }
  ],
  "returns": {
    "dataType": "text"
  }
}
```
:::
::::