Skip to content

Back to top + Tooltip #159

Jan 20, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi, you have to use wrapperProps prop and within it add onClick prop.

Here is my code:

import React, { useState, useEffect } from "react";
import { TERipple, TETooltip } from "tw-elements-react";

export default function BasicExample(): JSX.Element {
  const [showButton, setShowButton] = useState(false);

  const handleScroll = () => {
    if (
      document.body.scrollTop > 20 ||
      document.documentElement.scrollTop > 20
    ) {
      setShowButton(true);
    } else {
      setShowButton(false);
    }
  };

  const backToTop = () => {
    document.documentElement.style.scrollBehavior = "smooth";
    document.body.scrollTop = 0;
    document.documentElement.scrollTop = 0;
  };

  use…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Guido3000
Comment options

Answer selected by Guido3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants