Make
The Link component allows links.
You can create a Link using the static make()
method class Link
.
make(Closure|string $href, Closure|string $label = '')
-
$href
- link url, -
$label
- title.
use MoonShine\Components\Link; //... public function components(): array{ return [ Link::make( '/endpoint', 'Link' ) ];} //...
Icon
The icon()
method allows you to specify an icon for a link.
icon(string $icon)
use MoonShine\Components\Link; //... Link::make('/endpoint', 'Edit') ->icon('heroicons.outline.pencil') //...
Badge
The badge()
method allows you to add a badge to a link.
badge(Closure|string|int|float|null $value)
use MoonShine\Components\Link; //... Link::make('/endpoint', 'Comments') ->badge(fn() => Comment::count())//...
Button
The button()
method allows you to display a link as a button.
button()
use MoonShine\Components\Link; //... Link::make('/endpoint', 'Link') ->button() //...
Filled
The filled()
method sets the fill for the link.
filled()
use MoonShine\Components\Link;//...Link::make('/endpoint', 'Link') ->filled() //...
Tooltip
The tooltip()
method allows you to set a tooltip for a link.
tooltip(?string $tooltip = null)
use MoonShine\Components\Link; //... Link::make('/endpoint', 'Link') ->tooltip('Tooltip for link') //...