
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGreat question! You're right that conditional hidden fields have access to parent and document in their callback functions, but custom input components don't get these props directly. The modern approach in Sanity Studio v3 is to use the useFormValue hook instead of the old withDocument pattern.
Here's how to access parent values in your custom input component:
import { useFormValue } from 'sanity'
const MyCustomInput = (props) => {
// Get the parent object (similar to {parent} in conditional fields)
const { path } = props
const parentPath = path.slice(0, -1) // Remove the last segment to get parent path
const parentValue = useFormValue(parentPath)
// Or get the entire document (similar to {document} in conditional fields)
const document = useFormValue([])
// Access specific sibling fields
const siblingField = useFormValue([...parentPath, 'siblingFieldName'])
return (
// Your component JSX
)
}The key is understanding that useFormValue takes a path array:
[] returns the entire document['fieldName'] returns a top-level field['parent', 'child', 'fieldName'] navigates nested structuresFor array items or nested objects, you can derive the parent path from props.path by slicing off the last segment. This gives you access to sibling fields within the same object, which is usually what you need when replicating the {parent} behavior from conditional fields.
Important note: Unlike v2 where props.document and props.parent were available, v3 requires using useFormValue for all form value access. The hook only works within the form builder context (custom input components), so you can't use it in document actions or other contexts outside the form.
This approach gives you the same power as conditional hidden fields but within your custom components!
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store