🍞 Toast Notification Generator
📐 工作原理與說明
切換型別時把背景色設為該型別預設色;之後修改文案、圓角、背景色或點「生成」都保留當前背景色,不按焦點位置回寫預設色。樣式:padding 14px 20px、border-radius = 圓角 px、background = 背景色、color 按背景相對亮度自動選擇黑/白中對比度更高者、flex 橫排、gap 10px、box-shadow 0 4px 12px rgba(0,0,0,0.15);圖示取該型別預設圖示,右側關閉按鈕點選即移除整個提示條
Toast 提示 = 圖示 + 文案 + 配色 + 圓角;按型別拼裝 CSS 樣式片段,用於訊息提示外觀。
Visually configure toast type, message, corner radius and background colour, then generate the matching CSS style code with live preview for quick message-notification styling.
📚 深度解析:Toast 提示生成器
💡 常見使用場景
- 操作成功提示。
- 錯誤反饋。
- 訊息通知。
生成成功 Toast
輸入:文字「已儲存」、成功型別(綠色)、圓角 8px。處理:拼出 .toast 的配色、圓角、內邊距與圖示樣式。輸出:CSS 與預覽。
❓ 常見問題(FAQ)
- 自動消失?
- 樣式生成;自動關閉需少量 JS 控制定時器。
- 位置怎麼定?
- 本工具只生成 Toast 的樣式(配色、圓角、圖示),不輸出定位或動畫程式碼;把下方 CSS 套進你頁面裡已用 fixed 定位好的容器即可自定位置。
- 會儲存或上傳我的內容嗎?
- 結果以瀏覽器即時計算為準,純前端本地處理、資料不上傳;生成的樣式與程式碼僅作快速產出參考,正式專案請以設計系統、規範與瀏覽器實測為準。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Announcement semantics | non-urgent messages use role=status with aria-live polite | WAI-ARIA 1.2 |
| Display duration | auto-dismissing toasts linger 4 to 8 seconds and can be extended | WCAG 2.2 (2.2.1) |
| Focus handling | toasts must not steal focus or cover the active control | WAI-ARIA Authoring Practices |
⚠️ 使用說明與注意事項
- 本工具純前端執行,資料不會上傳到伺服器
- 建議在主流瀏覽器(Chrome/Safari/Firefox/Edge)中使用
- 計算結果僅供參考,請以實際應用場景為準