Introducing Aceternity UI Pro - Premium component packs and templates to build awesome websites.
Logo

Expandable Cards

Click cards to expand them and show additional information

    Summertime Sadness

    Summertime Sadness

    Lana Del Rey

    Mitran Di Chhatri

    Mitran Di Chhatri

    Babbu Maan

    For Whom The Bell Tolls

    For Whom The Bell Tolls

    Metallica

    Stairway To Heaven

    Stairway To Heaven

    Led Zeppelin

    Toh Phir Aao

    Toh Phir Aao

    Mustafa Zahid

Installation

Install dependencies

npm i framer-motion clsx tailwind-merge

Add util file

lib/utils.ts
import { ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

Add useOutsideClick hook

hooks/use-outside-click.ts
import React, { useEffect } from "react";
 
export const useOutsideClick = (
  ref: React.RefObject<HTMLDivElement>,
  callback: Function
) => {
  useEffect(() => {
    const listener = (event: any) => {
      if (!ref.current || ref.current.contains(event.target)) {
        return;
      }
      callback(event);
    };
 
    document.addEventListener("mousedown", listener);
    document.addEventListener("touchstart", listener);
 
    return () => {
      document.removeEventListener("mousedown", listener);
      document.removeEventListener("touchstart", listener);
    };
  }, [ref, callback]);
};

Examples

Standard

    Summertime Sadness

    Summertime Sadness

    Lana Del Rey

    Mitran Di Chhatri

    Mitran Di Chhatri

    Babbu Maan

    For Whom The Bell Tolls

    For Whom The Bell Tolls

    Metallica

    Stairway To Heaven

    Stairway To Heaven

    Led Zeppelin

    Toh Phir Aao

    Toh Phir Aao

    Mustafa Zahid

Grid

    Summertime Sadness

    Summertime Sadness

    Lana Del Rey

    Mitran Di Chhatri

    Mitran Di Chhatri

    Babbu Maan

    For Whom The Bell Tolls

    For Whom The Bell Tolls

    Metallica

    Aap Ka Suroor

    Aap Ka Suroor

    Lord Himesh

Get beautiful, hand-crafted templates and components with Aceternity UI Pro

Professional, beautiful and elegant templates for your business. Get the best component packs and templates with Aceternity UI Pro.

Check website

Excellent communication and professionalism from the start and throughout. Happily and calmly accepted and entertained a few additional out-of-scope requests as well. Good open-...

Henrik Söderlund

Former CTO at Creme Digital

A product by Aceternity
Building in public at @mannupaaji