> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# String metadata field

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = href;
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

A metadata field of type `string` is displayed to a user as a standard text-field.

<Frame border center shadow width="400">
  <img src="https://mintcdn.com/box/GzVau-cpK5Cm5MBq/guides/metadata/fields/metadata-field-string.png?fit=max&auto=format&n=GzVau-cpK5Cm5MBq&q=85&s=ec8926afb205a66e8ace46d92693a29b" alt="String field" width="676" height="454" data-path="guides/metadata/fields/metadata-field-string.png" />
</Frame>

## Create a string field

A `string` field can be added to a metadata template either when <Link href="/guides/metadata/templates/create">creating a
metadata template</Link>, or when <Link href="/guides/metadata/templates/update">updating a
template</Link> with the `addField` operation.

The required attributes for a `string` field are a `type`, a `displayName`, and a
`key`.

```json theme={null}
{
  "scope": "enterprise",
  "displayName": "Customer",
  "fields": [
    {
      "type": "string",
      "key": "name",
      "displayName": "Name",
      "description": "The customer's legal name",
      "hidden": false
    }
  ]
}
```

Optionally, a `description` can be provided that is shown to a user in the UI,
and the field can be set to `hidden` to hide it from users in the web and mobile
apps.

## Update a string field

A `string` template field can be updated by <Link href="/guides/metadata/templates/update">updating the
template</Link> it belongs to. Updates to templates happen through
**operations** to ensure that any template that is already assigned to a file or
folder is updated as well.

When updating a `string` metadata field, the only relevant operation is the
`editField` operation, which can be used to change the field's `key`,
`displayName`, `description`, and `hidden` values.

```json theme={null}
[
  {
    "op": "editField",
    "fieldKey": "name",
    "data": {
      "displayName": "Customer Name",
      "description": "The contact name at the customer",
      "key": "customer_name",
      "hidden": true
    }
  }
]
```

<Warning>
  This will affect existing instances of this template.
</Warning>

<RelatedLinks
  title="RELATED APIS"
  items={[
{ label: translate("Update metadata template"), href: "/reference/put-metadata-templates-id-id-schema", badge: "PUT" }
]}
/>

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Create a metadata template"), href: "/guides/metadata/templates/create", badge: "GUIDE" },
{ label: translate("Update a metadata template"), href: "/guides/metadata/templates/update", badge: "GUIDE" }
]}
/>
