Skip to content

Layout

IScrollFade ​

A scroll container that fades the edges it can still scroll past, so a cropped list shows there is more without waiting for a scrollbar.

  • Invoice INV-1042
  • Invoice INV-1041
  • Invoice INV-1040
  • Invoice INV-1039
  • Invoice INV-1038
  • Invoice INV-1037
  • Invoice INV-1036
  • Invoice INV-1035
  • Invoice INV-1034
  • Invoice INV-1033
  • Invoice INV-1032
  • Invoice INV-1031
  • Invoice INV-1030
  • Invoice INV-1029

Scroll it: the top edge stays sharp until something has moved past it, and the bottom fade disappears at the end of the list.

Horizontal ​

PaidDraftPendingOverdueArchivedDisputedRefundedWritten offOn holdScheduled

A horizontal strip is where this earns its keep — on a trackpad the scrollbar never appears at all.

The fade is a mask ​

The edges are masked rather than covered by a gradient, so the component needs no background colour of its own and works on a card, a coloured panel or an image.

The mask applies to everything the element paints: a border on the component fades at the corners, the scrollbar fades with it, and anything position: sticky inside fades too. Put the frame — and any sticky header — on a wrapper instead.

  • Invoice INV-1042
  • Invoice INV-1041
  • Invoice INV-1040
  • Invoice INV-1039
  • Invoice INV-1038
  • Invoice INV-1037
  • Invoice INV-1036
  • Invoice INV-1035
  • Invoice INV-1034
  • Invoice INV-1033
  • Invoice INV-1032
  • Invoice INV-1031
  • Invoice INV-1030
  • Invoice INV-1029

Fade length, and fading one edge only ​

size takes any CSS length. fadeStart and fadeEnd switch an edge off entirely, for when something else already covers it.

  • Invoice INV-1042
  • Invoice INV-1041
  • Invoice INV-1040
  • Invoice INV-1039
  • Invoice INV-1038
  • Invoice INV-1037
  • Invoice INV-1036
  • Invoice INV-1035
  • Invoice INV-1034
  • Invoice INV-1033
  • Invoice INV-1032
  • Invoice INV-1031
  • Invoice INV-1030
  • Invoice INV-1029

Reacting to the edges ​

data-at-start, data-at-end and data-overflowing land on the root, so a "scroll for more" hint outside the container needs no script at all. Scroll the list to watch the line under it change.

  • Invoice INV-1042
  • Invoice INV-1041
  • Invoice INV-1040
  • Invoice INV-1039
  • Invoice INV-1038
  • Invoice INV-1037
  • Invoice INV-1036
  • Invoice INV-1035
  • Invoice INV-1034
  • Invoice INV-1033
  • Invoice INV-1032
  • Invoice INV-1031
  • Invoice INV-1030
  • Invoice INV-1029

The default slot receives the same three as props, for content that has to react in script rather than in CSS:

vue
<IScrollFade v-slot="{ atEnd, overflowing }">
  <ul>…</ul>
  <button v-if="overflowing && !atEnd" @click="loadMore()">Load more</button>
</IScrollFade>

Props ​

PropTypeDefaultDescription
orientation'vertical' | 'horizontal''vertical'Which way it scrolls
sizestring'2rem'Length of the fade, as any CSS length
fadeStartbooleantrueFade the leading edge
fadeEndbooleantrueFade the trailing edge
unstyledboolean—Drop built-in classes
classstring—Merged with the built-in classes; put the height here
Slot propType
atStartbooleanNothing has scrolled past the leading edge
atEndbooleanEverything is in view
overflowingbooleanThere is anything to scroll at all

How the edges are measured ​

The edges are re-measured on scroll, when the container or its content resizes, and when rows are added or removed — so the fades stay correct through a reflow or a filtered list, with no work on your side.