akunbeben/fluid-actions 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

akunbeben/fluid-actions

Composer 安装命令:

composer require akunbeben/fluid-actions

包简介

Inline confirmation for Filament Actions

README 文档

README

Fluid Actions

Make Filament Actions feel fluid.

Fluid Actions is a UX toolkit for Filament Actions. It provides beautiful, flexible interaction components that help you design action flows that feel more intentional, contextual, and delightful.

Actions should match the context in which they are used. Some actions need confirmation, some need hesitation, some need quick feedback, and some should stay lightweight. Fluid Actions gives you more ways to shape those interactions.

Available interactions

  • Inline confirmation — confirm an action directly in place
  • Hold to confirm — require users to press and hold before executing an action
  • ActionGroup support — works inside dropdown menus and grouped actions
  • Smart fallback — complex actions continue using Filament's default behavior
  • Per-action configuration — customize timeout, hold duration, and dropdown behavior

Installation

Install the package via Composer:

composer require akunbeben/fluid-actions

Register the plugin in your Filament panel:

use Akunbeben\FluidActions\FluidActionsPlugin;

$panel
    ->plugin(FluidActionsPlugin::make());

Inline confirmation

Use inline confirmation when an action needs explicit confirmation, but the interaction should stay lightweight and close to the action itself.

use Filament\Actions\Action;

Action::make('deactivate')
    ->color('danger')
    ->requiresConfirmation()
    ->inlineConfirmation();

inlineConfirmation() does not call requiresConfirmation() for you. You must explicitly use both methods.

Custom label and timeout

The inline confirmation button uses Filament's modal submit action label.

Action::make('deactivate')
    ->color('danger')
    ->requiresConfirmation()
    ->modalSubmitActionLabel('Confirm')
    ->inlineConfirmation(timeout: 3000);

The timeout is in milliseconds. The default is 3000.

Hold to confirm

Use hold-to-confirm when an action should require a more deliberate gesture before it executes.

use Filament\Actions\Action;

Action::make('delete')
    ->color('danger')
    ->holdToConfirm();

By default, the user must hold the action for 1500 milliseconds.

Action::make('delete')
    ->color('danger')
    ->holdToConfirm(duration: 3000);

Unlike inline confirmation, holdToConfirm() does not require requiresConfirmation().

Actions inside groups

Fluid Actions supports actions inside dropdowns and button groups.

use Filament\Actions\Action;
use Filament\Actions\ActionGroup;

ActionGroup::make([
    Action::make('edit')
        ->label('Edit'),

    Action::make('delete')
        ->label('Delete')
        ->color('danger')
        ->requiresConfirmation()
        ->inlineConfirmation(),
]);

When an inline confirmation action is triggered inside a dropdown, the dropdown stays open so the confirmation state can be shown. After confirmation, the action executes and the dropdown closes.

Dropdown closing behavior

You can control whether a grouped action closes its dropdown after confirmation.

Action::make('delete')
    ->requiresConfirmation()
    ->inlineConfirmation(closeDropdown: false);

You may also pass a closure:

Action::make('delete')
    ->requiresConfirmation()
    ->inlineConfirmation(
        closeDropdown: fn (): bool => auth()->user()->prefers_compact_actions,
    );

The same option is available for hold-to-confirm:

Action::make('delete')
    ->holdToConfirm(closeDropdown: false);

Eligibility and fallback behavior

Fluid Actions is designed to enhance simple action interactions without breaking Filament's built-in action flows. If an action needs Filament's modal or submit behavior, it automatically falls back to the original Filament action rendering.

Actions fall back when they have:

  • forms or schemas
  • custom modal content
  • custom modal footer content
  • URL behavior
  • POST-to-URL behavior
  • form submit behavior

For inline confirmation, the action must also use requiresConfirmation().

Testing

composer test

Run static analysis:

composer analyse

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 47
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-05