Dropdown Blade component
概述
下拉菜单组件允许你使用触发按钮渲染下拉菜单:
<x-filament::dropdown>
<x-slot name="trigger">
<x-filament::button>
More actions
</x-filament::button>
</x-slot>
<x-filament::dropdown.list>
<x-filament::dropdown.list.item wire:click="openViewModal">
View
</x-filament::dropdown.list.item>
<x-filament::dropdown.list.item wire:click="openEditModal">
Edit
</x-filament::dropdown.list.item>
<x-filament::dropdown.list.item wire:click="openDeleteModal">
Delete
</x-filament::dropdown.list.item>
</x-filament::dropdown.list>
</x-filament::dropdown>
使用下拉菜单项作为锚链接
默认情况下,下拉菜单项底层使用的 HTML 标签是 <button>
。你可以使用 tag
属性,将其改成 <a>
标签:
<x-filament::dropdown.list.item
href="https://filamentphp.com"
tag="a"
>
Filament
</x-filament::dropdown.list.item>
修改下拉菜单项目的颜色
默认情况下,下拉菜单项目的颜色是 "gray"。你可以使用 color
属性,将其改成 danger
、info
、primary
、success
或 warning
。
<x-filament::dropdown.list.item color="danger">
Edit
</x-filament::button>
<x-filament::dropdown.list.item color="info">
Edit
</x-filament::button>
<x-filament::dropdown.list.item color="primary">
Edit
</x-filament::button>
<x-filament::dropdown.list.item color="success">
Edit
</x-filament::button>
<x-filament::dropdown.list.item color="warning">
Edit
</x-filament::button>