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.

Also known as: pinterest style grid, masonry pin board, photo board with save button, inspiration board layout

Pinterest-Style Pin Board live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

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.

Use cases

  • Inspiration feeds: photo pins of different heights flow into a masonry layout with save buttons
  • Recipe and travel boards: topic filter chips narrow the board while a counter tracks saved pins
  • Mood boards: visitors collect favorite images and see how many pins they have saved
  • Community galleries: each pin shows a topic badge, author line and like count

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.

Pinterest-Style Pin Board at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons
Layout
Responsive, works on mobile
Category
Social Feeds
License
Free for personal and commercial use

Questions about this template

Can I use the Pinterest-Style Pin Board code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

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 – free Bootstrap 5 social feed template
Pinterest-Style Pin Board · free Bootstrap 5 social feed template

More Social Feeds

Reels-Style Vertical Feed – free Tailwind CSS social feed template

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.

Tweet-Style Post Card with Image – free Pure CSS social feed template

Tweet-Style Post Card with Image

Microblog post card with avatar, verified badge, attached photo and working like, repost, bookmark and share buttons. Pure CSS with a little vanilla JS.

Social Media Post Card – free Bootstrap 5 social feed template

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.