1.0.2 • Published 6 years ago

react-titles v1.0.2

Weekly downloads
7
License
ISC
Repository
github
Last release
6 years ago

react-titles

React-titles is a collection of title animations made is SVG, React-motion and GSAP.

With React Titles you can bring your web articles to life. When the component mounts to DOM it starts an animation, and the animation reverses back when it unmounts. The texts props passed to Title components are auto-sized to fit the specified box size. A title component automatically removes itself from DOM when it was closed. See a demo

Usage

import React, {Component} from "react";
import Title from "react-titles/Title2";

class ReactTitle extends Component {
    render() {
        return (
            <Title size="400" text1="I LOVE" text2="REACT" open={true} />
        );
    }
};

Closing Title Components:

To see the animation reverses when closing a Title component, you should pass the state to the open prop rather than wrapping the entire component within a condition. The Title component will remove itself when the animation completes.

Wrong:

    <div className="container">
        {   this.state.isOpen &&
            <Title size="400" text1="SOME" text2="TITLE" />
        }
    </div>

Correct:

    <Title size="400" text1="SOME" text2="TITLE" open={this.state.isOpen} />

Instalation

npm install react-titles or yarn add react-titles

Component API

NameTypeDefaultDescription
sizestring400The explosion size
text1stringempty stringThe main title
text2stringempty stringThe subtitle (Note: Title 1 and 7 have only one text)
openbooleantrueShow or hide the componenet
fontFamilystringempty stringThe font-family applied to texts
onCompletefuncfunctionFires when animation completes

License

react-titles is under the MIT license.