react hooks + typescript 开发的H5移动端组件库

CP Design

使用 React hooks Typescript 开发的一个 H5 移动端 组件库

组件截图
其中包括了下图中的27个基础组件:
CP Design项目预览

CP Design Mobile

手机扫码查看

(github地址:https://10086xiaozhang.github.io/CP-DESIGN)

特性

  • 基于 CP Design 移动设计规范。
  • 规则化的视觉样式配置,适应各类产品风格。
  • 使用 TypeScript React hooks 开发,提供类型定义文件。

🖥 环境支持

  • Modern browsers and Internet Explorer 11+ (with polyfills)
  • Server-side Rendering
  • Electron

| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |

📦 安装

npm install cp-design --save
yarn add cp-design

✨ 注意

在组件库中使用了 SASS,在安装的时候记得安装 node-sass

npm install node-sass --save-dev
yarn add node-sass -D

🔨 使用

import { Button } from 'cp-design'

const App = () => (
<>
<Button type="primary">PRESS ME</Button>
</>
)

组件

  • Icon,
  • Button,
  • Input,
  • Row,
  • Col,
  • Affix,
  • Avatar,
  • Badge,
  • Card,
  • CheckboxGroup,
  • Checkbox,
  • Accordion,
  • Divider,
  • Modal,
  • Overlay,
  • Pagination,
  • Progress,
  • Radio,
  • Slider,
  • Step,
  • Spin,
  • Switch,
  • Tabs,
  • Tag,
  • ImagePicker,
  • Toast,
  • ActionSheet,
  • TabBar,
  • PickerPanel,
  • Picker,
  • SegmentedControl,
  • Popover,
  • NoticeBar,
  • SwipeAction
  • ListView

部分组件使用

Button 按钮

按钮的展示

引入组件

import * as React from 'react'
import { Button, Row, Col } from 'cp-design'

Demo 代码

export default function ButtonDemo() {
  const onClick = () => {}
  return (
    <div>
      <Row style={
  { marginBottom: '1rem' }}>
        <Col span={24}>
          <Button onClick={onClick}>default</Button>
        </Col>
      </Row>
      <Row style={
  { marginBottom: '1rem' }}>
        <Col span={24}>
          <Button disabled>default disabled</Button>
        </Col>
      </Row>
      <Row style={
  { marginBottom: '1rem' }}>
        <Col span={24}>
          <Button type="primary" onClick={onClick}>
            primar
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值