search results:

    • Standard
    • React
    Pricing Learn Community
    • + D
    • Light
    • Dark
    • System
    logo TW Elements
    • Getting started
      • Quick start
      • Dark mode
      • Theming
      • Changelog
    • CommercialNew
      • Pricing
      • License
      • Installation
      • Git & repository
      • Premium Support
    • Integrations
      • Next
    • Content & styles
      • Animations
      • Animations extended
      • Colors
      • Dividers
      • Figures
      • Headings
      • Hover effects
      • Icons
      • Images
      • Mask
      • Shadows
      • Typography
    • Navigation
      • Breadcrumbs
      • Footer
      • Pagination
      • Pills
      • Tabs
    • Components
      • Accordion
      • Alerts
      • Avatar
      • Badges
      • Button group
      • Buttons
      • Cards
      • Carousel
      • Collapse
      • Dropdown
      • Link
      • List group
      • Modal
      • Paragraphs
      • Placeholders
      • Popover
      • Progress
      • Rating
      • Scroll back to top button
      • Social buttons
      • Spinners
      • Timeline
      • Toasts
      • Tooltip
      • Video carousel
    • Forms
      • Checkbox
      • File input
      • Form templates
      • Inputs
      • Login form
      • Radio
      • Range
      • Registration form
      • Search
      • Select
      • Switch
      • Textarea
    • Data
      • Charts
      • Tables
    • Methods
      • Ripple
    • ResourcesNew
      • Playground
      • YouTube Channel
      • Private FB Group
      • Newsletter
      • UI Design course New

    Hover effects

    Tailwind CSS React Hover Effects

    Responsive hover effects built with Tailwind CSS. Hover effect appears when the user positions the computer cursor over an element without activating it.


    Basic example

    Hover effect appears when a user positions computer cursor over an element without activating it.

    Loading...
    • JSX
            
                
          import React from 'react';
          import { TERipple } from 'tw-elements-react';
          
          export default function HoverEffectBasicExample(): JSX.Element {
            return (
              <div>
                <TERipple>
                  <div
                    className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                    <img
                      src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                      className="max-w-xs"
                      alt="Louvre" />
                    <a>
                      <div
                        className="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-[hsl(0,0%,98.4%,0.2)] bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-100"></div>
                    </a>
                  </div>
                </TERipple>
              </div>
            );
          }
          
          
            
        

    Showing the animation effect

    As you can see in the above example, you can add any animation to any element on the page by using the following classes:

    • transition: used to animate the chaged properties on hover,
    • duration-x: used to define the duration of the animation where x is the time in milliseconds; e.g. duration-300.

    Then, you should be able to add any type of animation by changing the property on hover by using the class: [hover:tw-class-name] e.g. hover:opacity-100.

    Hey there 👋 we're excited about TW Elements for React and want to see it grow! If you enjoy it, help the project grow by sharing it with your peers. Every share counts, thank you!

    Color

    Change the color and opacity by manipulating color and .hover:opacity-* classes. Have a look at our masks docs to learn more.

    Louvre
    Louvre
    Louvre
    Louvre
    Louvre
    Louvre
    • JSX
            
                
          import React from 'react';
      
          export default function App() {
            return (
              <div>
                <div className="grid grid-cols-3 gap-4">
                  <div className="mb-4">
                    <div className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                      <img
                        src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                        className="max-w-xs"
                        alt="Louvre" />
                      <div
                        className="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-indigo-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-50"></div>
                    </div>
                  </div>
                  <div className="mb-4">
                    <div className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                      <img
                        src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                        className="max-w-xs"
                        alt="Louvre" />
                      <div
                        className="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-purple-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-20"></div>
                    </div>
                  </div>
                  <div className="mb-4">
                    <div className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                      <img
                        src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                        className="max-w-xs"
                        alt="Louvre" />
                      <div
                        className="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-green-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-70"></div>
                    </div>
                  </div>
                </div>
                <div className="grid grid-cols-3 gap-4">
                  <div className="mb-4 md:mb-0">
                    <div className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                      <img
                        src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                        className="max-w-xs"
                        alt="Louvre" />
                      <div
                        className="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-red-700 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-30"></div>
                    </div>
                  </div>
                  <div className="mb-4 md:mb-0">
                    <div className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                      <img
                        src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                        className="max-w-xs"
                        alt="Louvre" />
                      <div
                        className="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-white bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-40"></div>
                    </div>
                  </div>
                  <div className="mb-4 md:mb-0">
                    <div className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                      <img
                        src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                        className="max-w-xs"
                        alt="Louvre" />
                      <div
                        className="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-blue-400 bg-fixed opacity-0 transition duration-300 ease-in-out hover:opacity-60"></div>
                    </div>
                  </div>
                </div>
              </div>
            );
          }
    
          
            
        

    Gradient

    Set a fancy gradient as an overlay.

    Louvre
    • JSX
            
                
          import React from 'react';
      
          export default function App() {
            return (
              <div className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                <img
                  src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                  className="max-w-xs"
                  alt="Louvre" />
                <div
                  className="absolute bottom-0 left-0 right-0 top-0 h-full w-full overflow-hidden bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 opacity-0 transition duration-300 ease-in-out hover:opacity-70"></div>
              </div>
            );
          }
          
            
        

    Zoom

    Use .hover:scale-110 class to any element to apply zoom.

    Louvre
    • JSX
            
                
          import React from 'react';
      
          export default function App() {
            return (
              <div className="relative max-w-xs overflow-hidden bg-cover bg-no-repeat">
                <img
                  src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
                  className="max-w-xs transition duration-300 ease-in-out hover:scale-110"
                  alt="Louvre" />
              </div>
            );
          }
          
            
        

    Shadow

    Use .hover:shadow-lg class to any element to apply the effect.

    Louvre
    • JSX
            
                
          import React from 'react';
      
          export default function App() {
            return (
              <img
              src="https://tecdn.b-cdn.net/img/new/fluid/city/113.webp"
              className="max-w-xs transition duration-300 ease-in-out hover:shadow-lg dark:hover:shadow-black/30"
              alt="Louvre" />
            );
          }
          
            
        

    Related resources

    Dropdown on hover Expanding Search Bar How to make Bootstrap image responsive How to center image Images Gallery

    If you are looking for more advanced options, try Bootstrap Hover effects from MDBootstrap.

    • Basic example
    • Color
    • Gradient
    • Zoom
    • Shadow
    • Related resources
    Get useful tips & free resources directly to your inbox along with exclusive subscriber-only content.
    Join our mailing list now
    © 2023 Copyright: MDBootstrap.com