mrshanebarron/accordion
Composer 安装命令:
composer require mrshanebarron/accordion
包简介
Collapsible accordion component for Laravel - supports Livewire and Vue
README 文档
README
Expandable content sections with smooth animations for Laravel applications. Supports single or multiple open panels, default open state, and custom styling. Works with Livewire and Vue 3.
Installation
composer require mrshanebarron/accordion
Livewire Usage
Basic Usage
@php $items = [ 'item1' => [ 'title' => 'What is this package?', 'content' => 'A beautiful accordion component for Laravel applications.', ], 'item2' => [ 'title' => 'Is it free to use?', 'content' => 'Yes! All components are free and open source under the MIT license.', ], 'item3' => [ 'title' => 'Does it support Livewire?', 'content' => 'Absolutely! Works with Livewire and Vue.js.', ], ]; @endphp <livewire:sb-accordion :items="$items" />
Default Open
<livewire:sb-accordion :items="$items" default-open="item1" />
Multiple Open Panels
<livewire:sb-accordion :items="$items" :multiple="true" />
Livewire Props
| Prop | Type | Default | Description |
|---|---|---|---|
items |
array | [] |
Array of accordion items with title and content keys |
multiple |
boolean | false |
Allow multiple panels open simultaneously |
defaultOpen |
string | null |
Key of item to open by default |
Item Structure
$items = [ 'unique_key' => [ 'title' => 'Panel Title', 'content' => 'Panel content text or HTML', ], ];
Vue 3 Usage
Setup
import { SbAccordion, SbAccordionItem } from './vendor/sb-accordion'; app.component('SbAccordion', SbAccordion); app.component('SbAccordionItem', SbAccordionItem);
Basic Usage
<template> <SbAccordion> <SbAccordionItem title="First Panel"> Content for the first panel. </SbAccordionItem> <SbAccordionItem title="Second Panel"> Content for the second panel. </SbAccordionItem> </SbAccordion> </template>
With Default Open
<template> <SbAccordion default-open="panel1"> <SbAccordionItem id="panel1" title="Open by Default"> This panel is open by default. </SbAccordionItem> <SbAccordionItem id="panel2" title="Closed"> This panel starts closed. </SbAccordionItem> </SbAccordion> </template>
Multiple Open
<template> <SbAccordion :multiple="true"> <SbAccordionItem title="Panel One">Content One</SbAccordionItem> <SbAccordionItem title="Panel Two">Content Two</SbAccordionItem> </SbAccordion> </template>
Vue Props
SbAccordion
| Prop | Type | Default | Description |
|---|---|---|---|
multiple |
Boolean | false |
Allow multiple panels open |
defaultOpen |
String | null |
ID of default open panel |
SbAccordionItem
| Prop | Type | Default | Description |
|---|---|---|---|
id |
String | auto | Unique identifier |
title |
String | required | Panel header text |
disabled |
Boolean | false |
Disable panel toggle |
Events
Livewire
<livewire:sb-accordion :items="$items" @accordion-toggled="handleToggle" />
Vue
<SbAccordion @panel-toggled="handleToggle">
Styling
The accordion uses Tailwind CSS classes with:
- Smooth expand/collapse animations via Alpine.js x-collapse
- Rounded corners and subtle shadows
- Hover states on headers
- Chevron icon rotation on open
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
- Tailwind CSS 3.x
- Alpine.js (for animations)
License
MIT License
mrshanebarron/accordion 适用场景与选型建议
mrshanebarron/accordion 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「accordion」 「collapse」 「vue」 「livewire」 「expandable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrshanebarron/accordion 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrshanebarron/accordion 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrshanebarron/accordion 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Collapse and Accordion widgets for the Yii 2.0 framework
Easily place an accordion in the wysiwyg via a related set of AccordionItems
Zeus Accordion is filamentphp layout component to group components
A custom sidebar menu with collapsible groups
Drupal 8 text_with_summary field formatter. Adds 'Read more' button to expand/collapse full content.
Hide the control panel’s right pane navigation to free up more screen real estate.
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-16