承接 daun/statamic-icon-button-fieldtypes 相关项目开发

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

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

daun/statamic-icon-button-fieldtypes

最新稳定版本:0.3.0

Composer 安装命令:

composer require daun/statamic-icon-button-fieldtypes

包简介

Icon-only button fieldtypes for Statamic

README 文档

README

Icon-only button fieldtypes for compact toggles and switches.

Example icon button fields

Installation

Install the addon via Composer:

composer require daun/statamic-icon-button-fieldtypes

Fieldtypes

The addon ships with three fieldtypes, each extending a native Statamic fieldtype:

  • Single-choice Icon Group extends the native Button Group
  • Multi-Choice Icon Toggles extends the Checkboxes fieldtype
  • Boolean Icon Toggle extends the Toggle fieldtype

Icon Group

The Icon Group fieldtype extends the native Button Group fieldtype and allows selecting a single option from a predefined set of options.

Example icon group fields

align:
  display: Align
- type: button_group
+ type: icon_group
  options:
    -
      value: Left
      key: left
+     icon: align-start-vertical
    -
      value: Right
      key: right
+     icon: align-end-vertical

Icon Toggles

The Icon Toggles fieldtype extends the native Checkboxes fieldtype and allows selecting one or more options from a predefined set of options.

Example icon toggles field

playback:
  display: Playback options
- type: checkboxes
+ type: icon_toggles
  options:
    -
      value: sound
      key: sound
+     icon: volume
    -
      value: Loop
      key: loop
+     icon: repeat
    -
      value: Captions
      key: captions
+     icon: captions

Icon Toggle

The Icon Toggle fieldtype extends the native Toggle fieldtype and allows switching a single value on or off.

Example icon toggles field

featured:
  display: Featured
- type: toggle
+ type: icon_toggle
+ button_icon: star

Note that the option here is called button_icon because icon key is a reserved key by Statamic.

Custom Icon Sets

Icons are pulled from the built-in control panel icon set. To use icons from a different set, change the set option of each field to the desired set.

Example: Lucide

The example steps below will install and use icons from the Lucide icon set, used in the examples above.

Install icon set:

npm install lucide-static

Register icon set in control panel:

// resource/js/cp.js

import { registerIconSet } from '@statamic/cms/ui';

Statamic.booting(() => {
    registerIconSet('lucide', import.meta.glob(
        '../../node_modules/lucide-static/icons/*.svg',
        { query: '?raw', import: 'default' }
    ));
});

Switch field to use icon set:

visibility:
  type: icon_group
  display: Visibility
+ set: lucide
  options:
    -
      value: Public
      key: public
      icon: eye
    -
      value: Private
      key: private
      icon: eye-off

License

MIT

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-17