Loading...
Installation
Props
Prop | Type | Default | Description |
---|---|---|---|
label | string | "Slide to Delete" | The text displayed on the button |
deletedLabel | string | "Deleted" | The text displayed after successful deletion |
icon | ReactNode | <Trash2 className="w-4 h-4" /> | The icon displayed in the drag handle |
dragLimit | number | 140 | The distance in pixels required to trigger deletion |
className | string | - | Additional CSS classes for styling |
onClick | function | - | Function called when deletion is confirmed |
Examples
Custom Colors
You can customize the button's appearance using the className
prop:
<SlideToDeleteButton
className="bg-yellow-100 text-yellow-700 hover:bg-yellow-200"
label="Slide to Archive"
deletedLabel="Archived"
/>
Custom Action
Use the onClick
prop to handle the deletion action:
<SlideToDeleteButton
label="Remove Item"
onClick={() => handleItemRemoval(itemId)}
/>