Scroll Fade

Fade the edge of a scrollable region when more content lies beyond it. Scroll to the bottom to see the last row sharpen.

  1. Item 1
  2. Item 2
  3. Item 3
  4. Item 4
  5. Item 5
  6. Item 6
  7. Item 7
  8. Item 8
  9. Item 9
  10. Item 10
  11. Item 11
  12. Item 12

Usage

Use scroll-fade on a vertical scroller or scroll-fade-x on a horizontal one. Both ship with each Basecoat style bundle and work with Tailwind’s @apply. Put the border on a wrapper so the mask affects only the scrolling content.

<div class="scroll-fade max-h-48 overflow-y-auto" tabindex="0" aria-label="Release notes">
  <!-- Release notes -->
</div>

The mask follows the native scroll position using CSS scroll-driven animations. Browsers without support show the content normally, as does forced-colors mode. The horizontal fade follows the reading direction in RTL.

Horizontal scrolling

  • Design
  • Engineering
  • Marketing
  • Product
  • Research
  • Sales
  • Support
  • Operations
  • Finance
  • Legal
  • People
  • Security

Use the same utility inside a Tailwind rule for a custom list:

.file-strip {
  @apply scroll-fade-x overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden;
}

RTL

Set dir="rtl" on the container or an ancestor. At the start of this list the left edge fades. Scroll to the end and the right edge fades instead.

  • تصميم
  • هندسة
  • تسويق
  • منتج
  • أبحاث
  • مبيعات
  • دعم
  • عمليات
  • مالية
  • قانوني

Where Basecoat uses it

Attachment applies the horizontal fade to scrolling groups and clears the mask when focus enters the group. Code Block applies a horizontal fade to long source lines and a vertical fade to wrapped output. Both components supply the fade in their CSS.