mrshanebarron/button
Composer 安装命令:
composer require mrshanebarron/button
包简介
Customizable button component for Laravel - supports Livewire and Vue
README 文档
README
A versatile, customizable button component for Laravel applications. Supports multiple variants, sizes, loading states, and icons. Works with Livewire and Vue 3.
Installation
composer require mrshanebarron/button
Livewire Usage
Basic Usage
<livewire:sb-button>Click Me</livewire:sb-button>
Variants
<livewire:sb-button variant="primary">Primary</livewire:sb-button> <livewire:sb-button variant="secondary">Secondary</livewire:sb-button> <livewire:sb-button variant="success">Success</livewire:sb-button> <livewire:sb-button variant="danger">Danger</livewire:sb-button> <livewire:sb-button variant="warning">Warning</livewire:sb-button> <livewire:sb-button variant="outline">Outline</livewire:sb-button> <livewire:sb-button variant="ghost">Ghost</livewire:sb-button>
Sizes
<livewire:sb-button size="xs">Extra Small</livewire:sb-button> <livewire:sb-button size="sm">Small</livewire:sb-button> <livewire:sb-button size="md">Medium</livewire:sb-button> <livewire:sb-button size="lg">Large</livewire:sb-button> <livewire:sb-button size="xl">Extra Large</livewire:sb-button>
Loading State
<livewire:sb-button :loading="true">Processing...</livewire:sb-button>
As Link
<livewire:sb-button href="/dashboard">Go to Dashboard</livewire:sb-button>
Disabled
<livewire:sb-button :disabled="true">Disabled</livewire:sb-button>
Livewire Props
| Prop | Type | Default | Description |
|---|---|---|---|
type |
string | 'button' |
Button type: button, submit, reset |
variant |
string | 'primary' |
Visual style variant |
size |
string | 'md' |
Size: xs, sm, md, lg, xl |
disabled |
boolean | false |
Disable button |
loading |
boolean | false |
Show loading spinner |
href |
string | null |
Render as anchor link |
Vue 3 Usage
Setup
import { SbButton } from './vendor/sb-button'; app.component('SbButton', SbButton);
Basic Usage
<template> <SbButton @click="handleClick">Click Me</SbButton> </template>
Variants
<template> <SbButton variant="primary">Primary</SbButton> <SbButton variant="secondary">Secondary</SbButton> <SbButton variant="success">Success</SbButton> <SbButton variant="danger">Danger</SbButton> <SbButton variant="warning">Warning</SbButton> <SbButton variant="outline">Outline</SbButton> <SbButton variant="ghost">Ghost</SbButton> </template>
With Icons
<template> <!-- Icon on left (default) --> <SbButton icon="<svg>...</svg>" icon-position="left"> Save </SbButton> <!-- Icon on right --> <SbButton icon="<svg>...</svg>" icon-position="right"> Next </SbButton> <!-- Using slots --> <SbButton> <template #iconLeft> <MyIcon /> </template> Download </SbButton> </template>
Loading State
<template> <SbButton :loading="isSubmitting" @click="submit"> {{ isSubmitting ? 'Saving...' : 'Save' }} </SbButton> </template>
Vue Props
| Prop | Type | Default | Description |
|---|---|---|---|
type |
String | 'button' |
Button type attribute |
variant |
String | 'primary' |
Style: primary, secondary, success, danger, warning, outline, ghost |
size |
String | 'md' |
Size: xs, sm, md, lg, xl |
disabled |
Boolean | false |
Disable interactions |
loading |
Boolean | false |
Show spinner, disable button |
href |
String | null |
Render as <a> tag |
icon |
String | null |
HTML icon content |
iconPosition |
String | 'left' |
Position: left or right |
Slots
| Slot | Description |
|---|---|
| default | Button content |
iconLeft |
Left icon slot |
iconRight |
Right icon slot |
Styling
The button uses Tailwind CSS classes. Each variant has distinct colors:
- primary: Blue background
- secondary: Gray background
- success: Green background
- danger: Red background
- warning: Yellow background
- outline: Border only
- ghost: No background, hover effect
Accessibility
- Proper
disabledandaria-disabledattributes - Focus ring for keyboard navigation
- Loading state disables interaction
- Supports native button types
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
- Tailwind CSS 3.x
License
MIT License
mrshanebarron/button 适用场景与选型建议
mrshanebarron/button 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ui」 「laravel」 「button」 「vue」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrshanebarron/button 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrshanebarron/button 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrshanebarron/button 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A component that allows creating responsive HTML tables or lists from data object
Sylius plugin that adds the possibility to add products to the shopping cart using a button on the product card.
MvcCore - Extension - Form - form extension with base classes to create and render web forms with HTML5 controls, to handle and validate submited user data, to manage forms sessions for default values, to manage user input errors and to extend and develop custom fields and field groups.
Admin panel generator for Laravel 8 and based on Vuetify Admin, a separate SPA admin framework running on top of REST APIs.
Code generation for MPMG projects that use Laravel and VueJs tecnologies.
Symfony2 Bundle to integrate the CKEditor plugin Color Button
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-16