Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linusu/react-with-separator
Add a separator between each element
https://github.com/linusu/react-with-separator
react separator
Last synced: 4 days ago
JSON representation
Add a separator between each element
- Host: GitHub
- URL: https://github.com/linusu/react-with-separator
- Owner: LinusU
- Created: 2017-10-04T14:25:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-30T11:38:35.000Z (about 2 years ago)
- Last Synced: 2024-11-02T12:12:00.453Z (11 days ago)
- Topics: react, separator
- Language: JavaScript
- Homepage:
- Size: 37.1 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# React `WithSeparator`
Add a separator between each element.
## Installation
```sh
npm install --save react-with-separator
```## Usage
```js
const WithSeparator = require('react-with-separator')const React = require('react')
const { render } = require('react-dom')const Footer = ({ username }) => (
(!username && (
Login
))(username && (
Logout
))Help
)render()
```Will render something like this:
```text
Logout | Help
```## Props
### `separator`
- required
- type: `ReactElement | string`The element or string to insert between each child element.
### `leading`
- optional
- type: `boolean`Whether to insert a leading separator or not.
### `trailing`
- optional
- type: `boolean`Whether to insert a trailing separator or not.
### `children`
- optional
- type: `React.ReactNode`The children to insert separators between