npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-floating-action-button

v1.0.5

Published

A simple Android like FAB Component for React

Downloads

2,720

Readme

React-Floating-Action-Button

A dead simple React component that works similar to Android's Action Button

FAB Demo GIF


Getting Started

  1. First, You need to install It, just like You would do with most any NPM packages:
npm i --save react-floating-action-button
  1. Then, You need to import the library component within your own component
import React from 'react'
import { Container, Button, Link } from 'react-floating-action-button'
  1. You can now start using the FAB components!
export default const YourAwesomeComponent = () => {
    return (
        <Container>
            <Link href="#"
                tooltip="Create note link"
                icon="far fa-sticky-note" />
            <Link href="#"
                tooltip="Add user link"
                icon="fas fa-user-plus" />
                className="fab-item btn btn-link btn-lg text-white"
            <Button
                tooltip="The big plus button!"
                icon="fas fa-plus"
                rotate={true}
                onClick={() => alert('FAB Rocks!')} />
        </Container>
    )
}

About Components

  • Container - It's simply a nav element that contains fab-container in its class list. You must involve your fab-items inside a Container, so the default styles are applied properly. Note that the last child will be recognized as the bigger button that is always visible and triggers the menu opening on hover.
  • Button - A special button element that has the class fab-item and an "i" element as its first child. You can add a function the its click by passing an "onClick" just like you would with a regular button.
  • Link - Works just like the Button component, but instead of a "onClick", You need to pass a "href" prop to It.

NOTE: All components support props.children rendering, which in combination with custom styles, can give You a lot of customization options.

Extra Styling

  • Container - You can add custom classes using the "className" property, and also add custom styles by passing a "styles" property with an object just like you would do with the regular style.
  • Button and Link - Supports all mentioned for the Container, plus gives You the option to add custom icon classes by passing an "icon" string property, and also custom icon styles by passing an object property "iconStyles"

Material Colors

React-floating-action-button also exports two objects: lightColors and darkColors. These objects contain a few preset material colors that You can use when passing custom styles to the components, and help You to keep the overall design concise.

Usage

...
import { Container, Button, lightColors, darkColors } from 'react-floating-action-button'
...
<Container>
    <Button
     tooltip="The big plus button!"
     styles={{backgroundColor: darkColors.lighterRed, color: lightColors.white}}
     />
</Container>

Light Colors

| Color name | Hex value | | ------------- |:-------------:| | red | #ffcdd2 | | pink | #f8bbd0 | | purple | #e1bee7 | | lightBlue | #81d4fa | | cyan | #80deea | | teal | #80cbc4 | | blue | #bbdefb | | green | #dcedc8 | | yellow | #fff9c4 | | orange | #ffe0b2 | | brown | #d7ccc8 | | grey |#e0e0e0 | | darkerGrey | #bdbdbd | | black | #212121 | | white | #f5f5f5 |

Dark Colors

| Color name | Hex value | | ------------- |:-------------:| | lighterRed | #f44336 | | red | #c62828 | | pink | #ad1457 | | purple | #6a1b9a | | lightBlue | #01579b | | cyan | #00838f | | teal | #00695c | | blue | #0d47a1 | | green | #1b5e20 | | yellow | #f9a825 | | orange | #e65100 | | brown | #4e342e | | grey |#424242 | | black | #212121 | | white | #fafafa |