logo image
  • Overview

    • View all components
    • Install required things
  • Common UI

    • App Logo
    • Avatar
    • Button
    • Badge
    • Typography

    • Forms

    • Notification
    • Modal
    • Card
    • Breadcrumb
    • Pagination
    • Top Progress Bar
    • Table
    • Item Grid
    • Youtube Video
  • Features UI

    • Live chat button
  • Sections

    • Hero Banner
    • FAQs
  • Layouts

    • common

    • TopBar Layout
    • SideBar Layout
  1. Home
  2. Components
  3. Common Ui
  4. Item Grid

Item Grid

ItemGrid is a reusable and responsive React component built with Tailwind CSS, perfect for displaying any collection of items in a flexible grid layout. It works seamlessly in Next.js or React.js projects and is ideal for showcasing products, blog posts, portfolio items, and more.


Item Grid preview

Item 1

Cards are versatile UI elements.

Item 2

Cards are versatile UI elements.

Item 3

Cards are versatile UI elements.

Item 4

Cards are versatile UI elements.

Please install everything that's required

Before setup and using this component, please install all the required dependencies from this link (if you have never installed).

1. Setup codes

Create a new Card component components/ui/Card.tsx, then paste the code below

jsx
import React, { ReactNode } from "react"; interface ItemGridProps { children: ReactNode; } const ItemGrid = ({ children }: ItemGridProps) => { return ( <div className="grid grid-cols-1 gap-6 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"> {children} </div> ); }; export default ItemGrid;

This component will show 1 column in mobile, 2 columns for IPad, 3 columns fro laptop/pc, 4 columns for large screen.

2. Usages

Now you can use the Item Grid component to show items like Article Card, Product Card, or Gallery images, ...

jsx
import React from "react"; import Card from "@/components/Card"; import ItemGrid from "@/components/ItemGrid"; const DocItemGrid = () => { return ( <div className="bg-gray-100"> <ItemGrid> <Card title="Item 1" description="Cards are versatile UI elements." /> <Card title="Item 2" description="Cards are versatile UI elements." /> <Card title="Item 3" description="Cards are versatile UI elements." /> <Card title="Item 4" description="Cards are versatile UI elements." /> </ItemGrid> </div> ); }; export default DocItemGrid;

The UI like that (you can see more the my Card component)

Item 1

Cards are versatile UI elements.

Item 2

Cards are versatile UI elements.

Item 3

Cards are versatile UI elements.

Item 4

Cards are versatile UI elements.

Previous
Table
Next
Youtube Video

On this page

  1. 1. Setup codes

  2. 2. Usages