1 Star 0 Fork 0

LCUI 开发 / React 图标库

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Fluent UI System Icons

(中文/English)

Fluent UI 系统图标是一组来自微软的熟悉、友好和现代的图标。

本项目基于 Fluent UI System Icons 的图标文件重新生成图标库,适合 LCUI 应用程序使用,具体生成规则可查看文件:scripts/convert.js

Fluent System Icons

安装

npm install @lcui/react-icons

使用

要使用这些图标,你需要先在你的根组件文件中引入 css 文件:

// src/App.tsx

import '@lcui/react-icons/dist/style.css';

然后用 import { [IconName][Style] } from @lcui/react-icons 来引入它们。例如:

// src/MyComponent.tsx

import { AccessTime, AccessTimeFilled } from '@lcui/react-icons';
import styles from './MyCompoennt.module.css';

export default function MyComonent() {
  return (
    <div>
      <AccessTime className={styles.icon} size={24} />
      <AccessTimeFilled className={styles.icon} />
    </div>
  );
}

图标有 Regular 和 Filled 两种风格,其中 Regular 是默认风格,用 AccessTime 即可,无需写成 AccessTimeRegular

如果你不喜欢这种用法,也可以只用 Icon 组件:

// src/MyComponent.tsx

import { Icon } from '@lcui/react-icons';
import styles from './MyCompoennt.module.css';

export default function MyComonent() {
  return (
    <div>
      <Icon name="access-time" className={styles.icon} size={24} />
      <Icon name="access-time" className={styles.icon} filled />
    </div>
  );
}

如果你不喜欢写 TypeScript React 代码,也可以在 C 代码中这么用:

#include <LCUI.h>

...

int main(int argc, char **argv)
{
  ui_widget_t *icon;

  lcui_init();

  ui_load_css_file("FluentSystemIcons-Regular.css");
  ui_load_css_file("FluentSystemIcons-Filled.css");

  icon = ui_create_widget("text"):
  ui_widget_add_class(icon, "fui-icon-regular access-time-24-regular");
  ui_widget_set_style_unit_value(w, css_prop_font_size, 24, CSS_UNIT_PX)
  ui_root_append(icon);

  icon = ui_create_widget("text"):
  ui_widget_add_class(icon, "fui-icon-filled access-time-24-filled");
  ui_root_append(icon);

  return lcui_main();
}

之后,手动复制 node_modules/@lcui/react-icons/dist 目录内的 css 和 ttf 文件到应用程序工作目录内。

更新

下载 fluentui-system-icons 最新源码包,解压其中的 fonts 目录到本项目目录内,然后运行:

npm run build

许可

MIT

MIT License Copyright (c) 2023 liu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Fluent UI 系统图标是一组来自微软的熟悉、友好和现代的图标 展开 收起
TypeScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
TypeScript
1
https://gitee.com/lcui-dev/fluent-ui-system-icons.git
git@gitee.com:lcui-dev/fluent-ui-system-icons.git
lcui-dev
fluent-ui-system-icons
React 图标库
master

搜索帮助