๐Ÿ‘€ Our most exciting product launch yet ๐Ÿš€ Join us May 8th for Sanity Connect

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?