Skip to content
View Markdown

ScrollView ​

A named scroll region for content that is not a list.

tsx
import { ScrollView, ScrollTarget } from '@satinhq/kit'

Example ​

Click Go to chapter in the toolbar to move to the declared target.

Name the scroll region ​

Use a stable id for the ScrollView. Its position belongs to the current screen.

Declare a target ​

Wrap normal-flow content in ScrollTarget with a stable id. A vertical ScrollView with a ref enables its handle without another positioning prop. You can also use a scrollPosition binding or observe VerticalScrollGeometry.

Choose the axis ​

ScrollView scrolls vertically by default. Use axis="horizontal" for horizontal content. Target positioning, anchors, geometry callbacks and refresh are vertical-only.

Center narrow content ​

For a narrow vertical stack, use an explicit full-width frame and center the stack within it. Stack alignment arranges the stack's children; it does not make the stack fill the scroll region.

tsx
import { ScrollView, Text, VStack } from '@satinhq/kit'

export function TimerSummary() {
  return (
    <ScrollView id="timer-summary">
      <VStack
        alignment="center"
        spacing={12}
        padding
        frame={{ maxWidth: 'infinity', alignment: 'center' }}
      >
        <Text font="title">24:00</Text>
        <Text foregroundStyle="secondary">Focus time</Text>
      </VStack>
    </ScrollView>
  )
}

The frame fills the available width and centers the narrow stack. For a leading-aligned composition, set both frame and stack alignment to leading. Use explicit width and alignment on nested timer or metric groups too; filling the outer frame does not set text alignment inside those groups.

Message appends ​

defaultScrollAnchor="bottom" supports insertion motion for a thread that stays pinned to the bottom. This does not provide replacement or keyed List reorder motion. See Messaging scroll for the growing-composer recipe, stable message identities and remaining motion limitations.

API ​

Scroll horizontally to read every column.

PropTypeDescription
idstringA stable region name.
axis'vertical' | Axis.Set`The scroll axis.
childrenReactNodeScrollable content.
scrollPositionScrollPositionBindingOptional controlled target position.

Related: Quick start, List, Screen.

:::

Satin runs on the Lumen rendering engine and is open source under the MIT License.