Slide Action
Import
Usage
When users swiped all the way to the end, we can call it a successful or confirmatory action.
Reset
How to reset the component status?
Call reset
function that shipped with onSwipeEnd
callback.
Status: Waiting for confirmation
Call resetState
function from component ref.
Status: Waiting for confirmation
Customization
Effects
slideType
: the slide progress effect.labelType
: label effect.
Slide effect
Label effect
Icon
Color 🎨
You can use the color
prop to change the theme color.
Default color: #1d4ed8
(--k-slide-action-theme
)
color: #475569
Gradient slide background
Compact
Styling Elements
classNames
and styles
are 2 more available options for styling the <SlideAction>
component.
See SlideActionStylingSelectors
in the Special Types section below for available selectors.
allowSwipeAfterEnd
Avoid enabling this flag as much as possible. If you wanna reset the component status, see the Reset section.
By default, users can NOT swipe this component after the action is settled/confirmed. Set allowSwipeAfterEnd
to true
to disable this behavior.
Successful / confirmatory action count: 0
Special Types
Name | Type | Description |
---|---|---|
SlideActionOnSwipeEnd | (reset: () => void) => void | Type of onSwipeEnd callback |
SlideActionOnChange | (isSuccess: boolean) => void | Type of onChange callback |
SlideActionStylingSelectors | 'dragger' | 'label' | 'progress' | Available selectors of special styles APIs: classNames , styles . |
SlideActionRef | HTMLDivElement & {resetState: () => void;} | <SlideAction> element ref.Call ref.resetState() to reset component status. See the reset section. |
<SlideAction>
Props
Name | Type | Default | Description |
---|---|---|---|
children | ReactNode | — | Will be consider as a label. If provided, label prop will be ignored. |
classNames | Partial<Record<SlideActionStylingSelectors, string>> | — | Applies className to related selector element. |
styles | Partial<Record<SlideActionStylingSelectors, CSSProperties>> | — | Applies inline styles to related selector element. |
icon | ReactNode | Double arrow right | Icon for the swiper. |
color | string | --k-slide-action-theme - #1d4ed8 | Component theme color. Includes label, slide background, border and the dragger color |
label | string | 'Slide' | |
labelType | 'default' | 'slide' | 'default' | Label effect |
slideType | 'slide' | 'static' | 'slide' | The left behind background color’s effect.'slide' : progress effect (default). |
onSwipeEnd | SlideActionOnSwipeEnd | — | Trigger when users swiped all the way to the end. Call the 1st argument to reset the component status. See the reset section. |
onChange | SlideActionOnChange | — | Trigger when component’s status changes. |
compact | boolean | false | Compact size. |
allowSwipeAfterEnd | boolean | false | See the allowSwipeAfterEnd section. |