Pager
Swipeable pages that snap into place.
Import
import {Pager} from '@hzblj/kara-ui'Props
A swipeable, snapping pager: SwiftUI's TabView in its page style, Compose's HorizontalPager.
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The pages, one per child, in order. |
| indicators | boolean | true | 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 |
| scrollEnabled | boolean | Android true | Android only. SwiftUI can only disable a |
| testID | string | — | Test identifier, forwarded to the native view. |
The pages, one per child, in order.
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.
Fires once a swipe or a programmatic move has settled, never mid-gesture.
Zero-based. Controlled when passed; otherwise the pager just starts at 0 and owns its position.
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.
Test identifier, forwarded to the native view.
Platform notes
- Pages are its children, addressed by index.
pageSpacingandscrollEnabledare Android only. iOS draws its own dots over the bottom edge; Android places them below.