{"summary":"Toast 和 Notification 分別適合什麼樣的提示，以及什麼時候兩者都不該用。","notes":"<p>Toast 和 Notification 都是浮在頁面上的小卡片，經常被混用：重要的資訊幾秒後就消失了，「已儲存」這類一般的確認卻一直留在介面上。常見的提示有以下五種：</p>\n        <ol>\n        <li><strong>Status Toast</strong>：用於確認操作的結果，使用者知道即可，例如複製連結、移動任務。只有一個圖示和一句短文字，不帶按鈕，3 秒後自動消失。</li>\n        <li><strong>Action Toast</strong>：用於可以復原的操作。直接執行，不預先確認；Toast 裡保留 5 秒的 Undo 按鈕，以圓環顯示剩餘時間，復原後原地變為「Task restored」。</li>\n        <li><strong>Progress Toast</strong>：用於耗時較長的操作，例如上傳檔案。先顯示進度，完成後原地變為結果，並提供查看按鈕。</li>\n        <li><strong>Notification</strong>：由他人或系統發出、需要看到但不必立刻處理的資訊，例如被人提及、任務到期、週報產生。顯示在右上角，保留到使用者處理或關閉為止；最多疊三層，懸停時展開為清單。</li>\n        <li><strong>對話框與原地提示</strong>：必須由使用者處理的事，Toast 和 Notification 都不適合。無法復原的操作在執行前用對話框確認；需要處理的失敗留在原處直到解決，表單錯誤顯示在對應欄位旁邊。</li>\n        </ol>\n        <h2>參數</h2>\n        <dl class=\"params\">\n        <dt>Toast 進場</dt><dd>500ms；cubic-bezier(.25, .1, .25, 1)；下移 10px；從 8px 模糊變清晰</dd>\n        <dt>掃光</dt><dd>只在事情完成時出現：狀態 Toast 進場、進度轉為結果、復原完成</dd>\n        <dt>通知進場</dt><dd>從上方 56px 處落下；560ms；cubic-bezier(.32, .72, 0, 1)</dd>\n        <dt>通知堆疊</dt><dd>每層露出 12px；最多三層</dd>\n        </dl>\n        <p>附帶的提示詞會先讀取產品，逐條判斷每則提示該用 Toast、Notification 還是都不用，列成表格由你決定；確認後，還可以依展示效果改造 Toast 和 Notification。</p>","prompt":"Review how my product tells people that something happened, and decide for each message whether it should be a toast, a notification, or neither. Then, if I want it, restyle the toasts and notifications along the lines below. This is about judgment first: diagnose and recommend, and change only what I approve.\n\nThis is a change to my product, not a demo. Work inside my code, on my stack, with my components, tokens, corner scale, fonts and copy style. Do not add a dependency, a new state library or a new visual pattern without asking. Every value below is a default to start from.\n\n0. Read the product first\n- Find every place that shows a message about an event: toasts and snackbars, alerts and banners, notification lists, inbox or activity panels, badges and counts, inline success and error text, and browser or push notifications.\n- For each one, note: what triggers it (the person's own action, another person, the system, a background job), what it says, any buttons, where it appears, how long it stays, and whether it can be found again later.\n- Find the components behind them and where they are mounted (one per page, or one for the whole app). Note how they announce themselves to screen readers.\n- Tell me in a few lines what you found before going on.\n\n1. What each one is for\n- Toast: answers something the person just did, in the place they are working. It is short, it does not interrupt, and it goes away by itself. It comes in three kinds:\n  a. Status: confirms a result, so the person does not have to go and check. An icon and a few words, no buttons. Example: \"Link copied\".\n  b. Action: the action has already been done, and the toast holds the one step that may follow, usually Undo. One line and one button, plus a close. It stays long enough to use the button, with the time left shown.\n  c. Progress: work that takes a moment. It shows that the work is under way, then turns into the result in the same place, with a button to see it. Example: \"Uploading brand-guide.pdf\" turns into \"Uploaded to Files, Open\".\n- Notification: news the person did not cause just now, from other people or from the system: a mention, a reply, a payment, a deadline, a security alert, a finished report. It can carry more: a title, a few lines and up to two actions. It is shown on every page, stays until it is opened, handled or closed, and several can be shown at once. It is also kept somewhere the person can find it again (an inbox or a list behind a bell, with a count).\n- Neither:\n  - A form error or a problem with one field: show it next to the field.\n  - A failure the person has to fix (an upload that failed, a payment that did not go through): keep it on the item, with a way to fix it, until it is fixed. A toast that disappears after a few seconds is not enough.\n  - An action that cannot be undone: ask before doing it (a confirm next to the button, or a dialog for something with a large impact). A toast after the fact is too late.\n  - Something only worth seeing when the person looks: a badge, a dot or a change of state in place, with no message at all.\n\n2. Questions that settle a case\n- Who caused it? The person, just now: toast. Someone else, the system, or the person a while ago in another place: notification.\n- Does the person need to act? No: status toast. One quick step that may follow (Undo, View): action toast. A real decision or a reply: notification. Something that must be fixed: keep it on the item.\n- Can the action be undone? Then do it at once and offer Undo in a toast instead of asking first. If it cannot be undone, confirm before, not after.\n- How much is there to say? A few words: toast. A sentence or two, a name, an amount, a place: notification.\n- Would it matter if the person missed it? No: toast. Yes: notification, kept until handled.\n- Is the work still running when the person leaves? If it ends while they are still on the page, a toast is enough. If they have moved to another tab or app, a browser or system notification (with permission) is the only way to reach them; inside the product, it also goes into the notification list.\n- Several at once? Toasts: one at a time; a new one replaces the old one, or waits. Notifications: they stack.\n\n3. Report before changing anything\nGive me a table first, and do not change code yet. One row per message:\n- Where: the screen or component, and what triggers it.\n- Now: how it is shown today, in a few words.\n- Should be: status toast, action toast, progress toast, notification, or neither (and which).\n- Why: one line, using the questions above.\n- Change: what would change (kind, wording, buttons, how long it stays, where it is kept).\nMark the ones that are already right. Mark the ones that could go either way and say what decides between them, as a question for me. Then list anything missing: an action that should offer Undo, a failure that only shows a toast, a background job that never says it is done, news with no place to find it again.\nThen ask me which rows to change and wait.\n\n4. Optional: restyle the toast and the notifications\nAfter the table, offer these as a separate choice, and wait for my answer:\nA. Restyle the toast only.\nB. Restyle the notifications only.\nC. Both.\nD. Neither; just fix the kinds and wording.\nFor each one I pick, show me a short before and after (values and motion), in my product's own colours and corners, and wait for my go-ahead before building.\n\n4A. Toast\n- Place: the top centre of the page, 12 under the top bar, over the content. One at a time.\n- Shape: 40 tall, 16 corners (or the nearest step in my corner scale), a white surface with a soft top-to-bottom gradient (#ffffff to #f7f9fc), a 1px border rgba(214, 219, 227, 0.95), and a soft shadow (0 16px 36px rgba(17, 24, 39, 0.08), 0 3px 10px rgba(17, 24, 39, 0.05)). Inner shapes are concentric with it: the icon, 8 in, is 24 with 8 corners; a button or the close, 6 in, is 28 with 10 corners.\n- Content: icon, then one line of 14/20 text, then the button and the close if there are any. The done icon is a check on a soft tile in my accent colour; work in progress is a ring; the time left to undo is a ring that empties, with the seconds in its centre. The button is accent-coloured text, with a tint only on hover. Keep the gaps tight: 8 between the icon and the text, the button and the close next to each other.\n- Enter: in 500ms on cubic-bezier(0.25, 0.1, 0.25, 1), the whole toast comes down from 10px above, grows from 96% and clears from an 8px blur; it is fully opaque a little before the end. Text and controls move with it as one piece, not letter by letter.\n- Leave: 220ms, ease-in: up 6px, blur 6px, fade out.\n- Sheen: a light band crosses it once (900ms, ease-out) only when something is done: a status toast as it enters, a progress toast as it turns into its result, an Undo toast after Undo. An action toast that still waits for a choice enters without it.\n- Change in place (progress to result, archived to restored): the old line (text, button and close together) blurs out and moves 5px up in 180ms; the new line blurs in from 5px below between 100 and 400ms; the toast takes its new width in 380ms on cubic-bezier(0.32, 0.72, 0, 1). Only the icon has a move of its own: the old one shrinks and blurs away while the new one turns in from -40 degrees and half size.\n- After Undo: the change is reverted, and the toast says so (\"Task restored\") for about 1.5 seconds before it leaves.\n- Timing: a status toast stays 3 to 5 seconds, longer for longer text; an action toast at least 5 seconds; a progress toast stays while the work runs, then 3 seconds. The timer pauses while the pointer is over the toast or focus is inside it.\n\n4B. Notifications\n- Place: the top right, 12 under the top bar, the same on every page, above the content. 344 wide.\n- Card: 24 corners with 12 of padding, so the picture (32, a person's photo or the product's logo) and the buttons (32 tall, 12 corners) are concentric with it. A title (14/20, semibold) with the time on the right, up to three lines of 13/20 text, then up to two buttons on the bottom right, the main one last.\n- A stack: the newest is in front. The older ones are cut to the front one's height and peek out 12 below it, at 95% and 90%, showing only their edge; at most three show.\n- A new one arrives: it slides down onto the stack from 56px above in 560ms on cubic-bezier(0.32, 0.72, 0, 1), clearing from a light blur, while the others are pushed down and back a step. The one it covers keeps its content until the new one is on its way over it, so it reads as stacking, not replacing.\n- Hover: the stack spreads into a list at the cards' own heights, 8 apart, in 380ms on the same curve. In the list each card keeps to a hairline and a light shadow, so no shadow falls on the card below; stacked, only the front card has the deep shadow.\n- Close one, as on macOS: a small close button (24, 10 corners) appears over a card's top-left corner while the pointer is on that card. Handling a card with one of its buttons also removes it. A removed card slides 48px to the right and fades in 260ms, and the ones below close the gap in 400ms. \"Clear all\" sits under the last card while the list is spread out.\n- Counts: the bell shows how many are waiting, and so does the page title, so a tab in the background shows it too. Notifications that need a decision (security, payments) stay in the list behind the bell even when they are cleared from the screen.\n\n4C. For both\n- Reduced motion: keep the change of state and a short fade (about 150ms); drop the movement, scaling and blur.\n- Screen readers: toasts are announced politely (role=\"status\"); a notification that needs attention is announced once as it arrives. Neither takes focus away from what the person is doing. Their buttons can be reached by keyboard, and Escape closes the one in focus.\n- Touch: the same places, with swipe to dismiss; there is no hover, so the stack spreads on tap.\n- Dark mode: the same rules on my dark surfaces; the sheen is fainter.\n\n5. Build what I pick\n- List the files you will touch and wait for my go-ahead.\n- Change one thing at a time and keep what each action does. Then check:\n  - Short and long text, a missing picture, many notifications at once, several toasts in a row.\n  - Undo used, ignored and closed; a progress that fails; leaving the page while something is still running.\n  - Phone and desktop layouts, light and dark, reduced motion, keyboard and screen reader.\n  - Existing tests still pass.\n- Web: CSS transitions or the Web Animations API for the toast; for the stack, measure each card's height and animate transform and height together. Sonner (React) has a similar stack and can be adapted, but ask before adding it. iOS, Android and Flutter: use the platform's own animation tools with the same values; for messages that reach people outside the app, use the system's notifications.","skill":"/skills/kubai-toast-or-notification/SKILL.md","skillText":"# Toast 与通知的选择与改造\n\n《999 个小技巧，让你 Vibe 的产品更有质感》第 016 期 · @kubai087\n\n在用户的项目里按下面的要求改造。要求以用户的口吻写成：文中的 I、me、my 指用户；写着要先问的地方，先停下来问用户再继续。\n\n## 改造要求\n\nReview how my product tells people that something happened, and decide for each message whether it should be a toast, a notification, or neither. Then, if I want it, restyle the toasts and notifications along the lines below. This is about judgment first: diagnose and recommend, and change only what I approve.\n\nThis is a change to my product, not a demo. Work inside my code, on my stack, with my components, tokens, corner scale, fonts and copy style. Do not add a dependency, a new state library or a new visual pattern without asking. Every value below is a default to start from.\n\n0. Read the product first\n- Find every place that shows a message about an event: toasts and snackbars, alerts and banners, notification lists, inbox or activity panels, badges and counts, inline success and error text, and browser or push notifications.\n- For each one, note: what triggers it (the person's own action, another person, the system, a background job), what it says, any buttons, where it appears, how long it stays, and whether it can be found again later.\n- Find the components behind them and where they are mounted (one per page, or one for the whole app). Note how they announce themselves to screen readers.\n- Tell me in a few lines what you found before going on.\n\n1. What each one is for\n- Toast: answers something the person just did, in the place they are working. It is short, it does not interrupt, and it goes away by itself. It comes in three kinds:\n  a. Status: confirms a result, so the person does not have to go and check. An icon and a few words, no buttons. Example: \"Link copied\".\n  b. Action: the action has already been done, and the toast holds the one step that may follow, usually Undo. One line and one button, plus a close. It stays long enough to use the button, with the time left shown.\n  c. Progress: work that takes a moment. It shows that the work is under way, then turns into the result in the same place, with a button to see it. Example: \"Uploading brand-guide.pdf\" turns into \"Uploaded to Files, Open\".\n- Notification: news the person did not cause just now, from other people or from the system: a mention, a reply, a payment, a deadline, a security alert, a finished report. It can carry more: a title, a few lines and up to two actions. It is shown on every page, stays until it is opened, handled or closed, and several can be shown at once. It is also kept somewhere the person can find it again (an inbox or a list behind a bell, with a count).\n- Neither:\n  - A form error or a problem with one field: show it next to the field.\n  - A failure the person has to fix (an upload that failed, a payment that did not go through): keep it on the item, with a way to fix it, until it is fixed. A toast that disappears after a few seconds is not enough.\n  - An action that cannot be undone: ask before doing it (a confirm next to the button, or a dialog for something with a large impact). A toast after the fact is too late.\n  - Something only worth seeing when the person looks: a badge, a dot or a change of state in place, with no message at all.\n\n2. Questions that settle a case\n- Who caused it? The person, just now: toast. Someone else, the system, or the person a while ago in another place: notification.\n- Does the person need to act? No: status toast. One quick step that may follow (Undo, View): action toast. A real decision or a reply: notification. Something that must be fixed: keep it on the item.\n- Can the action be undone? Then do it at once and offer Undo in a toast instead of asking first. If it cannot be undone, confirm before, not after.\n- How much is there to say? A few words: toast. A sentence or two, a name, an amount, a place: notification.\n- Would it matter if the person missed it? No: toast. Yes: notification, kept until handled.\n- Is the work still running when the person leaves? If it ends while they are still on the page, a toast is enough. If they have moved to another tab or app, a browser or system notification (with permission) is the only way to reach them; inside the product, it also goes into the notification list.\n- Several at once? Toasts: one at a time; a new one replaces the old one, or waits. Notifications: they stack.\n\n3. Report before changing anything\nGive me a table first, and do not change code yet. One row per message:\n- Where: the screen or component, and what triggers it.\n- Now: how it is shown today, in a few words.\n- Should be: status toast, action toast, progress toast, notification, or neither (and which).\n- Why: one line, using the questions above.\n- Change: what would change (kind, wording, buttons, how long it stays, where it is kept).\nMark the ones that are already right. Mark the ones that could go either way and say what decides between them, as a question for me. Then list anything missing: an action that should offer Undo, a failure that only shows a toast, a background job that never says it is done, news with no place to find it again.\nThen ask me which rows to change and wait.\n\n4. Optional: restyle the toast and the notifications\nAfter the table, offer these as a separate choice, and wait for my answer:\nA. Restyle the toast only.\nB. Restyle the notifications only.\nC. Both.\nD. Neither; just fix the kinds and wording.\nFor each one I pick, show me a short before and after (values and motion), in my product's own colours and corners, and wait for my go-ahead before building.\n\n4A. Toast\n- Place: the top centre of the page, 12 under the top bar, over the content. One at a time.\n- Shape: 40 tall, 16 corners (or the nearest step in my corner scale), a white surface with a soft top-to-bottom gradient (#ffffff to #f7f9fc), a 1px border rgba(214, 219, 227, 0.95), and a soft shadow (0 16px 36px rgba(17, 24, 39, 0.08), 0 3px 10px rgba(17, 24, 39, 0.05)). Inner shapes are concentric with it: the icon, 8 in, is 24 with 8 corners; a button or the close, 6 in, is 28 with 10 corners.\n- Content: icon, then one line of 14/20 text, then the button and the close if there are any. The done icon is a check on a soft tile in my accent colour; work in progress is a ring; the time left to undo is a ring that empties, with the seconds in its centre. The button is accent-coloured text, with a tint only on hover. Keep the gaps tight: 8 between the icon and the text, the button and the close next to each other.\n- Enter: in 500ms on cubic-bezier(0.25, 0.1, 0.25, 1), the whole toast comes down from 10px above, grows from 96% and clears from an 8px blur; it is fully opaque a little before the end. Text and controls move with it as one piece, not letter by letter.\n- Leave: 220ms, ease-in: up 6px, blur 6px, fade out.\n- Sheen: a light band crosses it once (900ms, ease-out) only when something is done: a status toast as it enters, a progress toast as it turns into its result, an Undo toast after Undo. An action toast that still waits for a choice enters without it.\n- Change in place (progress to result, archived to restored): the old line (text, button and close together) blurs out and moves 5px up in 180ms; the new line blurs in from 5px below between 100 and 400ms; the toast takes its new width in 380ms on cubic-bezier(0.32, 0.72, 0, 1). Only the icon has a move of its own: the old one shrinks and blurs away while the new one turns in from -40 degrees and half size.\n- After Undo: the change is reverted, and the toast says so (\"Task restored\") for about 1.5 seconds before it leaves.\n- Timing: a status toast stays 3 to 5 seconds, longer for longer text; an action toast at least 5 seconds; a progress toast stays while the work runs, then 3 seconds. The timer pauses while the pointer is over the toast or focus is inside it.\n\n4B. Notifications\n- Place: the top right, 12 under the top bar, the same on every page, above the content. 344 wide.\n- Card: 24 corners with 12 of padding, so the picture (32, a person's photo or the product's logo) and the buttons (32 tall, 12 corners) are concentric with it. A title (14/20, semibold) with the time on the right, up to three lines of 13/20 text, then up to two buttons on the bottom right, the main one last.\n- A stack: the newest is in front. The older ones are cut to the front one's height and peek out 12 below it, at 95% and 90%, showing only their edge; at most three show.\n- A new one arrives: it slides down onto the stack from 56px above in 560ms on cubic-bezier(0.32, 0.72, 0, 1), clearing from a light blur, while the others are pushed down and back a step. The one it covers keeps its content until the new one is on its way over it, so it reads as stacking, not replacing.\n- Hover: the stack spreads into a list at the cards' own heights, 8 apart, in 380ms on the same curve. In the list each card keeps to a hairline and a light shadow, so no shadow falls on the card below; stacked, only the front card has the deep shadow.\n- Close one, as on macOS: a small close button (24, 10 corners) appears over a card's top-left corner while the pointer is on that card. Handling a card with one of its buttons also removes it. A removed card slides 48px to the right and fades in 260ms, and the ones below close the gap in 400ms. \"Clear all\" sits under the last card while the list is spread out.\n- Counts: the bell shows how many are waiting, and so does the page title, so a tab in the background shows it too. Notifications that need a decision (security, payments) stay in the list behind the bell even when they are cleared from the screen.\n\n4C. For both\n- Reduced motion: keep the change of state and a short fade (about 150ms); drop the movement, scaling and blur.\n- Screen readers: toasts are announced politely (role=\"status\"); a notification that needs attention is announced once as it arrives. Neither takes focus away from what the person is doing. Their buttons can be reached by keyboard, and Escape closes the one in focus.\n- Touch: the same places, with swipe to dismiss; there is no hover, so the stack spreads on tap.\n- Dark mode: the same rules on my dark surfaces; the sheen is fainter.\n\n5. Build what I pick\n- List the files you will touch and wait for my go-ahead.\n- Change one thing at a time and keep what each action does. Then check:\n  - Short and long text, a missing picture, many notifications at once, several toasts in a row.\n  - Undo used, ignored and closed; a progress that fails; leaving the page while something is still running.\n  - Phone and desktop layouts, light and dark, reduced motion, keyboard and screen reader.\n  - Existing tests still pass.\n- Web: CSS transitions or the Web Animations API for the toast; for the stack, measure each card's height and animate transform and height together. Sonner (React) has a similar stack and can be adapted, but ask before adding it. iOS, Android and Flutter: use the platform's own animation tools with the same values; for messages that reach people outside the app, use the system's notifications.\n"}