Is it Possible to Have Image Assets As a List Item in the Desk Structure?

7 replies
Last updated: Apr 27, 2020
Is it possible to have image assets appear as a list item in the desk structure?? I want an assets folder where you can edit and delete images.
Add an listItem like this:
listItem()
.title('All images')
.child(documentTypeList('sanity.imageAsset'))
thank you!!!!! That's great!
user C
is it possible to filter the data model shown to I can just show the image, lanel and description for instance instead of all the data
There aren’t any built-in methods for that, but you can pass a custom component and the image asset _id as a prop
The list item would look like this:
listItem()
	.title('Images')
	.child(
		documentTypeList('sanity.imageAsset').child(assetID =>
			component()
				.title('The image')
				.component(props => <div>{JSON.stringify(assetID)}</div>)
			)
		)
great, thanks a lot!!!

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.

Was this answer helpful?