1.0.0 • Published 3 years ago

material-ui-back-to-top v1.0.0

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

material-ui-back-to-top

An easy-to-use Material-UI/React component for returning the user to the top of the page

Install

npm i material-ui-back-to-top

NOTE: This component requires Material-UI to work

Usage

import React from "react"
import { BackToTop } from "material-ui-back-to-top"

export const Layout = ({ children }) =>{
  return (
    <div>
      <BackToTop />
      { children }
    </div>
  )
}

API

PropertyDescriptionTypeOptionsDefault
buttonPositionSpecify the location of the buttonobjectN/A{ bottom: 15, right: 15 }
sizeSpecify the size of the buttonstring"large", "medium", "small""large"
colorSpecify the color of the buttonstring"default", "inherit", "primary", "secondary""default"
iconUse a custom icon for the button (NOTE: Must be a React component)nodeN/AChevronUp
showTextShow text next to the iconbooleanN/Afalse
textSpecify the text to show (only works if showText is true)stringN/A"Back to top"
fadeDurationSpecify the fade in/out duration of the buttonnumber \| { appear?: number, enter?: number, exit?: number }N/A{ enter: 225, exit: 195 }
disableSmoothScrollDisable smooth scrollingbooleanN/Atrue
scrollPositionThresholdSpecify the scrollY position threshold for displaying the buttonnumberN/A200
buttonShowDurationSpecify how long the button should remain on the screen when user stops scrollingnumberN/A3000
scrollTopOffsetSpecify an offset position for the scroll to topnumberN/A0
FadePropsPass props to the Fade componentobjectView Material-UI docs{}
FabPropsPass props to the Fab componentobjectView Material-UI docs{}