A portfolio project card printed like a receipt, with a torn edge, paper grain, a 3D tilt and a neon hover reveal.

reacttypescriptcss
Indian Healthy Snacking Summit
1.0 & 2.0
Creative direction end-to-end
13,000+ surveyed
User Research
Brand Identity
Website
65-page report
Data Visualization
IHSS · DVJ · 2026
From Zero to Summit
Brand IP · Research · Event · Two editions
→

hover the receipt, then move around

On phones and narrow screens the receipt sits still, a little smaller: no tilt and no hover heading, and there is no cursor, so no light either. With the keyboard, Tab to the receipt to show the heading and arrow. If your device is set to reduce motion, the receipt doesn't tilt and the heading appears without sliding in.

The idea

A portfolio component where each receipt lists what I delivered for a project. To keep you curious, the paper tilts as your mouse moves, and a soft light follows your cursor.

Words you'll see 17
component
A reusable piece of interface, like a component in Figma. ReceiptCard is one.
props
The settings you hand to a component, like data or rotation. Change them and the receipt changes.
.tsx (TypeScript)
The file type here: interface code written in TypeScript, which is JavaScript that also checks what kind of value each setting expects.
div
A plain box that holds other things. Most layouts are boxes inside boxes.
CSS
The language that styles things: colour, size, position, movement.
state (useState)
Something a component remembers, like where the cursor is. When it changes, what you see updates.
useEffect
Code that runs after the component appears, to connect it to something outside it, like listening for scroll. It can clean up after itself, like stopping listening, when the component is removed.
useRef
A way to keep hold of a page element or a value without redrawing anything.
event
A signal the browser sends when something happens, like the mouse moving or the page scrolling.
clip-path
Cuts an element into a shape; anything outside the shape is hidden.
SVG filter (feTurbulence)
A tiny image written in code that makes random noise, used here as paper grain.
transform
Moves, rotates, scales or tilts something without pushing anything else around.
perspective
Adds depth, so a 3D tilt looks real instead of flat.
transition
Makes a change happen smoothly over time instead of all at once.
cubic-bezier
The shape of that smoothness: how a movement speeds up and slows down. Like easing in Figma prototypes.
radial-gradient
A colour that fades out in a circle from a point.
pointer-events
Whether something can be clicked or hovered. "none" lets the mouse pass straight through.

How it works

