Keyboard accessible by default with semantic markup, visible focus treatment, and tokenized states. Add descriptive labels for icon-only or decorative usage.
Dependency notes
Check Installation for shared peers. This component keeps styling in Tailwind classes and the --zui-* token contract.
Feedback
Slide to Complete
The Slide to Complete component requires users to drag a handle from the start position to the end of a track before the action is considered complete. It supports configurable thresholds, disabled/loading states, and keyboard completion.
Slide to approve
Slide to delete
Slide to unlock
Slide to complete playground
Pick an appearance, size, and threshold, then drag the thumb (or focus it and press Enter) to see the interaction complete. Toggle Show output / Show code and the snippet updates to match the selected variant.
Drag the thumb to the end, or focus it and press Enter / Space.
Slide to approve
All appearances
Every shipped appearance token at a glance. Click any swatch to load it into the playground above.
default
primary
secondary
success
destructive
warning
info
blue
violet
emerald
amber
rose
slate
zinc
gradient-blue
gradient-emerald
gradient-rose
glass
Controlled state
Drive the completed state from your own approved variable with value / onValueChange. Completing the drag calls onValueChange(true); the appearance and label switch to reflect the approved state, and the "Reset" button demonstrates setting it back from the outside.
Slide to approve
Approved: false
Slide To Complete API
Generated from the package prop types and variant definitions.
The component uses a drag interaction model where the user slides a thumb along a track. Progress is normalized between 0 and 1. When the threshold (default 0.9) is crossed, the component triggers the onComplete callback and animates the thumb to the end position.
Compound API
Users can compose the component from primitives: <SlideToComplete.Root>, <SlideToComplete.Track>, <SlideToComplete.Progress>, <SlideToComplete.Label>, <SlideToComplete.Thumb>, and <SlideToComplete.Icon>. The root owns all interaction state and context, while children consume it.
Keyboard interaction
Tab to focus the thumb, then use Space or Enter to complete the action. Arrow keys (←/→) can adjust progress. The component supports disabled and loading states that prevent keyboard completion.
Accessibility
The thumb is a semantic button element. Accessible label comes from the label prop or aria-label. Keyboard focus is managed, and reduced motion preferences are respected. Test with screen readers for your specific use case.
State variants
The component supports idle, dragging, resetting, completed, disabled, loading, and error states. Visual styling can be customized via data attributes (data-state, data-appearance, data-size) and CSS variables.
FAQ
Does the Slide to Complete work with keyboard navigation?
Yes. The thumb can be focused via Tab key and completed using Space or Enter. Arrow keys can also adjust progress.
Can I customize the appearance of the slider?
Yes. The component ships 17+ appearance tokens (default, primary, secondary, success, destructive, warning, info, several accent colors, gradients, and a glass variant) plus sm/md/lg size variants, all overridable through CSS variables.
What happens if the user releases before reaching the threshold?
By default, the thumb snaps back to the start position. This behavior can be changed with the resetOnRelease prop.