✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

How to access document in custom input components after migrating from v2 to v3.

4 replies
Last updated: Mar 7, 2023
Hi there, a question for those who migrated from v2 to v3:

QuestionDo you know how to get access to the document in custom input components? Or pass specific parent information to a custom input component?


ContextWe are using information from the document in our custom inputs quite a lot. And it seems to me that the document isn’t part of the props anymore that are passed to a custom input component.

I’ve used this docs page btw:
https://www.sanity.io/docs/migrating-custom-input-components
Mar 7, 2023, 10:59 PM
You can use the useFormValue() hook to grab values from your document.
Mar 7, 2023, 11:13 PM
Thanks User! Let me try that
Mar 7, 2023, 11:14 PM
So good
user M
, it works! 🎉
Mar 7, 2023, 11:19 PM
Awesome!
Mar 7, 2023, 11:19 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?