[PR #28] [MERGED] feat: allow passing type to sileo.show() for dynamic toast state #30

Closed
opened 2026-03-02 05:16:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hiaaryan/sileo/pull/28
Author: @stakeswky
Created: 2/21/2026
Status: Merged
Merged: 2/22/2026
Merged by: @hiaaryan

Base: mainHead: fix/4-show-type-param


📝 Commits (1)

  • d6de57b feat: allow passing type to sileo.show() for dynamic toast state (#4)

📊 Changes

3 files changed (+3 additions, -1 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 src/toast.tsx (+1 -1)
📝 src/types.ts (+1 -0)

📄 Description

Summary

Fixes #4

Adds an optional type property to SileoOptions, allowing sileo.show() to render stateful toasts without requiring separate method calls.

Changes

  • src/types.ts: Added type?: SileoState to SileoOptions
  • src/toast.tsx: show() now passes opts.type as the internal state

Usage

// Dynamic state selection
sileo.show({
  type: response.ok ? 'success' : 'error',
  title: 'Upload complete',
});

// Equivalent to sileo.success(...)
sileo.show({ type: 'success', title: 'Saved' });

// Still works — generic toast without badge
sileo.show({ title: 'Hello' });

State-specific methods (sileo.success(), sileo.error(), etc.) continue to work unchanged and take precedence over type.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hiaaryan/sileo/pull/28 **Author:** [@stakeswky](https://github.com/stakeswky) **Created:** 2/21/2026 **Status:** ✅ Merged **Merged:** 2/22/2026 **Merged by:** [@hiaaryan](https://github.com/hiaaryan) **Base:** `main` ← **Head:** `fix/4-show-type-param` --- ### 📝 Commits (1) - [`d6de57b`](https://github.com/hiaaryan/sileo/commit/d6de57b519e81c3d95b2dbda0caaa001281d0505) feat: allow passing `type` to `sileo.show()` for dynamic toast state (#4) ### 📊 Changes **3 files changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `src/toast.tsx` (+1 -1) 📝 `src/types.ts` (+1 -0) </details> ### 📄 Description ## Summary Fixes #4 Adds an optional `type` property to `SileoOptions`, allowing `sileo.show()` to render stateful toasts without requiring separate method calls. ## Changes - `src/types.ts`: Added `type?: SileoState` to `SileoOptions` - `src/toast.tsx`: `show()` now passes `opts.type` as the internal `state` ## Usage ```ts // Dynamic state selection sileo.show({ type: response.ok ? 'success' : 'error', title: 'Upload complete', }); // Equivalent to sileo.success(...) sileo.show({ type: 'success', title: 'Saved' }); // Still works — generic toast without badge sileo.show({ title: 'Hello' }); ``` State-specific methods (`sileo.success()`, `sileo.error()`, etc.) continue to work unchanged and take precedence over `type`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 05:16:38 +03:00
kerem changed title from [PR #28] [MERGED] feat: allow passing type to sileo.show() for dynamic toast state to [PR #28] feat: allow passing type to sileo.show() for dynamic toast state 2026-03-07 22:03:46 +03:00
kerem changed title from [PR #28] feat: allow passing type to sileo.show() for dynamic toast state to [PR #28] [MERGED] feat: allow passing type to sileo.show() for dynamic toast state 2026-03-15 18:50:37 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/sileo#30
No description provided.