@yozora/react-common-copy-button
v3.0.0-alpha.7
Published
<header> <h1 align="center"> <a href="https://github.com/yozorajs/yozora-react/tree/release-2.x.x/packages/react-common-copy-button#readme">@yozora/react-common-copy-button</a> </h1> <div align="center"> <a href="https://www.npmjs.com/packag
Downloads
75
Readme
Render a simple copy button.
Install
npm
npm install --save @yozora/react-common-copy-button
yarn
yarn add @yozora/react-common-copy-button
Usage
Basic:
import React from 'react' import CopyButton from '@yozora/react-common-copy-button' const wrapper = (<CopyButton value="waw" style={ { color: 'orange' } } />)
Props
| Name | Type | Required | Default | Description |
| :-------------: | :-------------------------------: | :------: | :-------: | :----------------------------------------------- |
| className
| string
| false
| - | Root css class |
| statusNodeMap
| Record<string, React.ReactNode>
| false
| See below | Map of copy status and displaying text. |
| style
| React.CSSProperties
| false
| - | Root css style |
| value
| string
| true
| - | The literal texture content that waiting to copy |
className
: The root element of this component will always bind with the CSS class'yozora-common-copy-button'
.statusNodeMap
:export const defaultStatusNodeMap: Record<CopyStatus, React.ReactNode> = { waiting: 'copy', copying: 'copying..', failed: 'failed!', succeed: 'copied!', }