@yozora/react-table-cell
v0.0.10
Published
render markdown tableCell in react
Downloads
5
Maintainers
Readme
@yozora/react-table-cell
This package is designed to render mdast table cell type data
Install
npm
npm install --save @yozora/react-table-cell
yarn
yarn add @yozora/react-table-cell
Usage
Use in React project
Pure
import React from 'react' import TableCell from '@yozora/react-table-cell' const wrapper = ( <table> <tbody> <tr> <TableCell style={ { color: 'orange', fontSize: '16px' } }> some text1 <span>some text2</span> </TableCell> </tr> </tbody> </table> )
With theme
import React from 'react' import { DefaultTheme, ThemeProvider } from 'styled-components' import TableCell from '@yozora/react-table-cell' const theme: DefaultTheme = { yozora: { tableCell: { // padding: '0.4rem', borderColor: 'red', } } } const wrapper = ( <ThemeProvider theme={ theme }> <table> <tbody> <tr> <TableCell style={ { color: 'orange', fontSize: '16px' } }> some text1 <span>some text2</span> </TableCell> </tr> </tbody> </table> </ThemeProvider> )
Props
Name | Type | Required | Default | Description :----------:|:---------------------------------------:|:---------:|:-------:|:-------------
ref
|React.RefObject<HTMLTableCellElement>
|false
| - | Forwarded ref callbackchildren
|React.ReactNode
|true
| - | table cell contentsisHeader
|boolean
|false
|false
| Whether is the table header cellalign
|left|center|right
|false
| - | Table cell content alignTableCellProps inherited all attributes of
HTMLTableCellElement
(React.HTMLAttributes<HTMLTableCellElement>
)Theme
Prop Name | Default :------------:|:-------------- padding |
0.4rem 0.8rem
borderColor |transparent
See YozoraTableCellTheme for details.