codewithdennis/filament-simple-alert
Composer 安装命令:
composer require codewithdennis/filament-simple-alert
包简介
A plugin for adding straightforward alerts to your filament pages
README 文档
README
If you're using Filament 3.x, check out the compatible version of this package here.
This package offers a straightforward and easy-to-use alert component for your Filament application. It allows you to quickly implement customizable alert messages, enhancing the user experience by providing clear and concise notifications.
Installation
You can install the package via composer:
composer require codewithdennis/filament-simple-alert:4.x
Custom Theme
You will need to create a custom theme for the styles to be applied correctly.
Make sure you add the following to your theme.css file.
@source '../../../../vendor/codewithdennis/filament-simple-alert/resources/**/*.blade.php'; @source inline('animate-{spin,pulse,bounce}');
Usage
Make sure to import the SimpleAlert component at the top of your file:
use CodeWithDennis\SimpleAlert\Components\SimpleAlert;
Predefined Alerts
There are 4 types predefined of simple alerts: danger, info, success, and warning.
SimpleAlert::make('example') ->danger() ->info() ->success() ->warning()
If you would like to use a different color, you can use the color method.
SimpleAlert::make('example') ->color('purple')
Icon
By default, simple alerts come with an icon. For example, the ->danger() method includes a heroicon-s-x-circle icon. If you want to use a different icon, you can use the icon method.
SimpleAlert::make('example') ->color('purple') ->icon('heroicon-s-users')
Or you can use a custom icon by passing an HTML string or a Blade component to the icon method.
SimpleAlert::make('example') ->icon(new HtmlString('🤓')) ->icon(new HtmlString(Blade::render('my-custom-icon-component')))
Icon Animation
You can add animation to the icon by passing the animation type as the second parameter to the icon method. Make sure to use the IconAnimation enum for the animation type.
use CodeWithDennis\SimpleAlert\Components\Enums\IconAnimation; SimpleAlert::make('example') ->icon('heroicon-s-arrow-path', IconAnimation::Spin)
Icon Vertical Alignment
You can change the vertical alignment of the icon by using the iconVerticalAlignment method.
SimpleAlert::make('example') ->iconVerticalAlignment('start'), // possible values: start, center
Title
You can add a title to the alert by using the title method.
SimpleAlert::make('example') ->title('Hoorraayy! Your request has been approved! 🎉')
Description
You can add a description to the alert by using the description method.
SimpleAlert::make('example') ->description('This is the description')
Border
You can add a border to the alert by using the border method.
SimpleAlert::make('example') ->border()
Actions
You can also add actions to the alert by using the actions method. All regular action features are supported.
use Filament\Actions\Action; SimpleAlert::make('example') ->columnSpanFull() ->success() ->title('Simple Alert') ->description('This is an example of a simple alert.') ->actions([ Action::make('read-example') ->label('Read more') ->url('https://filamentphp.com') ->openUrlInNewTab() ->color('info'), ]),
Actions Vertical Alignment
You can change the vertical alignment of the actions by using the actionsVerticalAlignment method.
use Filament\Actions\Action; SimpleAlert::make('example') ->actionsVerticalAlignment('start'), // possible values: start, center
Example
use Filament\Actions\Action; SimpleAlert::make('example') ->success() ->title(new HtmlString('<strong>Hoorraayy! Your request has been approved! 🎉</strong>')) ->description('Lorem ipsum dolor sit amet consectetur adipisicing elit.') ->actions([ Action::make('filament') ->label('Details') ->icon('heroicon-m-arrow-long-right') ->iconPosition(IconPosition::After) ->link() ->url('https://filamentphp.com') ->openUrlInNewTab() ->color('success'), ]),
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
codewithdennis/filament-simple-alert 适用场景与选型建议
codewithdennis/filament-simple-alert 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 256.05k 次下载、GitHub Stars 达 124, 最近一次更新时间为 2024 年 06 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「CodeWithDennis」 「filament-simple-alert」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codewithdennis/filament-simple-alert 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codewithdennis/filament-simple-alert 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codewithdennis/filament-simple-alert 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.
This package offers a straightforward and easy-to-use map action component for your Filament application.
Easily see the fi- class of any element on the page by hovering over it. A tooltip displays the class name, and you can copy it with a click!
Beautiful, customizable radio and checkbox form layouts for FilamentPHP.
A simple and customizable price filter for FilamentPHP, allowing users to easily refine results based on specified price ranges.
Alfabank REST API integration
统计信息
- 总下载量: 256.05k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 124
- 点击次数: 21
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-27