react-icons/ai APIs
- AiFillLinkedin
- AiOutlineMail
- AiFillGithub
- AiFillInstagram
- AiOutlineRight
- AiOutlineLeft
- AiOutlineInfoCircle
- AiFillPhone
- AiOutlineClose
- AiOutlineFullscreenExit
- AiFillSafetyCertificate
- AiOutlineSearch
- AiOutlineCheck
- AiOutlineSend
- AiOutlineCheckCircle
- AiOutlineLike
- AiFillTwitterCircle
- AiFillPlusCircle
- AiOutlinePlus
- AiFillCloseCircle
- AiOutlineFullscreen
- AiFillHome
- AiFillStar
- AiFillEye
- AiOutlineShareAlt
- AiOutlineDoubleLeft
- AiOutlineHeart
- AiFillHeart
- AiOutlineReload
- AiFillFire
- AiFillCaretDown
- AiFillCaretRight
- AiOutlineDash
- AiOutlineSmallDash
- AiOutlineLine
- AiOutlineArrowUp
- AiOutlineLinkedin
- AiOutlineGithub
- AiFillClockCircle
- AiOutlineDoubleRight
- AiOutlineSortAscending
- AiOutlineSortDescending
- AiFillQuestionCircle
- AiOutlineArrowLeft
- AiOutlineArrowRight
- AiFillFacebook
- AiOutlineTwitter
- AiOutlineWhatsApp
- AiFillCopy
- AiOutlineExclamationCircle
- AiFillMinusCircle
- AiOutlineLogout
- AiOutlineHistory
- AiTwotoneFlag
- AiOutlineUsergroupAdd
- AiFillMedicineBox
- AiOutlineStar
- AiFillCode
- AiOutlineLock
- AiOutlineDelete
- AiOutlineEdit
- AiFillSetting
- AiFillCalendar
- AiOutlineLoading
- AiOutlineRedo
- AiOutlineLogin
- AiOutlineAppstore
- AiOutlineSmile
- AiOutlineTeam
- AiOutlineSafetyCertificate
- AiOutlineLink
- AiOutlineUser
- AiOutlineFolder
- AiOutlineCalendar
- AiOutlineHome
- AiOutlinePicture
- AiFillFlag
- AiTwotoneHeart
- AiOutlineMenu
- AiFillBug
- AiFillPlayCircle
- AiFillYoutube
- AiOutlinePieChart
- AiOutlineClear
- AiOutlineWarning
OtherRelated APIs
react-icons/ai#AiOutlineArrowUp JavaScript Examples
The following examples show how to use
react-icons/ai#AiOutlineArrowUp.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScrollToTopButton.jsx From doc2pen with Creative Commons Zero v1.0 Universal | 5 votes |
ScrollToTop = () => {
let toTopButtonObj = useRef(null);
const [buttonState, changeButtonState] = useState({
visible: false,
lastHeight: 0,
});
useEffect(() => {
scrollFunction();
});
window.onscroll = () => {
scrollFunction();
};
function scrollFunction() {
if (
document.body.scrollTop > 50 ||
document.documentElement.scrollTop > 50
) {
if (!buttonState.visible) {
changeButtonState({
visible: true,
lastHeight: document.body.scrollTop,
});
}
} else {
if (buttonState.visible) {
changeButtonState({
visible: false,
lastHeight: document.body.scrollTop,
});
}
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
const button = buttonState.visible ? (
<Button
ref={toTopButtonObj}
className={styles.toTopButton}
variant="light"
onClick={() => topFunction()}
aria-label="Scroll to Top"
>
<AiOutlineArrowUp />
</Button>
) : null;
return button;
}