Material Components React Floating Action Button (FAB)


1,9231710.15.02 years ago3 years agoMinified + gzip package size for @material/react-fab in KB


React Floating Action Button

A React version of an MDC Floating Action Button.


npm install @material/react-fab



with Sass:

import '@material/react-fab/index.scss';

with CSS:

import '@material/react-fab/dist/fab.css';

JSX Structure

The Fab can be used with the span, i, img or svg elements. It can also be used with the Material Icon react component.

<Fab icon={<span className="material-icons">favorite</span>}/>

<Fab icon={<i className="material-icons">favorite</i>}/>

<Fab icon={
  <svg xmlns="http://www.w3.org/2000/svg" className="material-icons" viewBox="0 0 24 24">

<Fab icon={<img className="material-icons" src="/images/ic_button_24px.svg"/>}/>

<Fab icon={<MaterialIcon icon="favorite"/>}/>


Prop Name Type Description
className String Classes to be applied to the root element.
exited Boolean When true animates the FAB out of view. When this false, the FAB will return to view.
mini Boolean Enables the mini variant.
icon Element The icon.
textLabel String The label, which makes the FAB extended.

Sass Mixins

Sass mixins may be available to customize various aspects of the components. Please refer to the MDC Web repository for more information on what mixins are available, and how to use them.

Advanced Sass Mixins

Usage with Icons

Please see our Best Practices doc when importing or using icon fonts.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.