mirror of
https://github.com/hiaaryan/sileo.git
synced 2026-04-26 23:45:50 +03:00
[PR #26] feat: add optional close button for toast dismissal #27
Labels
No labels
bug
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/sileo#27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hiaaryan/sileo/pull/26
Author: @lubauss
Created: 2/21/2026
Status: 🔄 Open
Base:
main← Head:feat/close-button📝 Commits (1)
478e1f9feat: add optional close button for toast dismissal📊 Changes
3 files changed (+58 additions, -0 deletions)
View changed files
📝
src/sileo.tsx(+25 -0)📝
src/styles.css(+30 -0)📝
src/toast.tsx(+3 -0)📄 Description
Summary
Add a
closeButtonprop to<Toaster>that renders an X dismiss button on each toast, visible on hover. This provides an alternative to swipe-to-dismiss for desktop users.Problem
Currently the only way to dismiss a toast (besides waiting for auto-dismiss) is swiping. Desktop users expect a close button, especially for sticky toasts (
duration: null) that don't auto-dismiss.Solution
New
closeButtonpropWhen enabled, each toast renders an X button (using the existing
Xicon) in the top-right corner. The button:onDismiss()on clickrole="button",tabIndex,aria-label, keyboard support (Enter/Space)CSS
Files Changed
src/toast.tsxcloseButtonprop toSileoToasterProps, pass to<Sileo>src/sileo.tsxcloseButtonprop, render X button with a11y attributessrc/styles.css[data-sileo-close]styles with hover revealBackward Compatibility
closeButtondefaults tofalse— no visual change unless opted inTesting
<Toaster closeButton />— hover over a toast, X button should fade incloseButtonprop — verify no X button appears🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.