Layout and lists

Pager

Swipeable pages that snap into place.

iOSSwiftUI TabView, page styleAndroidCompose HorizontalPagerRenders in a Screen or an Island
iOSSwiftUI TabView, page style
AndroidCompose HorizontalPager

Import

ts
import {Pager} from '@hzblj/kara-ui'

Props

A swipeable, snapping pager: SwiftUI's TabView in its page style, Compose's HorizontalPager.

PropTypeDefaultDescription
childrenReactNode—

The pages, one per child, in order.

indicatorsbooleantrue

Page dots. iOS draws SwiftUI's own, over the bottom edge; Compose has no built-in indicator, so Android composes the dots and places them below the pager, which is where Material puts them.

onPageChange(page: number) => void—

Fires once a swipe or a programmatic move has settled, never mid-gesture.

pagenumber—

Zero-based. Controlled when passed; otherwise the pager just starts at 0 and owns its position.

pageSpacingSpaceSize—

Android only — a SwiftUI page-style TabView has no gap between pages.

scrollEnabledbooleanAndroid true

Android only. SwiftUI can only disable a TabView as a whole, which would take the pages' content down with the swipe, so iOS always stays swipeable.

testIDstring—

Test identifier, forwarded to the native view.

children
ReactNode

The pages, one per child, in order.

indicatorstrue
boolean

Page dots. iOS draws SwiftUI's own, over the bottom edge; Compose has no built-in indicator, so Android composes the dots and places them below the pager, which is where Material puts them.

onPageChange
(page: number) => void

Fires once a swipe or a programmatic move has settled, never mid-gesture.

page
number

Zero-based. Controlled when passed; otherwise the pager just starts at 0 and owns its position.

pageSpacing
SpaceSize

Android only — a SwiftUI page-style TabView has no gap between pages.

scrollEnabledAndroid true
boolean

Android only. SwiftUI can only disable a TabView as a whole, which would take the pages' content down with the swipe, so iOS always stays swipeable.

testID
string

Test identifier, forwarded to the native view.

Platform notes

  • Pages are its children, addressed by index.
  • pageSpacing and scrollEnabled are Android only. iOS draws its own dots over the bottom edge; Android places them below.