Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/karlhorky/react-sc-braces

Braces to indicate elements in diagrams
https://github.com/karlhorky/react-sc-braces

Last synced: 3 months ago
JSON representation

Braces to indicate elements in diagrams

Awesome Lists containing this project

README

        

# react-sc-braces

> Curly braces to indicate elements in diagrams (built in React and styled-components)

For vanilla HTML + CSS, check out the [Codepen](https://codepen.io/karlhorky/pen/vwmqqv).

## Install

This component is intended for use with React and styled-components. If you're using those libraries already, just copy and paste the component file [`Brace.js`](./Brace.js) into your codebase. This hasn't been published as a package yet, because publishing CSS packages is not great with the current state of tooling in 2019.

## [Demo](https://codesandbox.io/s/reactscbraces-gpjv3)

## Examples

```jsx
{/* Set brace and text colors to #fff, with annotation text */}

JavaScript

{/* Set brace color to crimson (text color defaults to #000) */}

{/* Default to #000 brace and text colors */}

{/* Default to top side and auto width */}

```

## Props

| prop | values | default |
| ------------ | ----------------------------------------------- | ------- |
| `side` | `top`, `bottom`, `left`, or `right` | `top` |
| `color` | CSS color for both the curly brace and the text | `#000` |
| `braceColor` | CSS color for the curly brace | `#000` |
| `textColor` | CSS color for the text | `#000` |
| `width` | width of the `top` and `bottom` side braces | unset |
| `height` | height of the `left` and `right` side braces | unset |
| `fontSize` | font size | unset |
| `fontFamily` | font family | unset |

## Credit

Heavily inspired by [Lauren Herda](https://github.com/lrenhrda)'s [Codepen](https://codepen.io/lrenhrda/pen/hkLIe).