Skip to content

Pinterest-Style Pin Board

Bootstrap 5 masonry pin board with photo pins, topic filter chips, save buttons and a live saved counter.

Live preview

Open in new tab

Code

A Pinterest-style pin board built with Bootstrap 5: photo pins of different heights flow into a masonry layout, each with a Save button, a topic badge, an author line and a like count. Use it for inspiration feeds, recipe or travel boards, mood boards and community galleries.

How it works

The root section.pb-board-wrap holds a header with the title, a group of filter chips (.pb-chip with data-pb-filter) and a .pb-counter that shows how many pins are saved. The pins live in .pb-grid, which uses CSS multi-column layout instead of a JavaScript masonry library: 2 columns on phones, 3 from 768px, 4 from 992px and 5 from 1200px. Every article.pb-pin sets break-inside: avoid, so a pin never splits between columns, and the natural image heights create the staggered look.

Inside a pin, .pb-media wraps the photo, a .pb-board badge and the .pb-save button. On devices with a mouse the Save button fades in on hover or keyboard focus (the first pin keeps it visible), a soft gradient appears and the photo zooms slightly. Saved pins keep a dark "Saved" button. Below the photo, .pb-meta shows the .pb-title, an initials .pb-avatar, the author and .pb-likes.

The script initializes every .pb-board-wrap on DOMContentLoaded with one delegated click listener. Clicking .pb-save toggles .is-saved, aria-pressed and the button text, then recounts saved pins into [data-pb-count]. Clicking a chip hides pins whose data-pb-cat does not match and marks the active chip.

Customization

  • --pb-accent and --pb-accent-dark on .pb-board-wrap: change the red of the Save button, kicker and like icons.
  • --pb-radius: round the photo corners more or less; --pb-gap changes the space between columns and pins.
  • columns in the .pb-grid media queries: show more or fewer columns at each breakpoint.
  • data-pb-cat on each .pb-pin and data-pb-filter on the chips: add new topics, such as style or diy, by using the same value on both.
  • Add .is-saved and aria-pressed="true" to a .pb-save button to render a pin as already saved.
  • Change the h value in the image URLs (and the height attribute) to make a pin taller or shorter.

Accessibility

Filter chips are in a labelled role="group" and expose aria-pressed; every Save button has aria-pressed and an aria-label that includes the pin title. Changes are announced through a visually hidden aria-live="polite" region. Photos have descriptive alt text plus width and height to prevent layout shift. On touch screens the Save buttons are always visible, focus rings use :focus-visible, and zoom and fade effects are disabled under prefers-reduced-motion.

Usage notes

The photos come from Unsplash and should be replaced with your own images. CSS columns fill top to bottom, so the reading order runs down each column; if strict left-to-right order matters, sort your data accordingly. Connect the Save handler to your API to persist saved pins.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Pinterest-Style Pin Board – Bootstrap 5 social feeds component screenshot
Pinterest-Style Pin Board · Bootstrap 5 Social Feeds

More Social Feeds

Reels-Style Vertical Feed – Tailwind CSS social feeds preview

Reels-Style Vertical Feed

Tailwind CSS reels-style vertical feed with snap-scrolling full-height photos, like, comment, share and save buttons, double-click to like and keyboard navigation.

Social Media Post Card – Bootstrap 5 social feeds preview

Social Media Post Card

Dark Bootstrap 5 social post card with photo, double-tap like, save, native share with copy-link fallback and an inline comment thread.