6

玩转web3第二篇——Web3UI Kit - soraly

 1 year ago
source link: https://www.cnblogs.com/soraly/p/17085998.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

玩转web3第二篇——Web3UI Kit

开发web2应用的时候,可以很方便找到很多优秀的UI库,比如antd,material ui,element ui等等,但web3应用对应的UI库却不多。

今天给大家介绍一款优秀的WEB3的UI库——Web3UI Kit,借助它内置的丰富组件,可以帮助开发人员快速开发出美观的web3页面。

官方推荐的安装是:

npm install @web3uikit/core @web3uikit/web3 @web3uikit/icons

但我安装了使用发现只能用基础组件,引入一些web3组件的时候就会报错,查了些资料后有人推荐这样安装,大家可以两种方法都尝试下。

yarn add  web3uikit@^0.1.159
830865-20230201175448958-1705704463.png
import { CryptoCards, Button } from '@web3uikit/core';

const App = () => (
    <>
        <CryptoCards
            chain="ethereum"
            bgColor="blue"
            chainType="Network"
            onClick={console.log}
        />
        <Button theme="primary" type="button" text="Launch Dapp" />
    </>
);

1. 核心组件——web3组件:

830865-20230201170613279-1082550345.png

 使用的方法也很简单, 以ConnectButton为例,直接引入就好了。

import { ConnectButton, Hero } from "web3uikit";

830865-20230202164443472-1371057594.png

 点击后可以直接连接钱包登录,还集成了多种钱包,使用很方便

830865-20230202164524513-2066043157.png

2. 表单组件

830865-20230201175910879-578199476.png

 以DatePicker为例

import { DatePicker } from '@web3uikit/core';

<DatePicker   id="date-picker"     onChange={() => { }}    />
830865-20230202165735007-271862500.png

3. 布局组件

830865-20230201175927369-331348480.png

Accordion为例:

<Accordion
        hasLockIcon
        id="accordion"
        subTitle="the sub title"
        tagText="Tag!"
        theme="blue"
        title="Accordion"
      >
        <h2 style={{ paddingLeft: "20px" }}>hello world</h2>
      </Accordion>
830865-20230202171243952-1104963760.png

 4. UI组件

830865-20230201175949735-767007826.png

NFTcard:

ContractedBlock.gifExpandedBlockStart.gif

nftcard

 

830865-20230202171433194-448579364.png
830865-20230201180259734-1461495986.png

 详细官方组件文档:https://web3ui.github.io/web3uikit/?path=/docs


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK