Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Using media preview for dynamic document icons in Sanity.io

3 replies
Last updated: Apr 23, 2020
Hello! I have a question regarding document icons in the structure builder. Is it possible to provide a dynamic icon component that can render differently based on document values?
Apr 23, 2020, 7:12 AM
I've seen that you can provide a React component as an Icon, but I'm not getting any props except className in that component
Apr 23, 2020, 7:23 AM
Nevermind, figured out how to use the media preview on documents for this purpose! 🙂
Apr 23, 2020, 7:30 AM
That’s right, this can be done via
preview
,
prepare
and
media
. Well figured out! 😉
Apr 23, 2020, 1:31 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?