1.1.1 • Published 10 months ago

codepen-react v1.1.1

Weekly downloads
43
License
MIT
Repository
github
Last release
10 months ago

<CodePen />

嵌入codepen的React组件

简体中文 | English

安装

# NPM
$ npm install codepen-react -S

# Yarn
$ yarn add codepen-react

# pnpm
$ pnpm add codepen-react

使用

import React from 'react'
import CodePen from 'codepen-react'

export default class CodeBox extends React.Component {
  render() {
    return (
      <CodePen
        user="leedom92"
        hash="gOLvgRe"
      />
    )
  }
}

属性

属性类型类别参数值默认值说明
typestring可选iframe, embediframecodepen的类型
userstring必须nullcodepen的用户名
hashstring必须nullcodepen的hash值
widthstring可选'', %100%宽度
heightstring可选'', %400高度
titlestring可选''codepen的名称
themestring可选light, darklight主题
editablebool可选true, falsetrue是否可编辑
previewbool可选true, falsefalse是否显示预览,需手动开启codepen
tabstring可选html, css, js, resultresult默认显示面板

License

Copyright (c) 2021 Leedom Licensed under the MIT license.

1.1.1

10 months ago

1.1.0

10 months ago

1.0.1

4 years ago

1.0.0

4 years ago