Skip to content

Sticky Social Share Sidebar

Tailwind CSS article layout with a sticky vertical social share bar that turns into a fixed bottom bar on mobile, with copy link.

Also known as: floating share buttons, social share sidebar, sticky share bar, vertical share buttons, blog share buttons

Sticky Social Share Sidebar live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

A blog article layout with a sticky social share sidebar, built with Tailwind CSS and Bootstrap Icons. On large screens a vertical column of round share buttons stays beside the article while the reader scrolls; on phones and tablets the same buttons become a fixed bar at the bottom of the screen. It fits blogs, news sites, documentation and long-form landing pages.

How it works

The root div.ss-share-layout holds a two-column grid (lg:grid-cols-[64px_minmax(0,1fr)]): the aside.ss-bar and the article. Below the lg breakpoint the aside uses fixed inset-x-0 bottom-0 with a translucent, blurred white background, so it floats over the content; the root adds pb-28 so the last paragraph is never hidden. From lg up, lg:sticky lg:top-8 lg:self-start turns it into a sticky column that follows the reader, with a rotated "Share" label using writing-mode: vertical-rl.

Each .ss-btn is a round link with an icon, a screen-reader label and a .ss-tip tooltip that style.css shows to the right of the button on hover or keyboard focus (large screens only). Hovering fills a button with its network color, for example hover:bg-[#1877f2] for Facebook.

On DOMContentLoaded the script finds every .ss-share-layout, reads data-share-url and data-share-title (falling back to the current page address and document.title), and rewrites the href of each [data-ss-network] link from the NETWORKS templates. The [data-ss-copy] button copies the URL with the Clipboard API, falls back to a hidden textarea, then shows a green .ss-btn--copied state with a check icon for two seconds. Where the Web Share API exists, the hidden [data-ss-native-item] appears and opens the system share sheet. Without JavaScript the links still work with their static fallback URLs.

Customization

  • data-share-url and data-share-title on .ss-share-layout: set the canonical address and title to share; remove data-share-url to use the current page URL.
  • NETWORKS in script.js: add a network (for example Reddit or Telegram) by adding a template and a link with the matching data-ss-network value.
  • lg:top-8 on aside.ss-bar: increase it if your site has a sticky header so the bar stops below it.
  • lg:grid-cols-[64px_minmax(0,1fr)] and max-w-4xl: change the sidebar column width or the overall reading width.
  • h-11 w-11 rounded-full on .ss-btn: use rounded-xl for square buttons or h-12 w-12 for larger targets.
  • background: #18181b on .ss-tip in style.css: restyle the tooltip color.

Use cases

  • Blogs and news sites: a vertical share bar stays beside the article while the reader scrolls
  • Mobile article pages: the same buttons become a fixed bar at the bottom of the screen
  • Documentation and long-form pages: a copy link button gives readers a quick way to share
  • Phones with native sharing: the system share sheet opens where the Web Share API exists
  • Content marketing: network-colored hover states and tooltips make each button clear

Accessibility

The bar is an aside with aria-label="Share this article" and a list of links. Each icon is aria-hidden; a sr-only label names the action and notes when a new tab opens, while the visual tooltip is hidden from assistive technology to avoid duplicate announcements. Copy results are announced through a role="status" region. Buttons are at least 44 px, show a blue focus ring, and tooltips also appear on :focus-visible. Transitions are disabled for prefers-reduced-motion.

Usage notes

Requires the Tailwind browser build (added automatically) and Bootstrap Icons (listed in external libraries). Copying needs a secure context or a browser that still supports execCommand('copy'); inside sandboxed previews the button may report "Copy failed".

Sticky Social Share Sidebar at a glance

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

Questions about this template

Can I use the Sticky Social Share Sidebar 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 Tailwind CSS 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):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Sticky Social Share Sidebar – Tailwind CSS social buttons component screenshot
Sticky Social Share Sidebar · Tailwind CSS Social Buttons

More Social Buttons

Social Login Buttons – Tailwind CSS social buttons preview

Social Login Buttons

Dark Tailwind CSS social login buttons for Google, Apple and GitHub with full-width and icon-only variants and a loading spinner state.

Social Share Buttons – Pure CSS social buttons preview

Social Share Buttons

Pure CSS social share card with brand-colored X, Facebook and LinkedIn buttons, a copy-link field with clipboard feedback and a native share fallback.