定制 scadini/nova-icon 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

scadini/nova-icon

Composer 安装命令:

composer require scadini/nova-icon

包简介

A Laravel Nova icon field.

README 文档

README

Latest Stable Version License

This package allows you to render a SVG icon as a custom field.

Available Icons | Examples | Roadmap

Installation

composer require scadini/nova-icon

Usage

use NovaIcon\Icon;
public function fields()
{
    return [
        ID::make()->sortable(),

        Text::make('Name'),

        Icon::make('Approved')
            ->icon('entypo:check'),
    ];
}

Example 1

The simplest way to add an icon is by using the icon() method. This method accepts either a string or a closure containing the vendor name and the icon name separated by a colon:

    Icon::make('Approved')->icon('entypo:check');
    Icon::make('Approved')->icon(function () {
        return 'entypo:check';
    });

To apply css classes, you can chain the css() method. This method accepts a string, an array, or a closure:

    Icon::make('Approved')->icon('entypo:check')->css('text-info h-12 w-12');

    Icon::make('Approved')->icon('entypo:check')->css(['text-info', 'h-12', 'w-12']);

    Icon::make('Approved')
        ->icon('entypo:check')
        ->css(function () {
            return 'text-info h-12 w-12'; // or ['text-info', 'h-12', 'w-12']
        }
    );

To hide an icon for a specific row, you can use the hide() method. This method accepts a closure:

    Icon::make('Approved')
        ->icon('entypo:check')
        ->hide(function () {
            return $this->role === 'admin';
        });

Example

Here's an example about using this component. Let's say a user has a preferred internet platform:

    Icon::make('Platform')
        ->icon(function () {
            return 'entypo:' . $this->platform;
        })
        ->css(function () {
            $options = [
                'youtube' => 'text-danger',
                'vimeo'   => 'text-success'
            ];

            return $options[$this->platform];
        })

Example 2

Available Icons

The icons available are organized by their vendor name.

Currently, the only vendor available is Entypo, but there are plans to include Zondicons library.

For the icon names you can use this reference table

Roadmap

  • Add all icons from Entypo
  • Add all icons from Zondicons
  • Make icons clickable to perform actions or view resources

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固