FIG-001/ SNIPPETS

header & footer.

Persistent header and footer snippets render above and below all messages without injecting fake chat rows.

  • The header and footer snippets render persistent content above and below messages — no fake entries injected into the messages array.
  • Both live outside the virtual scroll machinery — always in the DOM, never virtualized away. Omit them and the component behaves exactly as before.
  • Footer height changes are tracked via ResizeObserver. When a typing indicator appears, the viewport snaps to bottom automatically if you were following.
  • Headers suit "load more" buttons, date separators, or channel banners. With few messages the bottom-gravity layout still pushes everything — header included — down.
↩ all examples
slots · header · footer mode · live running source
file · HeaderFooterChat.svelte messages 1 ● following
header beginning of conversation · 1 message
assistant 06:30 AM
Welcome! This demo shows the header and footer snippet props. Try toggling the typing indicator and watch the viewport stay pinned.
category · snippets
sheet · sheet 01 / 01
⟳ to re-run

Header & Footer