mrshanebarron/radio-group
Composer 安装命令:
composer require mrshanebarron/radio-group
包简介
Radio group component for Laravel - supports Livewire and Vue
README 文档
README
A styled radio button group component for Laravel applications. Supports various layouts and custom styling. Works with Livewire and Vue 3.
Installation
composer require mrshanebarron/radio-group
Livewire Usage
Basic Usage
<livewire:sb-radio-group wire:model="plan" :options="[ 'basic' => 'Basic Plan', 'pro' => 'Pro Plan', 'enterprise' => 'Enterprise Plan' ]" />
With Descriptions
<livewire:sb-radio-group wire:model="plan" :options="[ ['value' => 'basic', 'label' => 'Basic', 'description' => '$9/month'], ['value' => 'pro', 'label' => 'Pro', 'description' => '$29/month'], ['value' => 'enterprise', 'label' => 'Enterprise', 'description' => '$99/month'] ]" />
Horizontal Layout
<livewire:sb-radio-group wire:model="size" :options="['sm' => 'Small', 'md' => 'Medium', 'lg' => 'Large']" layout="horizontal" />
Livewire Props
| Prop | Type | Default | Description |
|---|---|---|---|
wire:model |
string | - | Selected value |
options |
array | required | Radio options |
layout |
string | 'vertical' |
vertical or horizontal |
name |
string | auto | Input name attribute |
Vue 3 Usage
Setup
import { SbRadioGroup } from './vendor/sb-radio-group'; app.component('SbRadioGroup', SbRadioGroup);
Basic Usage
<template> <SbRadioGroup v-model="selected" :options="options" /> </template> <script setup> import { ref } from 'vue'; const selected = ref('option1'); const options = { option1: 'Option 1', option2: 'Option 2', option3: 'Option 3' }; </script>
With Descriptions
<template> <SbRadioGroup v-model="plan" :options="plans" /> </template> <script setup> import { ref } from 'vue'; const plan = ref('basic'); const plans = [ { value: 'basic', label: 'Basic', description: 'For individuals - $9/mo' }, { value: 'pro', label: 'Pro', description: 'For teams - $29/mo' }, { value: 'enterprise', label: 'Enterprise', description: 'Custom pricing' } ]; </script>
Horizontal Layout
<template> <SbRadioGroup v-model="size" :options="sizes" layout="horizontal" /> </template> <script setup> import { ref } from 'vue'; const size = ref('md'); const sizes = { sm: 'Small', md: 'Medium', lg: 'Large', xl: 'Extra Large' }; </script>
Card Style
<template> <SbRadioGroup v-model="shipping" :options="shippingOptions" variant="cards" /> </template> <script setup> import { ref } from 'vue'; const shipping = ref('standard'); const shippingOptions = [ { value: 'standard', label: 'Standard', description: '5-7 business days - Free' }, { value: 'express', label: 'Express', description: '2-3 business days - $9.99' }, { value: 'overnight', label: 'Overnight', description: 'Next business day - $24.99' } ]; </script>
Vue Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue |
String | - | Selected value |
options |
Object/Array | required | Radio options |
layout |
String | 'vertical' |
Layout direction |
variant |
String | 'default' |
Style variant |
name |
String | auto | Input name |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue |
string |
Selection changed |
Options Format
// Simple object format const options = { value1: 'Label 1', value2: 'Label 2' }; // Array with descriptions const options = [ { value: 'v1', label: 'Label 1', description: 'Description' }, { value: 'v2', label: 'Label 2', description: 'Description' } ];
Features
- Multiple Layouts: Vertical or horizontal
- Descriptions: Additional text per option
- Card Variant: Rich card-style options
- Accessible: Proper radio semantics
- Keyboard: Arrow key navigation
Styling
Uses Tailwind CSS:
- Blue accent color
- Focus ring on selection
- Hover states
- Disabled styling
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
- Tailwind CSS 3.x
License
MIT License
mrshanebarron/radio-group 适用场景与选型建议
mrshanebarron/radio-group 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「form」 「input」 「laravel」 「radio」 「vue」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrshanebarron/radio-group 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrshanebarron/radio-group 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrshanebarron/radio-group 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.
Widget to add a remaining character counter to text inputs and textareas
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
Native (browser) color input field for SilverStripe
Integration bundle for Aura.Input with Aura.Filter
A Laravel Filament Forms slug field.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-16