react-nice-bubble

A customizable bubble for react which support transparent background and border.

Usage no npm install needed!

<script type="module">
  import reactNiceBubble from 'https://cdn.skypack.dev/react-nice-bubble';
</script>

README

react-nice-bubble · GitHub license npm version

The powerful bubble component for React which support transparent background and border.

key features

  • support background color with alpha.
  • support border color with alpha.
  • support custom border width.
  • support custom border radius.
  • support custom border color.
  • support custom background color.
  • support custom bubble width.
  • support custom bubble height.
  • support 12 arrow position.
  • support custom arrow shape.
  • support box-sizing.

Installation

Using npm:

$ npm install --save react-nice-bubble

Demo

storybook

Example

import React from 'react';
import Bubble, { BoxSizing, Position } from 'react-nice-bubble';

const App = (
  <Bubble
     width={300}
     height={300}
     arrowSize={16}
     arrowDegree0={45}
     arrowDegree1={45}
     arrowOffset={16}
     position={Position.TOP_LEFT}
     borderWidth={1}
     borderColor="black"
     borderRadius={0}
     boxSizing={BoxSizing.CONTENT_BOX}
     backgroundColor="white"
  >
     Hello world!
  </Bubble>
);

const root = document.getElementById('root');
ReactDOM.render(<App />, root);

Props

WIP