mrshanebarron/lightbox
Composer 安装命令:
composer require mrshanebarron/lightbox
包简介
Image lightbox gallery component for Laravel - supports Livewire and Vue
README 文档
README
An image lightbox gallery component for Laravel applications. Click to open images in fullscreen overlay with navigation. Works with Livewire and Vue 3.
Installation
composer require mrshanebarron/lightbox
Livewire Usage
Basic Usage
<livewire:sb-lightbox :images="[ ['src' => '/images/photo1.jpg', 'alt' => 'Photo 1'], ['src' => '/images/photo2.jpg', 'alt' => 'Photo 2'], ['src' => '/images/photo3.jpg', 'alt' => 'Photo 3'] ]" />
With Thumbnails and Captions
<livewire:sb-lightbox :images="$gallery" :columns="4" />
Livewire Props
| Prop | Type | Default | Description |
|---|---|---|---|
images |
array | [] |
Array of image objects |
columns |
number | 3 |
Grid columns |
Vue 3 Usage
Setup
import { SbLightbox } from './vendor/sb-lightbox'; app.component('SbLightbox', SbLightbox);
Basic Usage
<template> <SbLightbox :images="images" /> </template> <script setup> const images = [ { src: '/images/photo1.jpg', alt: 'Mountain sunset' }, { src: '/images/photo2.jpg', alt: 'Ocean view' }, { src: '/images/photo3.jpg', alt: 'Forest path' } ]; </script>
With Thumbnails and Captions
<template> <SbLightbox :images="gallery" :columns="4" /> </template> <script setup> const gallery = [ { src: '/images/full/photo1.jpg', thumbnail: '/images/thumbs/photo1.jpg', alt: 'Beach sunset', caption: 'Sunset at Malibu Beach, California' }, { src: '/images/full/photo2.jpg', thumbnail: '/images/thumbs/photo2.jpg', alt: 'Mountain peak', caption: 'View from the summit' } ]; </script>
Portfolio Gallery
<template> <div class="container mx-auto p-8"> <h2 class="text-2xl font-bold mb-6">Portfolio</h2> <SbLightbox :images="portfolio" :columns="3" /> </div> </template> <script setup> const portfolio = [ { src: '/work/project1.jpg', caption: 'E-commerce Redesign' }, { src: '/work/project2.jpg', caption: 'Mobile App UI' }, { src: '/work/project3.jpg', caption: 'Brand Identity' }, { src: '/work/project4.jpg', caption: 'Web Application' }, { src: '/work/project5.jpg', caption: 'Marketing Campaign' }, { src: '/work/project6.jpg', caption: 'Product Photography' } ]; </script>
Vue Props
| Prop | Type | Default | Description |
|---|---|---|---|
images |
Array | [] |
Array of image objects |
columns |
Number | 3 |
Grid columns for thumbnails |
Image Object
{ src: '/path/to/full-image.jpg', // Required - Full size image thumbnail: '/path/to/thumb.jpg', // Optional - Thumbnail (uses src if not set) alt: 'Image description', // Optional - Alt text caption: 'Display caption' // Optional - Shown below image }
Keyboard Navigation
| Key | Action |
|---|---|
Escape |
Close lightbox |
← |
Previous image |
→ |
Next image |
Features
- Grid Gallery: Responsive thumbnail grid
- Fullscreen Overlay: Dark backdrop lightbox
- Navigation: Previous/next arrows
- Counter: Shows current position (1 / 6)
- Captions: Optional image captions
- Keyboard Support: Arrow key navigation
- Click Outside: Close on backdrop click
- Zoom Effect: Thumbnail hover zoom
Styling
Uses Tailwind CSS:
- Responsive grid layout
- Dark overlay backdrop
- White navigation arrows
- Smooth fade transitions
- Rounded thumbnails
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
- Tailwind CSS 3.x
License
MIT License
mrshanebarron/lightbox 适用场景与选型建议
mrshanebarron/lightbox 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mrshanebarron/lightbox 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrshanebarron/lightbox 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-14