mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Action docs screenshots
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\Concerns\InteractsWithActions;
|
||||
use Filament\Actions\Contracts\HasActions;
|
||||
use Livewire\Component;
|
||||
|
||||
class Actions extends Component implements HasActions
|
||||
{
|
||||
use InteractsWithActions;
|
||||
|
||||
public function buttonAction(): Action
|
||||
{
|
||||
return Action::make('buttonAction')
|
||||
->label('Edit')
|
||||
->button();
|
||||
}
|
||||
|
||||
public function linkAction(): Action
|
||||
{
|
||||
return Action::make('linkAction')
|
||||
->label('Edit')
|
||||
->link();
|
||||
}
|
||||
|
||||
public function iconButtonAction(): Action
|
||||
{
|
||||
return Action::make('iconButtonAction')
|
||||
->icon('heroicon-o-pencil-square')
|
||||
->iconButton();
|
||||
}
|
||||
|
||||
public function dangerAction(): Action
|
||||
{
|
||||
return Action::make('dangerAction')
|
||||
->label('Delete')
|
||||
->color('danger');
|
||||
}
|
||||
|
||||
public function largeAction(): Action
|
||||
{
|
||||
return Action::make('largeAction')
|
||||
->label('Create')
|
||||
->size('lg');
|
||||
}
|
||||
|
||||
public function iconAction(): Action
|
||||
{
|
||||
return Action::make('iconAction')
|
||||
->label('Edit')
|
||||
->icon('heroicon-m-pencil-square');
|
||||
}
|
||||
|
||||
public function iconAfterAction(): Action
|
||||
{
|
||||
return Action::make('iconAfterAction')
|
||||
->label('Edit')
|
||||
->icon('heroicon-m-pencil-square')
|
||||
->iconPosition('after');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.actions');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<div>
|
||||
<div id="buttonAction">
|
||||
{{ $this->buttonAction }}
|
||||
</div>
|
||||
|
||||
<div id="linkAction">
|
||||
{{ $this->linkAction }}
|
||||
</div>
|
||||
|
||||
<div id="iconButtonAction">
|
||||
{{ $this->iconButtonAction }}
|
||||
</div>
|
||||
|
||||
<div id="dangerAction">
|
||||
{{ $this->dangerAction }}
|
||||
</div>
|
||||
|
||||
<div id="largeAction">
|
||||
{{ $this->largeAction }}
|
||||
</div>
|
||||
|
||||
<div id="iconAction">
|
||||
{{ $this->iconAction }}
|
||||
</div>
|
||||
|
||||
<div id="iconAfterAction">
|
||||
{{ $this->iconAfterAction }}
|
||||
</div>
|
||||
</div>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Livewire\Actions;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
@@ -13,6 +14,4 @@ use Illuminate\Support\Facades\Route;
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
Route::get('/actions', Actions::class);
|
||||
|
||||
@@ -1,4 +1,32 @@
|
||||
export default {
|
||||
'actions/trigger-button/button': {
|
||||
url: 'actions',
|
||||
selector: '#buttonAction',
|
||||
},
|
||||
'actions/trigger-button/link': {
|
||||
url: 'actions',
|
||||
selector: '#linkAction',
|
||||
},
|
||||
'actions/trigger-button/icon-button': {
|
||||
url: 'actions',
|
||||
selector: '#iconButtonAction',
|
||||
},
|
||||
'actions/trigger-button/danger': {
|
||||
url: 'actions',
|
||||
selector: '#dangerAction',
|
||||
},
|
||||
'actions/trigger-button/large': {
|
||||
url: 'actions',
|
||||
selector: '#largeAction',
|
||||
},
|
||||
'actions/trigger-button/icon': {
|
||||
url: 'actions',
|
||||
selector: '#iconAction',
|
||||
},
|
||||
'actions/trigger-button/icon-after': {
|
||||
url: 'actions',
|
||||
selector: '#iconAfterAction',
|
||||
},
|
||||
'app/dashboard': {
|
||||
url: 'admin',
|
||||
selector: 'body',
|
||||
|
||||
@@ -56,7 +56,6 @@ Buttons may have a color to indicate their significance. It may be either `prima
|
||||
|
||||
```php
|
||||
Action::make('delete')
|
||||
->action(fn () => $this->post->delete())
|
||||
->color('danger')
|
||||
```
|
||||
|
||||
@@ -65,8 +64,7 @@ Action::make('delete')
|
||||
Buttons come in 3 sizes - `sm`, `md` or `lg`. You can change the size of the action's trigger using the `size()` method:
|
||||
|
||||
```php
|
||||
Action::make('delete')
|
||||
->action(fn () => $this->post->delete())
|
||||
Action::make('create')
|
||||
->size('lg')
|
||||
```
|
||||
|
||||
@@ -115,4 +113,4 @@ use Filament\Actions\Action;
|
||||
Action::make('save')
|
||||
->action(fn () => $this->save())
|
||||
->keyBindings(['command+s', 'ctrl+s'])
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user