SlideToUnlock
A fully customizable "slide-to-unlock" UI component for Jetpack Compose.
This component displays a track with a draggable thumb. The user can slide the thumb from the start to the end to trigger an action. The component supports a loading state where the thumb is locked at the end and displays a progress indicator.
Supports horizontal (default) and vertical orientations via SlideOrientation.
Parameters
Whether the slider has been completed and locked. When true
, the thumb is fixed at the end and a loading indicator may be shown.
Invoked when the user successfully completes the slide gesture by dragging the thumb past the fractionalThreshold.
Modifier to be applied to the layout.
Provides the color scheme for the track, thumb, and hint. Defaults to DefaultSlideToUnlockColors.
Provides the hint messages for both the default and slided states.
Defines the shape of the background track. Defaults to a rounded rectangle.
The size of the draggable thumb.
The fraction of the track (from 0.0f to 1.0f) that the user must slide the thumb past to trigger the onSlideCompleted
callback. Defaults to 0.85f (85%).
The external padding values to be applied to the entire component.
The internal padding values for the hint composable, used to prevent the hint from overlapping with the thumb at its start and end positions.
Optional callback invoked with the current slide progress fraction (0f–1f) as the user drags the thumb.
The direction of the sliding gesture. Defaults to SlideOrientation.Horizontal.
A composable slot for customizing the draggable thumb. It provides the slide state, current slide fraction, colors, size, and orientation.
A composable slot for customizing the hint text or visuals inside the track. It provides the slide state, current slide fraction, hint texts, colors, paddings, and orientation.