Vanilla Breeze

Sticky Share Bar

Vertical share rail beside an article that follows the reader. Pure position: sticky composition, no JS, no scroll listeners.

Overview

A vertical rail of share buttons that sticks to the side of an article as the reader scrolls. The rail releases naturally when the article ends because position: sticky respects its containing block.

Anatomy:

  • A grid container with rail · body · gutter columns
  • The rail is position: sticky with align-self: start
  • inset-block-start sets the offset from the viewport edge
  • At narrow widths the rail flips to a horizontal bar above the article

HTML

CSS

Composing with VB's clipboard utility

The copy-link button in the demo uses data-copy from VB's clipboard system — no per-page JS, automatic data-state="copied" feedback, screen-reader announce. See data-copy.

For a full share component with platform-specific share URLs and the Web Share API, use <share-wc> instead of rolling your own anchors.

Notes

  • align-self: start is what keeps the rail pinned at the top. Without it the rail stretches to the article's height and never sticks.
  • The third column (aside) is intentionally empty in the demo — it gives the article a centred feel by claiming the right gutter. Drop it if you don't need symmetry.
  • No overflow: hidden on any ancestor — same sticky caveat as everywhere.
  • If the body is shorter than the viewport, the rail won't appear to stick (there's nothing to scroll). That's correct.