codenzia/filament-carousel
Composer 安装命令:
composer require codenzia/filament-carousel
包简介
A Swiper.js-powered carousel component for Filament v4 with responsive grids, effects, autoplay, and dynamic card schemas.
README 文档
README
A highly flexible, responsive carousel component for Filament PHP v4, powered by Swiper.js. Supports horizontal and vertical scrolling, responsive grids, card actions, header actions, and extensive UI customization.
Requirements
- PHP 8.1+
- Laravel 12+
- Filament v4
Installation
Install via Composer:
composer require codenzia/filament-carousel
Optionally, publish the views for customization:
php artisan vendor:publish --tag="filament-carousel-views"
Panel Plugin Registration
Register the plugin in your Filament panel provider:
use Codenzia\FilamentCarousel\FilamentCarouselPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentCarouselPlugin::make(), ]); }
Quick Start
The Carousel component is a Filament Infolist Entry. Use it inside any Infolist schema:
use Codenzia\FilamentCarousel\Widgets\Carousel; use Filament\Schemas\Schema; use Filament\Schemas\Components\TextEntry; use Filament\Support\Icons\Heroicon; Carousel::make('projects') ->label('Active Projects') ->icon(Heroicon::Briefcase) ->navigation() ->slidesPerView(3) ->spaceBetween(20) ->cardSchema(fn (Schema $schema, $record) => $schema->components([ TextEntry::make('name')->label('Project'), TextEntry::make('status')->badge(), ])),
Configuration Reference
Layout
| Method | Default | Description |
|---|---|---|
slidesPerView(int) |
4 |
Number of visible slides |
slidesPerGroup(int) |
1 |
Slides to advance per swipe |
spaceBetween(int) |
20 |
Gap between slides in pixels |
gridRows(int) |
1 |
Number of rows in grid layout |
direction(string) |
'horizontal' |
'horizontal' or 'vertical' |
height(string) |
'auto' |
Container height (e.g. '400px') |
width(string|int) |
'auto' |
Container width; integers auto-append px |
centeredSlides(bool) |
false |
Center the active slide |
Responsive Grid
Enable dynamic slide count calculation based on container width:
Carousel::make('items') ->responsiveGrid() ->minCardWidth(250) // Minimum card width for calculation ->minCardHeight(180), // Minimum card height
| Method | Default | Description |
|---|---|---|
responsiveGrid(bool) |
false |
Enable responsive slide count |
minCardWidth(string|int) |
'200px' |
Min card width for calculation |
minCardHeight(string|int) |
'auto' |
Min card height |
When enabled, slidesPerView is calculated as: floor(containerWidth / (minCardWidth + spaceBetween)).
Navigation Arrows
Carousel::make('items') ->navigation() ->arrowPosition('header') ->navigationNextIcon('heroicon-o-chevron-right') ->navigationPrevIcon('heroicon-o-chevron-left'),
| Method | Default | Description |
|---|---|---|
navigation(bool) |
false |
Enable navigation arrows |
arrowPosition(string) |
'header' |
'header', 'items', or 'pagination' |
navigationNextIcon(string|Closure) |
null |
Custom next arrow icon |
navigationPrevIcon(string|Closure) |
null |
Custom prev arrow icon |
Pagination
Carousel::make('items') ->pagination() ->paginationType('bullets') ->paginationClickable() ->paginationDynamicBullets(),
| Method | Default | Description |
|---|---|---|
pagination(bool) |
false |
Enable pagination |
paginationType(string) |
'bullets' |
'bullets', 'fraction', or 'progressbar' |
paginationClickable(bool) |
false |
Allow clicking pagination bullets |
paginationDynamicBullets(bool) |
false |
Dynamic bullet sizing |
paginationDynamicMainBullets(int) |
1 |
Number of main dynamic bullets |
paginationHideOnClick(bool) |
false |
Hide pagination on click |
Scrollbar
Carousel::make('items') ->scrollbar() ->scrollbarDraggable() ->scrollbarHide(false),
| Method | Default | Description |
|---|---|---|
scrollbar(bool) |
false |
Enable scrollbar |
scrollbarDragSize(int) |
50 |
Drag handle size |
scrollbarDraggable(bool) |
false |
Allow dragging the scrollbar |
scrollbarSnapOnRelease(bool) |
false |
Snap to slides on release |
scrollbarHide(bool) |
true |
Auto-hide scrollbar |
Autoplay
Carousel::make('items') ->autoplay() ->autoplayDelay(5000),
| Method | Default | Description |
|---|---|---|
autoplay(bool) |
false |
Enable autoplay |
autoplayDelay(int) |
3000 |
Delay between transitions (ms) |
Additional autoplay getters: getAutoplayDisableOnInteraction(), getAutoplayPauseOnMouseEnter(), getAutoplayReverseDirection(), getAutoplayStopOnLastSlide(), getAutoplayWaitForTransition().
Effects
Carousel::make('items') ->effect('coverflow'),
Supported effects: 'slide' (default), 'fade', 'cube', 'coverflow', 'flip', 'cards'.
Each effect has dedicated configuration getters (e.g. getCoverflowEffectDepth(), getCubeEffectShadow(), getCardsEffectPerSlideOffset()).
Card Schema
Define the content of each card using Filament's Schema builder. The closure receives a Schema instance and the current $record:
use Filament\Schemas\Schema; use Filament\Schemas\Components\TextEntry; use Filament\Schemas\Components\ImageEntry; Carousel::make('team') ->label('Team Members') ->cardSchema(fn (Schema $schema, $record) => $schema->components([ ImageEntry::make('avatar')->circular(), TextEntry::make('name')->weight('bold'), TextEntry::make('role')->color('gray'), ])),
Card View Props
Pass additional data to custom card views:
Carousel::make('items') ->cardViewProps(['showAvatar' => true, 'size' => 'lg']),
Actions
Header Actions
Display Filament Actions in the carousel header area:
use Filament\Actions\Action; Carousel::make('projects') ->label('Projects') ->navigation() ->headerActions([ Action::make('create') ->label('New Project') ->icon('heroicon-o-plus') ->action(fn () => redirect()->route('projects.create')), ]) ->showHeaderActionsOnHover(), // Only visible on hover
| Method | Default | Description |
|---|---|---|
headerActions(array|Closure) |
[] |
Array of Action or ActionGroup instances |
showHeaderActionsOnHover(bool) |
false |
Reveal actions only on hover |
Card Actions
Display per-card actions (bound to each record automatically):
use Filament\Actions\Action; use Filament\Actions\ActionGroup; Carousel::make('milestones') ->cardActions([ ActionGroup::make([ Action::make('edit') ->label('Edit') ->icon('heroicon-o-pencil') ->action(fn ($record) => /* edit logic */), Action::make('delete') ->label('Delete') ->icon('heroicon-o-trash') ->color('danger') ->requiresConfirmation() ->action(fn ($record) => $record->delete()), ]), ]) ->cardActionsPosition('top-right') ->showCardActionsOnHover(),
| Method | Default | Description |
|---|---|---|
cardActions(array|Closure) |
[] |
Array of Action or ActionGroup instances |
cardActionsPosition(string) |
null (auto) |
'top-right', 'top-left', 'bottom-right', 'right-edge' |
showCardActionsOnHover(bool) |
false |
Reveal actions only on hover |
When position is null, it auto-detects: 'top-right' for horizontal carousels, 'right-edge' for vertical.
Item Click Action
Make the entire card clickable to trigger a Livewire action:
Carousel::make('tasks') ->itemClickAction('editTask'),
The clicked record is automatically passed as the action argument.
Title Click Action
Make the carousel heading clickable:
Carousel::make('tasks') ->label('My Tasks') ->titleAction('viewAllTasks'),
Extra Attributes
Add custom HTML attributes to the carousel container:
Carousel::make('items') ->extraAttributes(['class' => 'my-custom-class', 'data-section' => 'featured']) ->addClass('another-class') ->addClasses(['class-a', 'class-b']),
Advanced Swiper Options
The carousel exposes the full Swiper.js API through fluent getters. These are pre-configured with sensible defaults but can be accessed or overridden:
Touch & Interaction
| Getter | Default | Description |
|---|---|---|
getAllowTouchMove() |
true |
Enable touch dragging |
getAllowSlideNext() |
true |
Allow swiping forward |
getAllowSlidePrev() |
true |
Allow swiping backward |
getGrabCursor() |
false |
Show grab cursor |
getSimulateTouch() |
true |
Simulate touch on desktop |
getThreshold() |
5 |
Min swipe distance (px) |
getTouchAngle() |
45 |
Allowed touch angle |
getSpeed() |
300 |
Transition speed (ms) |
Keyboard & Mousewheel
| Getter | Default |
|---|---|
getKeyboardEnabled() |
false |
getKeyboardOnlyInViewport() |
true |
getMousewheelEnabled() |
false |
getMousewheelForceToAxis() |
false |
getMousewheelSensitivity() |
1 |
Zoom
| Getter | Default |
|---|---|
getZoomEnabled() |
false |
getZoomMaxRatio() |
3 |
getZoomMinRatio() |
1 |
getZoomToggle() |
true |
Free Mode
| Getter | Default |
|---|---|
getFreeModeEnabled() |
false |
getFreeModeMomentum() |
true |
getFreeModeMomentumBounce() |
true |
getFreeModeSticky() |
false |
Virtual Slides
| Getter | Default |
|---|---|
getVirtualEnabled() |
false |
getVirtualCache() |
true |
getVirtualAddSlidesBefore() |
0 |
getVirtualAddSlidesAfter() |
0 |
Loop
| Getter | Default |
|---|---|
getLoop() |
false |
getLoopAddBlankSlides() |
true |
getLoopAdditionalSlides() |
0 |
getLoopPreventsSliding() |
true |
getRewind() |
false |
Full Example
use Codenzia\FilamentCarousel\Widgets\Carousel; use Filament\Actions\Action; use Filament\Actions\ActionGroup; use Filament\Schemas\Schema; use Filament\Schemas\Components\TextEntry; use Filament\Support\Icons\Heroicon; Carousel::make('milestones') ->label('Milestones') ->icon(Heroicon::Flag) ->navigation() ->arrowPosition('header') ->slidesPerView(3) ->spaceBetween(16) ->responsiveGrid() ->minCardWidth(300) ->autoplay() ->autoplayDelay(5000) ->headerActions([ Action::make('create') ->label('Add Milestone') ->icon('heroicon-o-plus'), ]) ->showHeaderActionsOnHover() ->cardActions([ ActionGroup::make([ Action::make('edit') ->label('Edit') ->icon('heroicon-o-pencil'), Action::make('delete') ->label('Delete') ->icon('heroicon-o-trash') ->color('danger') ->requiresConfirmation(), ]), ]) ->cardActionsPosition('top-right') ->showCardActionsOnHover() ->itemClickAction('viewMilestone') ->titleAction('viewAllMilestones') ->cardSchema(fn (Schema $schema, $record) => $schema->components([ TextEntry::make('title')->weight('bold'), TextEntry::make('due_date')->date(), TextEntry::make('priority')->badge(), ])),
Testing
composer test
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.
codenzia/filament-carousel 适用场景与选型建议
codenzia/filament-carousel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「codenzia」 「filament-carousel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codenzia/filament-carousel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codenzia/filament-carousel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codenzia/filament-carousel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Protected super admin account for Laravel. Zero-config authorization via Gate::before, defense-in-depth Eloquent observer, optional Filament v4 plugin, vendor-only CLI commands with friction controls. Designed for vendor-deployed applications where customer admins must not accidentally delete the ve
Alfabank REST API integration
A web-based Artisan console, shell terminal, log viewer, and debug tool for Laravel — accessible from your browser, no database required.
A powerful media manager plugin for Filament v4 with drag-and-drop uploads, folder organization, image editing, and thumbnail generation.
Multi-panel architecture support with shared branding, dynamic colors, localization middleware, user moderation, and country/currency components for Filament v4.
System administration pages for Filament v4: logs viewer, cache management, database backup & restore, and system info.
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-28