Skip to content

Block 53 of 297

Sticky CTA Bar

Slim message-and-button bar that sticks to the bottom of the screen with CSS, for time-limited campaigns.

Puck key
StickyCtaBarBlock
Export
stickyCtaBarBlock
React component
<StickyCtaBar />
Path
components/puck/sticky-cta-bar-block.tsx
Dependencies
None
License
MIT

About this block

When to use it, how to write for it, and what to change in the code.

What it's for

A slim floating bar with an optional badge, a one-line message, a detail line and a button, held at the bottom of the screen with CSS position: sticky. There's no JavaScript, so visitors can't dismiss it. On phones the badge and detail are hidden to keep it to one row, and it clears the safe-area inset.

  • A matching-gift or giving-day deadline that should stay in view
  • A registration window closing on a set date
  • A single urgent announcement on a campaign landing page
Writing the content
  • Keep the Message to one short line; it shares the row with the button on phones.
  • Region name isn't shown but names the bar for screen readers, such as "Year-end appeal".
  • Sticky only holds the bar at the bottom while its spot in the page is still below the screen, and only inside the container it's dropped in. Preview and scroll before publishing.
  • Use one per page and remove it when the campaign ends.
Accessibility
  • The bar is an aside landmark named by Region name ("Announcement" if blank), so it can be found or skipped.
  • The button is at least 44px tall with a focus outline matched to each style.
  • It can't be dismissed and covers the bottom of the screen, so check that it doesn't hide focused links or fields as people tab.
Customizing the code
  • Styles are in the tones object; dark and light bars are 95% opaque with a backdrop blur.
  • The bar sits at z-40; raise it if headers or chat widgets overlap.

Editor fields

What content editors see in the P1 sidebar when they select this block.

  • Region nametext
  • Badgetext
  • Messagetext
  • Detailtext
  • Button texttext
  • Button linktext
  • Styleselect