How do I create an Infolist Link?

I want to add a "download" link to an ImageEntry but ->downloadable() is only available for the FileUpload form component. For example, the following creates a link, but it's not styled nicely (even though I have some basic classes) and seems a little clunky. It also doesn't appear nicely directly below the ImageEntry I have used above.

TextEntry::make('src')
    ->label('Download')
    ->hiddenLabel()
    ->html()
    ->state(static fn (Model $model): string => "<a href='{$model->src}' class='fi-link fi-link-size-sm text-info' download>Download</a>"),
Solution
ImageEntry::make('src')
    ->extraImgAttributes([
        'class' => 'w-full h-auto', // @todo make the image full-width of the section.
    ])
    ->url(static fn (Model $model): string => $model->src, shouldOpenInNewTab: true),

TextEntry::make('src')
    ->html()
    ->state('Download')
    ->url(static fn (Model $model): string => $model->src, shouldOpenInNewTab: true),
Was this page helpful?