The received value is just a string (image URL), meaning the alt text is not included. Since Next.js requires an alt prop for images, I have to manually add an extra field:
{
name: 'altText',
type: 'string',
}
This means every image component requires an alt text field, making the process repetitive and error-prone.
Question:
Is there a way to automatically pull the Alt Image text defined in Builder.io’s media library, instead of manually adding an altText field for every image instance?
You don’t need to manually add the altText for every image instance. Here is an example of a custom component I have created that displays the Alt text of an image based on what is added to the asset library-
Here is a loom for a better understanding of how to fetch the altText value from the asset library.
This is a very simple example, feel free to customize it for your use-case.