EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
Chat·component·@astryxdesign/core

Chat Layout Scroll Button

Floating scroll-to-bottom button that appears when the user scrolls away from the latest messages. It fades in as a compact icon button and expands to show a label when new messages arrive. ChatLayout renders this by default: pass a custom element to the scrollButton prop to override, or null to hide it entirely.

Open in Playground @astryxdesign/core/Chat

Showcases and examples

2 documented examples

Chat Layout Scroll Button

Scroll button in hidden, visible, and expanded (with label) states. The button fades in when the user scrolls up and expands when new messages arrive.

Preview loads on approachPreview loads on approach
Exact source · chat-layout-scroll-button-states
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {ChatLayoutScrollButton} from '@astryxdesign/core/Chat';
import {Stack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';

export default function ChatLayoutScrollButtonStates() {
  return (
    <Stack direction="vertical" gap={4}>
      <Stack direction="vertical" gap={1}>
        <Text type="supporting" color="secondary">
          Hidden (user is at bottom)
        </Text>
        <ChatLayoutScrollButton isVisible={false} onClick={() => {}} />
      </Stack>
      <Stack direction="vertical" gap={1}>
        <Text type="supporting" color="secondary">
          Visible (user scrolled up)
        </Text>
        <ChatLayoutScrollButton isVisible={true} onClick={() => {}} />
      </Stack>
      <Stack direction="vertical" gap={1}>
        <Text type="supporting" color="secondary">
          Expanded with label (new messages arrived)
        </Text>
        <ChatLayoutScrollButton
          isVisible={true}
          label="New messages"
          onClick={() => {}}
        />
      </Stack>
    </Stack>
  );
}

Usage

Floating scroll-to-bottom button that appears when the user scrolls away from the latest messages. It fades in as a compact icon button and expands to show a label when new messages arrive. ChatLayout renders this by default: pass a custom element to the scrollButton prop to override, or null to hide it entirely.

Typed props

PropType and behavior
isVisibleboolean · required
Whether the button is visible. Bind to a scroll-position check so the button only appears when the user has scrolled up.
labelstring
Optional label that expands the button (e.g. "New messages"). Use to signal unread content below the fold.
onClick() => void · required
Click handler: typically scrolls to bottom and dismisses the new message indicator.