1.0.0 • Published 6 years ago

react-threede-buttons v1.0.0

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

< ThreeButtons />

MIT airbnb

<ThreeButtons /> is a customisable React component that renders animated 3D buttons

alt

Installation

$ npm install React-Three-Buttons

Components

import { ThreeButton, LoaderButton, SocialButton } from 'react-threebuttons';

Styles

sass

@import '/node_modules/react-threebuttons/dist/styles.css'

js

import 'react-threebuttons/dist/styles.css'

Usage

<ThreeButton text="press" type="press" size="large" styles={My_style_object} />
<SocialButton type="instagram" size="large" styles={My_style_object} />
<LoaderButton text="progress" size="large" styles={My_style_object} />

Or with a pre made theme

import { ThreeButton, LoaderButton, SocialButton, Theme } from 'threebuttons';
<Theme theme="blue-light">
  <ThreeButton text="press" type="press" size="large" />
  <ThreeButton text="visible text" type="slide" slideText="hidden text" size="large" />
  <ThreeButton text="hover me" type="hover" size="large" />
  <ThreeButton text="click me" type="click" size="large" />
  <LoaderButton text="progress" size="large" />
  <LoaderButton text="async progress"type="async" async={{uri: 'https://yrgo.github.io/api/movies/mean-girls.json', callback, errorCallback, parseJson: true}}  size="large"/>
</Theme>

Props

ThreeButton

AttributesTypeDefaultDescriptionOptions
TextstringbuttonThe text to be displayed on the buttonnull
slideTextStringnulltext behind the slide type buttonnull
TypestringPressThe animation of the buttonpress, slide, 3d, click
SizeStringMediumThe size of the buttonsmall, medium, large
StylesObjectsee belowthe custom styles of the buttonbackgroundColor, padding, fontSize, border
IconStringnullA icon from fontAwesomefontAwesome
handleClickfunctionnullcallback to fire when clickednull
disabledbooleanfalsedisable all click events and greyscales the buttontrue, false
ripplebooleantrueripple effect when clickedtrue, false

Default styles

{
    backgroundColor: 'rgb(31, 65, 167)',
    padding: 16,
    fontSize: '',
    border: 'defaults to backgroundColor',
}

SocialButton

AttributesTypeDefaultDescriptionOptions
TextstringfacebookThe text to be displayed on the buttonnull
TypestringfacebookThe type of social mediafacebook, facebook-dark, instagram, linkedin, twitter, github, reddit, mail, google-plus, pinterest, youtube
SizeStringMediumThe size of the buttonsmall, medium, large
ClickStringpressThe animation of the buttonpress, 3d
LinkString''anchor link of the buttonnull
StylesObjectsee belowthe custom styles of the buttonpadding, fontSize,

Default styles

{
   padding: 16,
   fontSize: '',
}

LoaderButton

AttributesTypeDefaultDescriptionOptions
TextstringButtonThe text to be displayed on the buttonnull
Typestringsynctype of loadersync, async
SizeStringMediumThe size of the buttonsmall, medium, large
StylesObjectsee belowthe custom styles of the buttonbackgroundColor, padding, fontSize, border
loadingLabelStringhang ontext while loadingnull
loadedLabelStringsuccesstext when loadednull
DurationString'1000ms'The loading timenull
StylesObjectsee belowthe custom styles of the buttonpadding, fontSize, backgroundColor, border
callbackfunction() => {}callback to fire when completed loadnull
asyncobjectundefinedconfig for the async callse below
disabledbooleanfalsedisable all click events and greyscales the buttontrue, false

async example

const myAsyncConfig = {
    uri: 'https://mysite/api/data.json',
    callback: (jsonData) => (console.log(jsonData)),
    errorCallback: (err) => {console.log(err)},
    parseJson: true,
}
<LoaderButton type="async" text="my async loader" async={myAsyncConfig}

Default styles

{
    backgroundColor: 'rgb(31, 65, 167)',
    padding: 16,
    fontSize: '',
    border: 'defaults to backgroundColor',
}

Author

Andreas Nordh

You get a button! You get a button! Everybody gets a button

</ ThreeButtons>