Skip to content

Card framed on hover in React

An offer card around which four frame corners slide into place on hover or keyboard focus.

Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in React

FramedCard.tsx
export function FramedCard() {
  return (
    <article
      className="group/efcc relative grid max-w-[24rem] gap-3 rounded-2xl border border-[#e7e5e4] bg-white p-[clamp(1.5rem,5vw,2.25rem)] text-[#1c1917] transition-shadow duration-350 ease-out focus-within:shadow-[0_1.25rem_2.5rem_-1.25rem_rgb(28_25_23/0.18)] hover:shadow-[0_1.25rem_2.5rem_-1.25rem_rgb(28_25_23/0.18)] motion-reduce:transition-none dark:border-[#44403c] dark:bg-[#1c1917] dark:text-[#fafaf9] dark:focus-within:shadow-[0_1.25rem_2.5rem_-1.25rem_rgb(0_0_0/0.5)] dark:hover:shadow-[0_1.25rem_2.5rem_-1.25rem_rgb(0_0_0/0.5)]"
      aria-labelledby="efcc-titre"
    >
      <span
        className="pointer-events-none absolute size-7 border-[#b45309] opacity-0 transition-[translate,opacity] duration-[450ms,300ms] ease-[cubic-bezier(0.2,0.8,0.2,1)] group-focus-within/efcc:translate-x-0 group-focus-within/efcc:translate-y-0 group-focus-within/efcc:opacity-100 group-hover/efcc:translate-x-0 group-hover/efcc:translate-y-0 group-hover/efcc:opacity-100 motion-reduce:translate-x-0 motion-reduce:translate-y-0 motion-reduce:opacity-100 motion-reduce:transition-none dark:border-[#fbbf24] -top-2.5 -left-2.5 rounded-tl-[0.6rem] border-t-3 border-l-3 translate-x-[0.9rem] translate-y-[0.9rem]"
        aria-hidden="true"
      ></span>
      <span
        className="pointer-events-none absolute size-7 border-[#b45309] opacity-0 transition-[translate,opacity] duration-[450ms,300ms] ease-[cubic-bezier(0.2,0.8,0.2,1)] group-focus-within/efcc:translate-x-0 group-focus-within/efcc:translate-y-0 group-focus-within/efcc:opacity-100 group-hover/efcc:translate-x-0 group-hover/efcc:translate-y-0 group-hover/efcc:opacity-100 motion-reduce:translate-x-0 motion-reduce:translate-y-0 motion-reduce:opacity-100 motion-reduce:transition-none dark:border-[#fbbf24] -top-2.5 -right-2.5 rounded-tr-[0.6rem] border-t-3 border-r-3 -translate-x-[0.9rem] translate-y-[0.9rem]"

Free component: copy it freely, including for commercial projects.

Visual effects components in React
  • Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A paragraph whose words turn from grey to full ink, one by one, as the page scrolls, in pure CSS with a plain-text fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four offset, translucent sine waves gently roll along the bottom of a section, each at its own pace.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component