承接 ynacorp/nova-swatches 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ynacorp/nova-swatches

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ynacorp/nova-swatches

包简介

A beautiful color picking field for Laravel Nova.

README 文档

README

A beautiful color picking field for Laravel Nova. Uses vue-swatches.

Screenshots

Installation

You can install the package into a Laravel application that uses Nova via composer:

composer require ynacorp/nova-swatches 

Usage

Just use the Swatches field in your Nova resource:

namespace App\Nova; use Yna\NovaSwatches\Swatches; class Article extends Resource { // ... public function fields(Request $request) { return [ // ... Swatches::make('Color'), // ... ]; } }

Customization

Presets

vue-swatches provides a few color presets out of the box.

 public function fields(Request $request) { return [ // ... // material-basic is a basic collection of material colors. Swatches::make('Color')->colors('material-basic'), // ... ]; }

Try switching between material-basic, text-basic, text-advanced, material-light and material-dark.

If you're not satisfied with the presets, keep customizing as shown below.

Palettes

You can also provide an array of colors for the user to pick from.

 public function fields(Request $request) { return [ // ... // material-basic is a basic collection of material colors. Swatches::make('Color')->colors(['#ffffff', '#000']), // ... ]; }

Anything else...

vue-swatches is extremely customizable, you can pass an array of props directly to it:

 public function fields(Request $request) { return [ // ... Swatches::make('Color') ->withProps([ 'colors' => ["#4ae2c4", "#4fccff", "#41c84d"], 'show-fallback' => true, 'fallback-type' => 'input', 'popover-to' => 'left', // More options at https://saintplay.github.io/vue-swatches/api/props.html ]), // ... ]; }

Check out vue-swatches' props section for more options.

Configuration

While the Swatches component can be configured fluently, you can also set the defaults by publishing the package's config:

php artisan vendor:publish --tag=config --provider=Yna\\NovaSwatches\\FieldServiceProvider 

Now edit file at the config/nova/swatches.php to customize the preferred defaults for your project:

<?php return [ /**  * Props to pass to the vue-swatches component.  *  * See https://saintplay.github.io/vue-swatches/api/props.html  */ 'props' => [ 'colors' => 'basic', // Preset // 'colors' => 'material-basic', // Preset // 'colors' => ['#ffffff', '#000'], // Array // 'show-fallback' => true, // 'fallback-input-type' => 'input', // Or "color" ] ];

Contribution

We'd be glad to accept any contributions to Nova Swatches.

统计信息

  • 总下载量: 279.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 2
  • Forks: 5
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固