Add SlidingButton component#5398
Merged
Merged
Conversation
Introduces the SlidingButton (swipe-to-confirm) component to the Base Design System. Uses a drag gesture instead of a tap to confirm actions, reducing accidental triggers and reinforcing user intent. Features: - Drag interaction with configurable threshold (high: 80%, low: 20%) - Loading and disabled states - Auto-reset via slideBackAfterMs - Keyboard support (Enter / Space) - RTL support - Full override system (Root, Track, Slider, Label, CompletedLabel, Grabber, LoadingOverlay, LoadingSpinner) - ARIA attributes (role, aria-label, aria-busy, aria-disabled, aria-live) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
- Unit tests covering rendering, a11y attributes, keyboard interaction, loading/disabled states, slideBackAfterMs reset, and ref forwarding - Ubook stories: default, states, low-threshold scenarios - npm version minor (18.0.0 → 18.1.0) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Replace markdown table (unsupported without remark-gfm) with bullet list. Use 'at least N%' instead of '>N%' for clarity. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
@hualf1995 Thanks! The PR has been updated.
|
Collaborator
As per the test, I think you are right! Jest setup seems not available here. |
hualf1995
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the SlidingButton (swipe-to-confirm) component to the Base Design System. Uses a drag gesture instead of a tap to confirm actions, reducing accidental triggers and reinforcing user intent by introducing deliberate friction.
Props
labelstringthreshold'high' | 'low''high'high= 80%,low= 20% of track widthisLoadingbooleanfalseisDisabledbooleanfalseonComplete() => voidslideBackAfterMsnumberoverridesSlidingButtonOverrides{}Root,Track,Slider,Label,CompletedLabel,Grabber,LoadingOverlay,LoadingSpinneraria-labelstringlabelif not providedDocs
Ladle stories
What's included
src/sliding-button/): constants, types, default-props, styled-components, component, indexTest plan
npm run build:libcompiles successfully