Coder Social home page Coder Social logo

abdullahtariq1171 / react-spoiler Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 2.39 MB

A spoiler component for React

Home Page: https://abdullahtariq1171.github.io/react-spoiler/

License: MIT License

JavaScript 97.78% HCL 2.22%
react spoiler component react-component javascript blur

react-spoiler's Introduction

npm version

react-spoiler

A spoiler component for reactjs

Demo https://827r7v3kxj.codesandbox.io/

Install

using yarn
yarn add react-spoiler

using npm
npm install react-spoiler

Usage

import ReactSpoiler from "react-spoiler";

<ReactSpoiler>
  <h1>ReactSpoiler</h1>
  <p> Click/Hover me to the magic! </p>
</ReactSpoiler>

Quick Start With unpkg CDN

Simply include following script

<script src="https://unpkg.com/react-spoiler@latest/dist/index.umd.js"></script>

Complete demo example using cdn

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>React Spoiler Example</title>
    <script src="https://unpkg.com/react@latest/umd/react.development.js"></script>
    <script src="https://unpkg.com/react-dom@latest/umd/react-dom.development.js"></script>

    <!-- Don't use this in production: -->
    <script src="https://unpkg.com/babel-standalone@latest/babel.min.js"></script>

    <script src="https://unpkg.com/react-spoiler@latest/dist/index.umd.js"></script>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">

      ReactDOM.render(
        <ReactSpoiler>
          <h1>ReactSpoiler</h1>
          <p> Click/Hover me to the magic! </p>
        </ReactSpoiler>,
        document.getElementById('root')
      );

    </script>
  </body>
</html>

Props

prop type default description
show boolean false show/hide spoiler on initial render
tag string div decides the type of rendered element
blur number 4 blur value on clicked
hoverBlur number blur/2 blur value on hovered

Note: all other props will be passed to tag element.

License

MIT

react-spoiler's People

Contributors

0xflotus avatar abdullahtariq1171 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

0xflotus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.