
The Cheat Code for High-End UI: Animated Bento Grids for React
Are you looking to modernize your SaaS landing page or dashboard? Animated bento grids for React are the definitive way to present features, metrics, and interactive elements. Drawing inspiration from the traditional Japanese bento box, these layouts break information into neat, visually stunning compartments.
In this guide, we'll show you exactly how to build a responsive, animated bento grid layout using Framer Motion and Tailwind CSS. We'll also explain the code step-by-step so you can implement it in your projects today.
Key Takeaways
- Bento grid layouts are perfect for grouping diverse content in an organized, highly visual manner.
- Combining React, Framer Motion, and Tailwind CSS allows you to build complex grid animations quickly.
- To save time and get production-ready animated bento grids for React instantly, explore premium UI libraries like ogBlocks.
Table of Contents
- Why Choose Bento Grid Layouts?
- Interactive Demo
- Step-by-Step Implementation
- Full Code for the Animated Bento Grid
- The Faster Way: Use ogBlocks
- Frequently Asked Questions (FAQ)
Why Choose Bento Grid Layouts?
If you've browsed modern SaaS landing pages or Apple's product announcements, you've likely seen bento grids in action. These grids are popular because they:
- Maximize Screen Real Estate: Display multiple features without overwhelming the user.
- Improve Scanability: Readers can digest key takeaways at a glance.
- Are Highly Responsive: Using CSS Grid or Flexbox, bento grids adapt beautifully from desktop to mobile.
When you add micro-interactions and enter-animations, these grids transform from static blocks to an immersive experience.
Interactive Demo
Here is a live demonstration of what we're going to build. Hover over the cards to see the smooth interactive effects powered by Framer Motion.
Lightning Fast API
Built for speed and performance. Experience zero lag and instant load times with our edge network.
Bank-Grade Security
Enterprise-grade security built into every layer. End-to-end encryption by default.
Real-time Analytics
Make informed decisions with real-time analytics and deep insights into user behavior.
Infinite Scale
Scale your infrastructure seamlessly. Our global database distribution handles petabytes automatically.
Step-by-Step Implementation
Building animated bento grids for React is simpler than it looks when you break it down.
1. Set Up the Data Structure
First, we define an array of items that hold our content. This keeps our JSX clean and allows for easy updates.
const items = [{title: "Lightning Fast",description: "Built for speed and performance.",icon: <Zap className="w-6 h-6 text-yellow-400" />,className: "md:col-span-2 md:row-span-2",},// ... other items];
2. Create the Grid Container
We use Tailwind CSS classes to establish a responsive grid. On mobile, it's a single column (grid-cols-1). On desktop, we switch to three columns (md:grid-cols-3).
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 auto-rows-[200px]">{/* Map items here */}</div>
3. Add Framer Motion Animations
To bring our bento grid layouts to life, we wrap our cards in motion.div. We apply an initial opacity and y offset, animating them to their final state when they scroll into view (whileInView).
We also add a staggered delay (delay: index * 0.1) so the cards cascade in sequentially.
<motion.divinitial={{ opacity: 0, y: 20 }}whileInView={{ opacity: 1, y: 0 }}transition={{ duration: 0.5, delay: index * 0.1 }}whileHover={{ scale: 0.98 }}>{/* Card Content */}</motion.div>
Full Code for the Animated Bento Grid
Here is the complete source code to implement this in your project. Ensure you have framer-motion and lucide-react installed.
'use client';import React, { useRef, useState } from 'react';import { motion } from 'framer-motion';import { ArrowUpRight, BarChart3, Database, Shield, Zap } from 'lucide-react';const items = [{title: "Lightning Fast API",description: "Built for speed and performance. Experience zero lag and instant load times with our edge network.",icon: <Zap className="w-6 h-6 text-yellow-400" />,className: "md:col-span-2",glowColor: "rgba(250, 204, 21, 0.15)", // yellow},{title: "Bank-Grade Security",description: "Enterprise-grade security built into every layer. End-to-end encryption by default.",icon: <Shield className="w-6 h-6 text-emerald-400" />,className: "md:col-span-1",glowColor: "rgba(52, 211, 153, 0.15)", // emerald},{title: "Real-time Analytics",description: "Make informed decisions with real-time analytics and deep insights into user behavior.",icon: <BarChart3 className="w-6 h-6 text-blue-400" />,className: "md:col-span-1",glowColor: "rgba(96, 165, 250, 0.15)", // blue},{title: "Infinite Scale",description: "Scale your infrastructure seamlessly. Our global database distribution handles petabytes automatically.",icon: <Database className="w-6 h-6 text-purple-400" />,className: "md:col-span-2",glowColor: "rgba(192, 132, 252, 0.15)", // purple}];function BentoCard({ item, index }: { item: any; index: number }) {const divRef = useRef<HTMLDivElement>(null);const [isFocused, setIsFocused] = useState(false);const [position, setPosition] = useState({ x: 0, y: 0 });const [opacity, setOpacity] = useState(0);const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {if (!divRef.current || isFocused) return;const div = divRef.current;const rect = div.getBoundingClientRect();setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top });};const handleFocus = () => {setIsFocused(true);setOpacity(1);};const handleBlur = () => {setIsFocused(false);setOpacity(0);};const handleMouseEnter = () => {setOpacity(1);};const handleMouseLeave = () => {setOpacity(0);};return (<motion.divref={divRef}initial={{ opacity: 0, y: 20 }}whileInView={{ opacity: 1, y: 0 }}viewport={{ once: true, margin: "-50px" }}transition={{ duration: 0.5, delay: index * 0.1, ease: [0.21, 0.47, 0.32, 0.98] }}onMouseMove={handleMouseMove}onFocus={handleFocus}onBlur={handleBlur}onMouseEnter={handleMouseEnter}onMouseLeave={handleMouseLeave}className={`group relative flex flex-col overflow-hidden rounded-3xl border border-white/[0.08] bg-neutral-950 px-8 py-8 md:p-10 ${item.className}`}><divclassName="pointer-events-none absolute -inset-px opacity-0 transition duration-300"style={{opacity,background: `radial-gradient(600px circle at ${position.x}px ${position.y}px, ${item.glowColor}, transparent 40%)`,}}/>{/* Glossy inner reflection */}<div className="absolute inset-0 rounded-3xl ring-1 ring-inset ring-white/10 pointer-events-none" /><div className="relative z-10 flex flex-col justify-between h-full gap-12"><div className="flex justify-between items-center"><div className="flex items-center justify-center w-14 h-14 rounded-2xl shadow-[0_0_15px_rgba(255,255,255,0.02)] backdrop-blur-md group-hover:scale-110 transition-transform duration-500 ease-out">{item.icon}</div><divclassName="flex items-center justify-center w-10 h-10 rounded-full opacity-0 group-hover:opacity-100 transition-all duration-300 cursor-pointer hover:scale-110"><ArrowUpRight className="w-5 h-5 text-neutral-300" /></div></div><div><h3 className="text-2xl font-semibold text-neutral-100 mb-3 tracking-tight">{item.title}</h3><p className="text-neutral-400 leading-relaxed text-base font-medium">{item.description}</p></div></div></motion.div>);}export default function AnimatedBentoGrid() {return (<div className="w-full py-12"><div className="grid grid-cols-1 md:grid-cols-3 gap-6 max-w-5xl mx-auto auto-rows-fr">{items.map((item, index) => (<BentoCard key={index} item={item} index={index} />))}</div></div>);}
Frequently Asked Questions (FAQ)
What are animated bento grids for React?
Animated bento grids for React are modern UI layouts composed of multiple distinct cards or compartments arranged in a responsive grid. These layouts feature dynamic entry and hover animations, typically built with Framer Motion, enabling developers to organize complex features into clean, highly interactive, and visually dense sections that improve engagement.
Why should I use bento grid layouts?
Bento grid layouts organize complex information into easily digestible, visually appealing chunks that maximize screen real estate. They enhance the overall user experience by highlighting key features and creating a premium, modern interface. These layouts significantly improve page scanability, making them ideal for SaaS landing pages and interactive dashboards.
The Faster Way: Use ogBlocks
While building animated bento grids for React from scratch is rewarding, it can be incredibly time-consuming to get the physics, accessibility, and responsiveness perfect.
If you are a founder or developer looking to ship high-converting landing pages quickly without wrestling with CSS grids and Framer Motion spring physics, ogBlocks is your solution.
Skip the hours of tweaking animations. Get lifetime access to ogBlocks today and drop beautifully crafted, production-ready bento grid layouts directly into your codebase. You focus on your product; we'll handle the "wow" factor.
Written by Karan
ogBlocks is an Animated React UI Component library built with Motion and Tailwind CSS