Point at a step, tap it or Tab to it, to light up its lines in the code.

  1. 01

    Itemized receipt layout

    Every project reads like a printed receipt. Short lists get placeholder rows to help receipts line up.

    1. The receipt is a stack of plain boxes (div) from top to bottom, in a typewriter-style font like a till printer (monospace), with dashed lines between sections.
    2. It counts the deliverables. If there are fewer than the target (5), it adds empty rows to make up the difference, and shows those empty rows as faded "· · ·". That helps receipts line up, though a longer list or text that wraps onto two lines can still make one taller.
    3. Each deliverable gets a tick, like an item rung up at a till.
    4. The barcode is just stripes repeated across a box (repeating-linear-gradient), not an image file.
    ReceiptCard.tsx
    // Short lists get placeholder rows (null), so receipts line up.
    const paddedDeliverables: (string | null)[] = [
      ...data.deliverables,
      ...Array(Math.max(0, rows - data.deliverables.length)).fill(null),
    ]
    
    // …
    
    const divider = <div style={{ borderTop: '1px dashed rgba(26,26,26,0.15)', marginBottom: dividerGap }} />
    
    // …
    
    fontFamily: 'monospace', // like a till printer
    
    // …
    
    {/* DELIVERABLES, empty rows render as faded dots */}
    <div style={{ marginBottom: sectionGap }}>
      {paddedDeliverables.map((d, i) => (
        <div key={i} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 4, opacity: d ? 1 : 0.28 }}>
          <span style={{ color: d ? 'inherit' : muted }}>{d ?? '· · ·'}</span>
          {d && <span aria-hidden="true" style={{ color: accent }}>✓</span>}
        </div>
      ))}
    </div>
    
    // …
    
    // barcode = repeating stripes, no image
    background: 'repeating-linear-gradient(90deg, #1a1a1a 0px, #1a1a1a 2px, transparent 2px, transparent 4px, #1a1a1a 4px, #1a1a1a 5px, transparent 5px, transparent 8px)',

    This is part of the file. Copy the complete file from the Code tab.

  2. 02

    Torn edge + paper grain

    The torn edge is a shape CSS cuts the card into, and the grain is noise made in code, so there are zero image files.

    1. The torn edge works like a cookie cutter (clip-path with a polygon): you list points around the card, and anything outside them is hidden.
    2. The points along the top and bottom go up and down by uneven amounts (0.2% to 1.8%), so the edge looks ripped, not cut by a machine.
    3. The paper texture is random noise made by a tiny image written in code (SVG noise filter, feTurbulence), so there is no image file to load.
    4. The cookie cutter would cut the shadow off too, so the shadow goes on a box around the receipt that isn't cut (drop-shadow).

    You don't need to read the long lines of numbers. To tweak the torn edge, open the Edit tab and change a few numbers in tornEdge: in each pair like 7% 0.2%, the second number moves that point up or down.

    ReceiptCard.tsx
    // Torn-paper top + bottom edge (straight sides). Each pair is x% y%, nudge the y values to re-tear.
    export const tornEdge =
      'polygon(0% 1.2%, 7% 0.2%, 14% 1.6%, 21% 0.4%, 29% 1.8%, 36% 0.6%, 43% … 8%, 0% 98.8%)'
    
    // Subtle gray paper grain: desaturated SVG noise inlined as a data URI, no image file needed.
    export const paperTexture =
      "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' wi … %3C/svg%3E\")"
    
    // …
    
    {/* RECEIPT BODY: shadow wrapper (unclipped) + clipped inner, since clip-path would cut the shadow off */}
    <div style={{ filter: 'drop-shadow(0 1px 3px rgba(0,0,0,0.07)) drop-shadow(0 6px 20px rgba(0,0,0,0.10))' }}>
    <div style={{
      backgroundColor: data.paperColor ?? '#fff6c3',
      backgroundImage: paperTexture,
      clipPath: tornEdge,

    This is part of the file. Copy the complete file from the Code tab.

  3. 03

    Cursor light

    A soft warm glow follows your cursor, like a torch over receipts on a desk.

    1. The page listens for the mouse moving (mousemove event) and remembers where it is (useState).
    2. A see-through layer is laid over the page. By default it covers the whole window (position: fixed); set contained and it stays inside one box instead (position: absolute).
    3. Where the cursor is, it paints a big soft circle of pale yellow at 5% strength that fades to nothing (radial-gradient). On dark colours it glows; on light ones you can barely see it.
    4. Clicks and hovers pass straight through the layer (pointer-events: none), so it never gets in the way.
    CursorLight.tsx
    export default function CursorLight({
      contained = false,
      size = 600,
      color = '255,248,200',
      intensity = 0.05,
    }: CursorLightProps) {
      const ref = useRef<HTMLDivElement>(null)
      const [pos, setPos] = useState({ x: -1000, y: -1000 })
    
      useEffect(() => {
        function move(e: MouseEvent) {
          // measure the overlay so the glow lines up whether it covers the window or one box
          const rect = ref.current?.getBoundingClientRect()
          if (!rect) return
          setPos({ x: e.clientX - rect.left, y: e.clientY - rect.top })
        }
        window.addEventListener('mousemove', move)
        return () => window.removeEventListener('mousemove', move)
      }, [])
    
      return (
        <div
          ref={ref}
          aria-hidden="true"
          style={{
            position: contained ? 'absolute' : 'fixed',
            inset: 0,
            pointerEvents: 'none', // clicks and hovers pass straight through
            zIndex: 1,
            background: `radial-gradient(${size}px circle at ${pos.x}px ${pos.y}px, rgba(${color},${intensity}), transparent 70%)`,
          }}
        />
      )
    }

    This is part of the file. Copy the complete file from the Code tab.

  4. 04

    Paper movement

    The receipt tilts toward your cursor in 3D, lifts a little, and settles back with a springy bounce.

    1. When the mouse arrives, it measures where the receipt is once (getBoundingClientRect), not on every tiny move, which keeps it smooth.
    2. It turns the cursor's spot into a number from -0.5 to +0.5, where 0 is the middle of the receipt, and remembers it (useState). At the right edge, x is 0.5. Multiply that by 8 and the receipt turns 4°.
    3. Those numbers tilt the receipt up to 4°, lift it 6px (translateY(-6px)) and make it 2% bigger (scale(1.02)), all in one transform. A sense of depth (perspective) is what makes the tilt look 3D.
    4. It follows quickly while you move, and springs back when you leave (transition). The bouncy curve (cubic-bezier) has a 1.56 in it, which overshoots before settling.
    5. It swings from its top edge, as if it were pinned there (transform-origin).
    ReceiptCard.tsx
    function handleMouseEnter() {
      setHovered(true)
      setRevealed(true) // latch on, stays after the mouse leaves
      // cache the rect once on enter instead of measuring on every move
      if (ref.current) rectRef.current = ref.current.getBoundingClientRect()
    }
    
    function handleMouseMove(e: React.MouseEvent<HTMLDivElement>) {
      if (reduceMotion) return
      const rect = rectRef.current
      if (!rect) return
      // cursor position as -0.5 … +0.5, where 0 is the centre of the card
      const x = (e.clientX - rect.left) / rect.width - 0.5
      const y = (e.clientY - rect.top) / rect.height - 0.5
      setTilt({ x, y })
    }
    
    function handleMouseLeave() {
      setTilt({ x: 0, y: 0 })
      setHovered(false)
      // revealed is intentionally NOT reset here, only scroll clears it
    }
    
    const lifted = hoverable && hovered && !reduceMotion
    const transform = isMobile
      ? 'scale(0.78)'
      : lifted
        ? `perspective(800px) rotateX(${tilt.y * -8}deg) rotateY(${tilt.x * 8}deg) translateY(-6px) scale(1.02) rotate(${rotation}deg)`
        : `perspective(800px) rotateX(0deg) rotateY(0deg) translateY(0) scale(1) rotate(${rotation}deg)`
    // snappy while tracking the mouse, springy settle when it leaves
    const transition = isMobile
      ? 'none'
      : hovered
        ? 'transform 0.1s ease'
        : 'transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)'
    
    // …
    
    transform,
    transition,
    willChange: hovered && !isMobile ? 'transform' : 'auto',
    transformOrigin: 'top center', // swings from the top, like it's pinned

    This is part of the file. Copy the complete file from the Code tab.

  5. 05

    Hover reveal

    Hover (or Tab to the receipt) and a neon headline slides in from the left, an arrow from the right, and both stay until you scroll. Some code here is the same as in 04: there it moved the paper, here it shows and hides the heading.

    1. You saw these mouse functions in 04, where they tilted the paper. This time, look at one line: when the mouse arrives, a switch called revealed turns on (useState).
    2. Keyboard users get it too: when the receipt is focused with Tab, the same switch turns on, and scrolling won't hide it while it has focus. If the receipt has a link (href), Enter opens it as normal.
    3. When the mouse leaves, the switch stays on, on purpose, so people can move across and read the heading.
    4. Only scrolling the page turns it off (scroll event). The listener is connected when the receipt appears, keeps responding every time the page scrolls, and is disconnected when the receipt is removed (useEffect).
    5. The heading fades in while sliding 12px from the left, and the arrow does the same from the right (opacity and transform, smoothed by a transition).
    ReceiptCard.tsx
    // Annotations disappear on any scroll. (React skips the re-render when already false.)
    useEffect(() => {
      const onScroll = () => {
        // keep it while the receipt has keyboard focus (focusing it can scroll the page into view)
        if (ref.current && ref.current.closest('a, [tabindex]') === document.activeElement) return
        setRevealed(false)
      }
      window.addEventListener('scroll', onScroll, { passive: true })
      return () => window.removeEventListener('scroll', onScroll)
    }, [])
    
    // …
    
    // keyboard users: tabbing to the receipt shows the heading and arrow too
    const handleFocus = () => {
      if (hoverable) setRevealed(true)
    }
    
    // …
    
    function handleMouseEnter() {
      setHovered(true)
      setRevealed(true) // latch on, stays after the mouse leaves
      // cache the rect once on enter instead of measuring on every move
      if (ref.current) rectRef.current = ref.current.getBoundingClientRect()
    }
    
    // …
    
    function handleMouseLeave() {
      setTilt({ x: 0, y: 0 })
      setHovered(false)
      // revealed is intentionally NOT reset here, only scroll clears it
    }
    
    // …
    
    // slide in from 12px to the left while fading in
    opacity: revealed ? 1 : 0,
    transform: revealed ? 'translateX(0)' : `translateX(${reduceMotion ? '0px' : '-12px'})`,
    transition: 'opacity 0.3s ease, transform 0.3s ease',
    
    // …
    
    // mirror of the heading: slides in from 12px to the right
    opacity: revealed ? 1 : 0,
    transform: revealed ? 'translateX(0)' : `translateX(${reduceMotion ? '0px' : '12px'})`,
    transition: 'opacity 0.3s ease, transform 0.3s ease',

    This is part of the file. Copy the complete file from the Code tab.

Use it

Try it here first

Nothing to install. Open the Edit tab, change the code, and watch the preview update as you type.

When you want it in your own project

The buttons above copy the complete files. The code in How it works is only excerpts, so copy from here.

  1. You need Node.js installed. In a terminal, run npx create-next-app@latest my-receipts --yes to make a new Next.js project, then cd my-receipts.
  2. Inside the app folder, make a folder called components. Copy the two complete files with the buttons above and save them as app/components/ReceiptCard.tsx and app/components/CursorLight.tsx.
  3. Open app/page.tsx, delete everything in it, and paste the example below.
  4. Run npm run dev and open localhost:3000. Hover the receipt.
  5. Change these first: the project name, the big number line (impact), and the title and tick colour (accent). To make the receipt open a page when clicked, add href.
app/page.tsx
import ReceiptCard from './components/ReceiptCard'
import CursorLight from './components/CursorLight'

export default function Page() {
  return (
    <main style={{ background: '#1c1c1c', minHeight: '100vh', display: 'grid', placeItems: 'center' }}>
      <CursorLight />
      <ReceiptCard
        rotation={-1}
        colors={{ accent: '#3336A3' }} // the title and tick colour
        data={{
          id: 'ihss',
          name: 'Indian Healthy Snacking Summit', // your project
          role: 'Creative direction\nend-to-end', // \n starts a new line
          impact: '13,000+ surveyed',
          deliverables: ['User Research', 'Brand Identity', 'Website'],
          hoverHeading: 'From Zero to Summit',
        }}
      />
    </main>
  )
}
What you can change 22
<ReceiptCard /> 8
datarequired
The project the receipt shows. Its parts are listed below.
rotationoptional
How tilted the receipt sits at rest, in degrees. Try -2 or 3. Default 0.
captionoptional
The small text under the barcode. Default is the project id in capitals.
showHoverTextoptional
Set to false and hovering shows only the arrow, without the neon heading.
rowsoptional
How many deliverable rows to aim for. Shorter lists get faded placeholder rows to help receipts line up. Default 5.
colorsoptional
Recolour the text: ink (main text), muted (small text), accent (title and ticks) and neon (hover text).
interactiveoptional
Set to false for a still picture: no tilt, no hover, no link.
onClickoptional
Something to do when the receipt is clicked, like playing a sound.
Inside data (the project) 10
idrequired
A short name for the project, like ihss.
namerequired
The project title at the top.
rolerequired
Your role. Put \n where you want it to break onto a new line.
impactrequired
The big number line, like 13,000+ surveyed.
deliverablesrequired
The ticked list, like ['Website', 'Brand Identity'].
editionoptional
A small line under the title, like 1.0 & 2.0.
hrefoptional
Optional link: add it and the receipt opens that page when clicked, with "CASE STUDY →" at the bottom. Leave it out and the receipt doesn't link anywhere.
paperColoroptional
The paper colour. Default #fff6c3.
hoverHeadingoptional
The neon heading that slides in on hover. hoverSubtext adds a smaller line under it.
statusoptional
A small label instead of "CASE STUDY →", like In progress. comingSoon: true shows "COMING SOON".
<CursorLight /> 4
intensityoptional
How strong the glow is, from 0 to 1. Default 0.05: keep it low.
sizeoptional
How big the glow is, in pixels. Default 600.
coloroptional
The glow colour as red, green, blue numbers, like 255,248,200.
containedoptional
Set to true to keep the light inside one box instead of the whole page.
Dependencies 3
Things to learn next 7