1.0.4 • Published 3 years ago

react-single-balloon v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-single-balloon

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save react-single-balloon

Features

  • Supports any color in the balloon
  • Control transparency of the balloon
  • Custom height/width (size) of the balloon
  • Single click pop (hanle the event in parent component and play the burst sound of your choice)
  • Built with Typescript

Demo

Demo

Example

Edit react-floating-balloons-basic-example

Usage

import React from 'react'
import { Balloon } from 'react-single-balloon'

const App = () => {
  let audio = new Audio(
    'https://soundbible.com/mp3/Balloon%20Popping-SoundBible.com-1247261379.mp3'
  )

  const handleOnPop = () => {
    audio.play()
  }

  return (
    <>
      <Balloon onPop={handleOnPop} loop={true} color='#FFC0CB' size={60}>
        One
      </Balloon>
      <Balloon
        onPop={handleOnPop}
        loop={true}
        color='blue'
        size={80}
        opacity={0.7}
      >
        Two
      </Balloon>
      <Balloon onPop={handleOnPop} loop={true} color='#EA18B4' size={90}>
        <div>Three</div>
      </Balloon>
      <Balloon onPop={handleOnPop} loop={true} size={120} opacity={0.4}>
        Four
      </Balloon>
      <Balloon onPop={handleOnPop} loop={true} color='#18EA1E' size={140}>
        Five
      </Balloon>
    </>
  )
}

export default App

Props

NameTypeRequiredOptionsDefaultDescription
sizenumberfalse10, 20, 35, 40020The height and width of the balloon.
colorstringfalseyellow, blue, #EA18B4redAny valid color of the balloon.
loopbooleanfalsetrue or falsetrueShould loop or hang on the top.
opacitynumberfalse0 ... 11Transparency of the balloon.
onPopFunctionfalseSingle click event on ballon
childrenReact.ReactNodeAny valid HTML code. e.g, You can pass the text to be shown inside the balloon. It will be centered. Make sure the text is smaller than the size of the balloon.

License

MIT © amitvchaudhary

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago