Rename "Add item" button in array field
Unfortunately, there is no built-in way to rename the "Add item" button for array fields in Sanity Studio. The button text is hardcoded in the default array input component.
However, you can achieve this by creating a custom input component that replaces the default array field interface. This requires some React development work, but gives you full control over the button text and other aspects of the array interface.
How to implement it
Here's the general approach:
1. Define your array field schema with a custom option:
{
name: "categories",
title: "Categories",
type: "array",
of: [{ type: "category" }],
options: {
buttonTitle: "Add new category" // Custom option for your button text
},
components: {
input: CustomArrayInput // Your custom component
}
}2. Create a custom input component:
Your custom component needs to:
- Accept the standard input component props
- Read the
buttonTitlefromprops.schemaType.options?.buttonTitle - Render the array interface with your custom button text
- Handle adding items to the array using the
onChangeandvalueprops
The custom component will need to implement the array item management logic (adding, removing, reordering items) or use the renderDefault prop to wrap the existing functionality while only customizing the button.
Why this requires a custom component
The Form Components API is designed to give developers complete control over form inputs when the default behavior doesn't fit their needs. While this means more implementation work for simple changes like button text, it provides the flexibility to customize any aspect of the array field interface - from button labels to item layouts to validation behavior.
Additional resources
- Your first input component guide - walks through creating custom inputs
- Create interactive array items - example of customizing array field behavior
- Array fields documentation - complete reference for array field configuration
The lack of a simple built-in option for this is a known limitation, but the custom component approach gives you the flexibility to customize not just the button text, but the entire array editing experience if needed.
Show original thread2 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.