mrshanebarron/select
Composer 安装命令:
composer require mrshanebarron/select
包简介
Select dropdown component for Laravel - supports Livewire and Vue
README 文档
README
A custom select dropdown component for Laravel applications. Supports search, multi-select, and custom styling. Works with Livewire and Vue 3.
Installation
composer require mrshanebarron/select
Livewire Usage
Basic Usage
<livewire:sb-select wire:model="country" :options="['us' => 'United States', 'ca' => 'Canada', 'mx' => 'Mexico']" />
With Placeholder
<livewire:sb-select wire:model="status" :options="$statuses" placeholder="Select a status" />
Searchable
<livewire:sb-select wire:model="country" :options="$countries" :searchable="true" placeholder="Search countries..." />
Multi-select
<livewire:sb-select wire:model="tags" :options="$availableTags" :multiple="true" placeholder="Select tags" />
Livewire Props
| Prop | Type | Default | Description |
|---|---|---|---|
wire:model |
mixed | null |
Selected value(s) |
options |
array | required | Key-value options |
placeholder |
string | 'Select an option' |
Placeholder text |
searchable |
boolean | false |
Enable search |
multiple |
boolean | false |
Allow multiple selections |
disabled |
boolean | false |
Disable select |
Vue 3 Usage
Setup
import { SbSelect } from './vendor/sb-select'; app.component('SbSelect', SbSelect);
Basic Usage
<template> <SbSelect v-model="selected" :options="options" /> </template> <script setup> import { ref } from 'vue'; const selected = ref(null); const options = { draft: 'Draft', published: 'Published', archived: 'Archived' }; </script>
With Placeholder
<template> <SbSelect v-model="selected" :options="options" placeholder="Choose a status..." /> </template>
Searchable
<template> <SbSelect v-model="country" :options="countries" searchable placeholder="Search countries..." /> </template> <script setup> import { ref } from 'vue'; const country = ref(null); const countries = { us: 'United States', ca: 'Canada', uk: 'United Kingdom', de: 'Germany', fr: 'France', // ... more countries }; </script>
Multi-select
<template> <SbSelect v-model="selectedTags" :options="tags" multiple placeholder="Select tags" /> <p>Selected: {{ selectedTags }}</p> </template> <script setup> import { ref } from 'vue'; const selectedTags = ref([]); const tags = { frontend: 'Frontend', backend: 'Backend', design: 'Design', devops: 'DevOps' }; </script>
Form Example
<template> <form @submit.prevent="submit" class="space-y-4"> <div> <label class="block text-sm font-medium mb-1">Category</label> <SbSelect v-model="form.category" :options="categories" placeholder="Select category" /> </div> <div> <label class="block text-sm font-medium mb-1">Tags</label> <SbSelect v-model="form.tags" :options="tags" multiple searchable placeholder="Select tags" /> </div> <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded"> Save </button> </form> </template>
Vue Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue |
Any | null |
Selected value(s) |
options |
Object | required | { value: 'Label' } pairs |
placeholder |
String | 'Select an option' |
Placeholder text |
searchable |
Boolean | false |
Enable filtering |
multiple |
Boolean | false |
Multi-select mode |
disabled |
Boolean | false |
Disable interaction |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue |
any |
Emitted when selection changes |
Features
- Custom Styling: Matches form design
- Searchable: Filter options by typing
- Multi-select: Select multiple values
- Checkmarks: Visual selection indicators
- Keyboard Navigation: Escape to close
- Click Outside: Closes on outside click
Options Format
// Object format (value => label) const options = { draft: 'Draft', published: 'Published', archived: 'Archived' };
Multi-select Values
When multiple is true, the model value is an array:
// Single select
const selected = ref('draft'); // string
// Multi-select
const selected = ref(['frontend', 'backend']); // array
Styling
Uses Tailwind CSS:
- White background with border
- Blue ring on focus
- Checkmark for selected items
- Hover highlight
- Disabled opacity
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
- Tailwind CSS 3.x
License
MIT License
mrshanebarron/select 适用场景与选型建议
mrshanebarron/select 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「form」 「laravel」 「select」 「dropdown」 「vue」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mrshanebarron/select 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mrshanebarron/select 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mrshanebarron/select 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP behavior plugin for easily generating some complicated queries like (bulk) insert/upsert etc.
PHP PDO Mysql select statement iterator implemented as multiple queries using LIMIT clauses
PHP library that allows linking queries from diferent physical databases using mysql pdo database connections
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.
Country select field type.
A Laravel Filament Forms slug field.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-16