> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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: TextEnum

## Article: TextEnum

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

## Article Content:

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

# TextEnum

A value the Wix user picks from a fixed set of options you define. Use it for a field with a
small, known list of choices, such as a sort order or a status.

## Component

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

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

At runtime it's a plain string holding the chosen option value, so your code compares or applies it directly:

```ts
type TextEnum = string
```

### Usage

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

::::tabs
:::Consumers
In a component that receives a `TextEnum`, branch on the chosen value:

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

function Gallery({ sortOrder = 'newest' }: { sortOrder?: TextEnum }) {
  if (sortOrder === 'popular') return <p>Showing most popular</p>;
  if (sortOrder === 'oldest') return <p>Showing oldest first</p>;
  return <p>Showing newest first</p>;
}
```
:::
:::Producers
When your code produces a `TextEnum`, for a context or a function return, assign one of
the option values you declared in the manifest:

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

const sortOrder: TextEnum = 'newest';
```
:::
::::

## Manifest

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

```json
{ "dataType": "textEnum" }
```

### Declaration

Declare a `textEnum` field in one of these ways, depending on where the value comes from. A
`textEnum` requires a `textEnum` options object in every role.

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

```json
{
  "sortOrder": {
    "dataType": "textEnum",
    "displayName": "Sort Order",
    "defaultValue": "newest",
    "textEnum": {
      "options": [
        { "value": "newest", "displayName": "Newest" },
        { "value": "oldest", "displayName": "Oldest" },
        { "value": "popular", "displayName": "Most Popular" }
      ]
    }
  }
}
```

#### Options

A `textEnum` requires a `textEnum` options object. It lists the choices the Wix user selects from.

<PropertyList bordered>
  <Property
    name="options"
    type="Option[]"
    required
    description="The list of valid choices. Required, max 100."
  >
    <ExpandableSection name="Option">
      <PropertyList>
        <Property
          name="value"
          type="string"
          description="The value stored and delivered at runtime. Max length 100, unique within the list."
        />
        <Property
          name="displayName"
          type="string"
          description="The label shown to the Wix user in the panel. Max length 100."
        />
      </PropertyList>
    </ExpandableSection>
  </Property>
</PropertyList>
:::
:::Context-item
Declare it as a context item when your component supplies the value to descendant
components. It takes `dataType`, `displayName`, and the required options that follow:

```json
{
  "sortOrder": {
    "dataType": "textEnum",
    "displayName": "Sort Order",
    "textEnum": {
      "options": [
        { "value": "newest", "displayName": "Newest" },
        { "value": "oldest", "displayName": "Oldest" },
        { "value": "popular", "displayName": "Most Popular" }
      ]
    }
  }
}
```

#### Options

A `textEnum` requires a `textEnum` options object. It lists the choices the Wix user selects from.

<PropertyList bordered>
  <Property
    name="options"
    type="Option[]"
    required
    description="The list of valid choices. Required, max 100."
  >
    <ExpandableSection name="Option">
      <PropertyList>
        <Property
          name="value"
          type="string"
          description="The value stored and delivered at runtime. Max length 100, unique within the list."
        />
        <Property
          name="displayName"
          type="string"
          description="The label shown to the Wix user in the panel. Max length 100."
        />
      </PropertyList>
    </ExpandableSection>
  </Property>
</PropertyList>
:::
:::Function-parameter-and-return
Declare it on a function when the function accepts or returns one of the choices. Both a
parameter and a return carry the required options that follow, and a parameter may also set
`optional`:

```json
{
  "parameters": [
    {
      "dataType": "textEnum",
      "displayName": "Sort Order",
      "textEnum": {
        "options": [
          { "value": "newest", "displayName": "Newest" },
          { "value": "oldest", "displayName": "Oldest" },
          { "value": "popular", "displayName": "Most Popular" }
        ]
      }
    }
  ],
  "returns": {
    "dataType": "textEnum",
    "textEnum": {
      "options": [
        { "value": "newest", "displayName": "Newest" },
        { "value": "oldest", "displayName": "Oldest" },
        { "value": "popular", "displayName": "Most Popular" }
      ]
    }
  }
}
```

#### Options

A `textEnum` requires a `textEnum` options object. It lists the choices the Wix user selects from.

<PropertyList bordered>
  <Property
    name="options"
    type="Option[]"
    required
    description="The list of valid choices. Required, max 100."
  >
    <ExpandableSection name="Option">
      <PropertyList>
        <Property
          name="value"
          type="string"
          description="The value stored and delivered at runtime. Max length 100, unique within the list."
        />
        <Property
          name="displayName"
          type="string"
          description="The label shown to the Wix user in the panel. Max length 100."
        />
      </PropertyList>
    </ExpandableSection>
  </Property>
</PropertyList>
:::
::::