Skip to content
v2.5.0
English
Русский
Documentation

PageControl

PageControl is a compound component for short page or step indicators, usually in carousels and onboarding flows.

Root Props

PropTypeDefault
activenumber—
Controlled active index.
defaultActivenumber0
Uncontrolled initial active index.
onChangeActive(value: number) => void—
Callback that is triggered when the user selects a different page. Receives the new index as a number.
refRef<HTMLUListElement>—
Ref forwarded to the underlying <ul> element.
sizePageControlSize'md'
Defines the size of the page control items.

Also accepts all <ul> attributes.

Child Parts

  • PageControlItem: standard dot item.
  • PageControlProgress: progress-style animated item.

PageControlItem

PropTypeDefault
indexrequirednumber—
Index of the page item (zero-based). Used to identify and compare with the active index from context.
refRef<HTMLButtonElement>—
Ref forwarded to the underlying button element.
currentboolean—
Forces this item to be marked as active, regardless of the context. If not provided, active state is determined by comparing index with the active index from context.
sizePageControlSize—
Defines the size of the page control items.

Also accepts all <button> attributes.

PageControlProgress

PropTypeDefault
indexrequirednumber—
Index of the page item (zero-based). Used to determine whether this item is currently active.
durationnumber5000
Duration of the progress animation in milliseconds. Controls how long the visual fill takes to complete. Defaults to 5000ms if not provided.
refRef<HTMLButtonElement>—
Ref forwarded to the underlying button element.
currentboolean—
Whether this page item is currently active. If not provided, active state is inferred from context.
sizePageControlSize—
Defines the size of the page control items.

Also accepts all <button> attributes.

Types

  • PageControlProps
  • PageControlItemProps
  • PageControlProgressProps

State Model

  • The root supports controlled and uncontrolled active state.
  • Arrow keys change active item left/right.
  • Pointer dragging on touch and pen can sweep across items.