Socket
Socket
Sign inDemoInstall

dingtalk-design-icons

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dingtalk-design-icons

icons


Version published
Maintainers
1
Created

Readme

Source

D-Design 图标库

官方提供的图标库,适用于 React 版本

使用
tnpm i dingtalk-design-icons@latest --save
import { SearchOutlined } from 'dingtalk-design-icons';

按需加载:

import SearchOutlined from 'dingtalk-design-icons/lib/SearchOutlined';

or

import SearchOutlined from 'dingtalk-design-icons/es/SearchOutlined';

或者使用 babel-plugin-import 自动按需加载。

tips: 直接在文档中点击 icon,自动复制代码,Quick Fix... (⌘.) 自动引入包。

依赖的图标 Iconfont 项目: IconfontCN - DingTalk Design System

API
参数名说明类型默认值备注
className设置图标的样式名string
style设置图标的样式,例如 fontSize 和 colorCSSProperties
iconBtn设置为 Botton 样式的 iconbooleanfalse
onClick点击事件() => void
自定义 Font 图标

我们提供了一个 createFromIconfontCN 方法,方便开发者调用在 iconfont.cn 上自行管理的图标。

import createFromIconfontCN from 'dingtalk-design-icons/createFromIconfontCN'; // 按需加载

const MyIcon = createFromIconfontCN({
  scriptUrl: '//at.alicdn.com/t/font_135284_ecj6zgpqtbn.js', // 在 iconfont.cn 上生成
});

ReactDOM.render(<MyIcon type="DingTalk-XDS_iconcastscreenfill" />, mountedNode);

其本质上是创建了一个使用 标签来渲染图标的组件。

options 的配置项如下:

参数说明类型默认值
extraCommonProps给所有的 svg 图标 组件设置额外的属性{ [key: string]: any }{}
scriptUrliconfont.cn 项目在线生成的 js 地址string | string[]-

在 scriptUrl 都设置有效的情况下,组件在渲染前会自动引入 iconfont.cn 项目中的图标符号集,无需手动引入。

iconfont.cn 使用帮助 查看如何生成 js 地址。

命名规范
  • 实底风格:ComponentFilled
  • 线框风格:ComponentOutlined

Keywords

FAQs

Last updated on 21 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc