Fields

Url

Extends Text

  • has the same features

Basics

The Url field is an extension of Text, which by default sets type=url.

use MoonShine\Fields\Url;
 
//...
 
public function fields(): array
{
return [
Url::make('Link')
];
}
 
//...

Title

The title() method allows you to set the title of the link.

title(Closure $callback)
use MoonShine\Fields\Url;
 
//...
 
Url::make('Link')
->title(fn(string $url, Url $ctx) => str($url)->limit(3))

Blank

The blank() method allows you to open a link in a new window.

blank()
use MoonShine\Fields\Url;
 
//...
 
Url::make('Link')
->blank()