mantix/livewire-bootstrap-components
Composer 安装命令:
composer require mantix/livewire-bootstrap-components
包简介
Reusable Livewire Bootstrap components by Mantix BV
README 文档
README
Reusable Livewire Bootstrap components by Mantix BV.
Installation
composer require mantix/livewire-bootstrap-components
Usage
Publish the views and styles (optional):
# Publish views php artisan vendor:publish --provider="Mantix\\LivewireBootstrapComponents\\LivewireBootstrapComponentsServiceProvider" --tag=views # Publish SCSS files php artisan vendor:publish --provider="Mantix\\LivewireBootstrapComponents\\LivewireBootstrapComponentsServiceProvider" --tag=scss
Components
Card Component
A flexible card component with customizable styling and optional header/footer.
<x-bootstrap::card title="Card Title" :square="true" background_image="/path/to/image.jpg" background_color="primary" text_color="white" footer="Footer content" :actions="[ ['href' => '/items/1', 'icon' => 'eye', 'color' => 'primary', 'label' => __('View')], ['wire:click' => 'editItem', 'icon' => 'pencil', 'color' => 'secondary', 'label' => __('Edit')] ]"> Card content here. </x-bootstrap::card>
Attributes:
title(string, optional): Card header titlesquare(boolean, default: false): Apply square stylingbackground_image(string, optional): Background image URLbackground_color(string, optional): Bootstrap background color classtext_color(string, optional): Bootstrap text color classfooter(string, optional): Footer contentactions(array, optional): Array of action configurations (see Actions Component)
Form Group Component
A form group wrapper with label, icon support, and automatic error handling.
<x-bootstrap::form-group label="Email Address" icon="envelope" :required="true"> <input type="email" name="email" class="form-control" wire:model="email"> </x-bootstrap::form-group>
Attributes:
label(string, optional): Form field labelicon(string, optional): FontAwesome icon name (without 'fa-' prefix)required(boolean, default: false): Show required asterisk
Features:
- Automatically detects
wire:modeland displays validation errors - Supports input groups with icons
- Responsive design with proper spacing
List Row Component
A list item component with flexible action buttons for CRUD operations.
<x-bootstrap::list-row class="custom-class" background_color="light" text_color="dark" :actions="[ ['href' => '/items/1', 'icon' => 'eye', 'color' => 'light', 'label' => 'View'], ['wire:click' => 'startItem', 'icon' => 'play', 'color' => 'primary', 'label' => 'Start'], ['wire:click' => 'moveUp', 'icon' => 'arrow-up', 'color' => 'outline-primary'], ['wire:click' => 'moveDown', 'icon' => 'arrow-down', 'color' => 'outline-primary'], ['wire:click' => 'editItem', 'icon' => 'pencil', 'color' => 'dark', 'label' => 'Edit'], ['wire:click' => 'deleteItem', 'icon' => 'trash-can', 'color' => 'danger', 'label' => 'Delete', 'confirm' => 'Are you sure?'] ]"> Item content here </x-bootstrap::list-row>
Attributes:
class(string, optional): Additional CSS classesbackground_color(string, optional): Bootstrap background colortext_color(string, optional): Bootstrap text coloractions(array, optional): Array of action configurations (see Actions Component)
Action Configuration:
Each action in the actions array can have:
href(string, optional): URL for regular links (use eitherhreforwire:click)wire:click(string, optional): Livewire method name (use eitherhreforwire:click)icon(string, optional, default: 'circle'): FontAwesome icon name (without 'fa-' prefix)color(string, optional, default: 'light'): Bootstrap button color classlabel(string, optional): Text label to display next to the iconconfirm(string, optional): Confirmation message forwire:clickactions
Features:
- Double-click to view or edit (automatically detects 'view' or 'edit' in wire:click methods)
- Responsive design: button group on desktop (md and up), dropdown menu on mobile
- Supports both regular links (
href) and Livewire actions (wire:click) - Confirmation dialogs for destructive actions
Actions Component
Shared action renderer used by cards and list rows. It accepts the same actions array format shown above and automatically builds responsive button groups (desktop) and dropdowns (mobile). You can also use it directly:
<x-bootstrap::actions :actions="[ ['href' => route('items.show', $item), 'icon' => 'eye', 'color' => 'light', 'label' => __('View')], ['wire:click' => 'edit', 'icon' => 'pencil', 'color' => 'primary', 'label' => __('Edit')], ['wire:click' => 'delete', 'icon' => 'trash-can', 'color' => 'danger', 'label' => __('Delete'), 'wire:confirm' => __('ui.confirm_delete')] ]" />
Modal Component
A complete modal component with form support and multiple levels.
<x-bootstrap::modal id="myModal" size="lg" title="Modal Title" close_function="closeModal" submit_function="saveData" submit_color="primary" submit_text="Save" submit_icon="save" :level="2"> Modal content here </x-bootstrap::modal>
Attributes:
id(string, required): Modal IDsize(string, optional): Modal size (sm, lg, xl)title(string, required): Modal titleclose_function(string, optional): Livewire method to close modalsubmit_function(string, optional): Livewire method for form submissionsubmit_color(string, optional): Submit button color (default: primary)submit_text(string, optional): Submit button textsubmit_icon(string, optional): Submit button iconlevel(integer, optional): Modal z-index level (1-5)
Features:
- ESC key support for closing
- Loading states on submit button
- Multiple z-index levels for nested modals
- Automatic form wrapper when submit function is provided
Session Message Component
Displays session flash messages with different types.
<x-bootstrap::session-message />
Features:
- Displays
message(info),success, anddangersession messages - Dismissible alerts with close buttons
- Automatic error display integration
Errors Component
Displays validation errors in a dismissible alert.
<x-bootstrap::errors />
Features:
- Shows all validation errors in a single alert
- Dismissible with close button
- Automatically included in modal
Styles
The package includes SCSS files for modal z-index management. After publishing the SCSS files, you can import them in your main SCSS file:
@import '../../vendor/mantix/livewire-bootstrap-components/resources/scss/livewire-bootstrap-components';
Modal Z-Index Levels
The package provides 5 levels of modal z-index management:
- Level 1: Default Bootstrap modal (z-index: 1055)
- Level 2: z-index: 1065 (backdrop: 1060)
- Level 3: z-index: 1075 (backdrop: 1070)
- Level 4: z-index: 1085 (backdrop: 1080)
- Level 5: z-index: 1095 (backdrop: 1090)
Requirements
- Laravel 8+
- Livewire 3.x
- Bootstrap 5.x
- FontAwesome 6.x
License
MIT © Mantix BV
mantix/livewire-bootstrap-components 适用场景与选型建议
mantix/livewire-bootstrap-components 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 604 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 07 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mantix/livewire-bootstrap-components 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mantix/livewire-bootstrap-components 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 604
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-30