Export Video Set: 'VideoSet'
Based on your schema structure, yes, you can access the nested fields (language and muxVideo) from your array items! When you have an array of objects, the field definitions are available through props.schemaType.of[0].fields.
Here's how to access them in your custom VideoSet component:
const VideoSet = (props) => {
// Access the array item schema
const arrayItemSchema = props.schemaType.of[0];
// Access individual fields from the videoSet object type
const languageField = arrayItemSchema.fields.find(field => field.name === 'language');
const muxVideoField = arrayItemSchema.fields.find(field => field.name === 'muxVideo');
console.log('Language field:', languageField);
console.log('Mux Video field:', muxVideoField);
// Now you can use these field definitions as needed
return (
// Your component JSX
);
};The structure works like this:
props.schemaTypecontains the schema for the array field (languageSpecificVideos)props.schemaType.ofis an array containing the types that can be in the arrayprops.schemaType.of[0]gives you the first (and in your case, only) type definition - yourvideoSetobjectprops.schemaType.of[0].fieldsis an array containing all the field definitions for that object (languageandmuxVideo)
If you want to iterate over all fields:
const VideoSet = (props) => {
const arrayItemSchema = props.schemaType.of[0];
arrayItemSchema.fields.forEach(field => {
console.log(`Field name: ${field.name}, type: ${field.type}`);
});
return (
// Your component JSX
);
};This is a common pattern when building custom input components for arrays, especially when you need to access the schema metadata of nested fields to build dynamic interfaces or validation logic. The schemaType prop gives you full access to the type definitions, which is particularly useful when you need to understand the structure of complex nested types or build components that adapt based on the schema configuration.
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.