Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

sileo-react-toastssileo React toasts 前端

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

994

周安装

41

GitHub Stars

公开资料未说明

下载量

325
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sileo-react-toasts(sileo React toasts 前端)
来源仓库:https://github.com/xoverlap/sileo-skill
仓库路径:skills/sileo-react-toasts
安装命令:
npx skills add https://github.com/xoverlap/sileo-skill --skill sileo-react-toasts
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/xoverlap/sileo-skill --skill sileo-react-toasts

简介

sileo-react-toasts 用于辅助前端页面、组件和样式开发,适合生成或审查 React 相关代码。

  • 它能帮助整理组件结构,提升前端开发效率。
  • 使用时需结合项目现有设计系统和构建方式,避免生成孤立片段;涉及页面改动时应配合本地预览确认效果。
  • 通过 npx skills add 命令从 GitHub 仓库安装,具体用法可参考原始 README 文档。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

SKILL: Sileo (React Toast Notifications)

Official documentation: https://sileo.aaryan.design/docs API Reference: https://sileo.aaryan.design/docs/api Toaster API: https://sileo.aaryan.design/docs/api/toaster Styling Guide: https://sileo.aaryan.design/docs/styling Playground: https://sileo.aaryan.design/play GitHub: https://github.com/hiaaryan/sileo

What is Sileo?

Sileo is a tiny, opinionated, physics-based toast component for React. It uses gooey SVG morphing (via an feGaussianBlur + feColorMatrix filter chain) and spring animations (powered by motion/react, formerly Framer Motion) to create buttery-smooth notifications that look beautiful by default with zero configuration.

Sileo is not a general-purpose notification center. It is a highly polished, visually distinctive toast system designed for single-line feedback messages with optional expandable descriptions.

Key characteristics:

  • Framework: React only (ships with "use client" directive for Next.js App Router compatibility)
  • Peer dependency: motion (spring physics engine, motion/react)
  • Architecture: SVG-based rendering with gooey blob morphing between pill (collapsed) and card (expanded) states
  • TypeScript-first: All types are exported (SileoOptions, SileoPosition, SileoState, SileoStyles, SileoButton)
  • Accessibility: Uses aria-live="polite" on viewport sections, respects prefers-reduced-motion
  • Swipe-to-dismiss: Built-in pointer-event-based vertical swipe gesture (30px threshold)

Installation

npm install sileo

Sileo requires react and motion as peer dependencies.


Quick Setup

  1. Mount <Toaster /> once at your app's root layout.
  2. Fire toasts from anywhere by importing sileo.
import { sileo, Toaster } from "sileo";

export default function App() {
  return (
    <>
      <Toaster position="top-right" />
      <YourApp />
    </>
  );
}
Because sileo ships with "use client", it works seamlessly in Next.js App Router without extra wrappers.

Basic Usage

Sileo exposes a global controller sileo with state-specific shortcuts:

import { sileo } from "sileo";

// State shortcuts (each returns the toast `id` as a string)
sileo.success({ title: "Saved", description: "Your changes were stored." });
sileo.error({ title: "Failed", description: "Could not save." });
sileo.warning({ title: "Warning", description: "Disk space low." });
sileo.info({ title: "Tip", description: "Try the new feature." });

// Generic toast (defaults to success, but accepts `type` for dynamic state)
sileo.show({ title: "Done", type: "success" });

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

All sileo Methods

MethodReturnsDescription
sileo.success(options)string (id)Green success toast
sileo.error(options)string (id)Red error toast
sileo.warning(options)string (id)Amber warning toast
sileo.info(options)string (id)Blue info toast
sileo.action(options)string (id)Toast with an action button
sileo.show(options)string (id)Generic toast. Uses options.type for state, defaults to "success"
sileo.promise(promise, opts)Promise<T>Loading -> success/error flow. Returns the original promise
sileo.dismiss(id)voidDismiss a specific toast by id
sileo.clear(position?)voidClear all toasts, or only those at a specific position

SileoOptions

Passed to every sileo.*() call.

PropTypeDefaultDescription
titlestring--Toast heading (displayed in the pill)
description`ReactNode \string`--Body content (shown when expanded). Accepts JSX for rich content
typeSileoState--Dynamic state for sileo.show(). One of `"success" \"loading" \"error" \"warning" \"info" \"action"`
positionSileoPositionToaster defaultOverride position for this individual toast
duration`number \null`6000Auto-dismiss in milliseconds. null = sticky (never auto-dismisses)
icon`ReactNode \null`State iconCustom icon replacing the default in the badge circle
fillstring"#FFFFFF"SVG fill color for the toast background shape
stylesSileoStyles--CSS class overrides for sub-elements
roundnessnumber16Border radius in pixels for the SVG shapes
autopilot`boolean \{expand?: number; collapse?: number}`trueAuto expand/collapse timing. false = hover only
buttonSileoButton--Action button configuration

Action Toast

Action toasts include a clickable button inside the expanded area:

sileo.action({
  title: "New version available",
  description: "Reload to update",
  button: {
    title: "Reload",
    onClick: () => window.location.reload(),
  },
});

SileoButton

interface SileoButton {
  title: string;
  onClick: () => void;
}

Promise Toast

sileo.promise chains loading -> success/error states from a single promise. It returns the original promise so you can chain further.

  • The first argument can be a Promise<T> or a function () => Promise<T> (useful for lazy execution).
  • success and error can be static options or callbacks that receive the resolved/rejected value.
  • The optional action field, when provided, replaces the success toast with an action-state toast.
type User = { name: string };

const result = await sileo.promise<User>(createUser(data), {
  loading: { title: "Creating account..." },
  success: (user) => ({
    title: `Welcome, ${user.name}!`,
  }),
  error: (err: any) => ({
    title: "Signup failed",
    description: err?.message ?? "Unknown error",
  }),
});
// `result` is the resolved User object

With lazy promise (function):

sileo.promise(() => fetch("/api/data").then((r) => r.json()), {
  loading: { title: "Fetching data..." },
  success: { title: "Data loaded" },
  error: { title: "Failed to load" },
});

With action replacing success:

sileo.promise<{ url: string }>(uploadFile(file), {
  loading: { title: "Uploading..." },
  success: { title: "Uploaded" }, // Ignored when `action` is present
  error: { title: "Upload failed" },
  action: (data) => ({
    title: "File ready",
    description: "Click to open",
    button: {
      title: "Open",
      onClick: () => window.open(data.url),
    },
  }),
});

SileoPromiseOptions<T>

interface SileoPromiseOptions<T = unknown> {
  loading: SileoOptions;
  success: SileoOptions | ((data: T) => SileoOptions);
  error: SileoOptions | ((err: unknown) => SileoOptions);
  action?: SileoOptions | ((data: T) => SileoOptions);
  position?: SileoPosition;
}

Positions

Six positions available. Set a default on <Toaster />, or override per toast:

type SileoPosition =
  | "top-left"
  | "top-center"
  | "top-right"     // default
  | "bottom-left"
  | "bottom-center"
  | "bottom-right";
<Toaster position="bottom-center" />

// Override for a specific toast
sileo.success({ title: "Saved", position: "top-left" });

The SILEO_POSITIONS constant array is also exported for iteration:

import { SILEO_POSITIONS } from "sileo"; // Not exported from index (internal)

Toaster (Viewport Component)

<Toaster /> is the viewport component that renders toasts. Add it once at your root layout.

import { Toaster } from "sileo";

Props

PropTypeDefaultDescription
childrenReactNode--App content to render alongside toasts
positionSileoPosition"top-right"Default position for all toasts
offset`number \string \{top?, right?, bottom?, left?}`--Distance from viewport edges
optionsPartial<SileoOptions>--Default options merged into every toast
theme`"light" \"dark" \"system"`--Automatic fill based on color scheme. "system" follows OS preference

Theme

The theme prop automatically sets the toast fill color based on the selected scheme, saving you from manually configuring dark/light fills:

  • "light" -> fill is #1a1a1a (dark toast on light backgrounds) + light description text
  • "dark" -> fill is #f2f2f2 (light toast on dark backgrounds) + dark description text
  • "system" -> Follows prefers-color-scheme media query, reactively updates on OS change
<Toaster position="top-right" theme="system" />

When theme is set, the viewport renders data-theme="light" or data-theme="dark" which CSS uses to auto-style description text opacity.

If you set both theme and fill on individual toasts, the per-toast fill takes precedence.

Offset

Accepts a number (px), a CSS string, or a per-side object:

<Toaster offset={20} />
<Toaster offset="1.5rem" />
<Toaster offset={{ top: 20, right: 16 }} />

Default Options (global)

<Toaster
  options={{
    fill: "#171717",
    styles: { description: "text-white/75!" },
  }}
/>

Every toast will inherit these defaults. Per-toast options override them. The styles object is shallow-merged (per-toast styles overlay global styles).


Styling

Sileo looks great out of the box. When customization is needed, there are several escape hatches.

Fill Color

fill sets the SVG background color of the toast shape. Default: "#FFFFFF".

For dark toasts, use a dark fill and pair it with light text via styles:

sileo.success({
  title: "Dark toast",
  fill: "#171717",
  styles: {
    title: "text-white!",
    description: "text-white/75!",
  },
});

Style Overrides (styles)

Override CSS classes on individual sub-elements. When using Tailwind, add ! for specificity.

SileoStyles

interface SileoStyles {
  title?: string;       // The heading text
  description?: string; // The body/description area
  badge?: string;       // The icon badge circle
  button?: string;      // The action button
}

Available Data-Attribute Selectors

KeyElementCSS Selector
titleHeading text[data-sileo-title]
descriptionBody/description area[data-sileo-description]
badgeIcon badge circle[data-sileo-badge]
buttonAction button[data-sileo-button]

Additional data-attributes available for CSS targeting:

SelectorDescription
[data-sileo-toast]The outermost toast element (a <button>)
[data-sileo-toast][data-state="success"]Toast filtered by state
[data-sileo-toast][data-expanded="true"]Expanded toast
[data-sileo-toast][data-exiting="true"]Toast in exit animation
[data-sileo-viewport]The fixed viewport <section>
[data-sileo-viewport][data-position="top-right"]Viewport filtered by position
[data-sileo-viewport][data-theme="dark"]Viewport with theme applied
[data-sileo-canvas]The SVG canvas wrapper
[data-sileo-svg]The inner SVG element
[data-sileo-pill]Animated collapsed pill rect
[data-sileo-body]Animated expanded body rect
[data-sileo-header]The header row container
[data-sileo-content]The expandable content area

Example: Full dark theme with Tailwind

sileo.success({
  title: "Custom styled",
  fill: "black",
  styles: {
    title: "text-white!",
    description: "text-white/75!",
    badge: "bg-white/20!",
    button: "bg-white/10!",
  },
});

Custom Icons

Pass any React node as icon to replace the default state icon:

sileo.info({
  title: "Custom icon",
  icon: <MyIcon />,
});

Pass icon: null to render no icon at all.

Default icons by state (Lucide-style SVG inlined):

  • success -> checkmark
  • error -> X
  • warning -> circle with exclamation
  • info -> life buoy
  • loading -> spinning circle (CSS animation)
  • action -> arrow right

Custom Description (JSX)

description accepts JSX, enabling rich content inside the expanded area:

sileo.info({
  title: "Rich content",
  description: (
    <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
      <span>Multiple elements supported</span>
      <img src="/preview.png" alt="Preview" width={120} />
    </div>
  ),
});

Roundness

Control the border radius via roundness (default 16):

sileo.success({ title: "Sharp", roundness: 8 });   // Sharper corners
sileo.success({ title: "Pill", roundness: 24 });    // More pill-like
Performance: Higher roundness increases the SVG blur radius for the gooey morph effect (blur = roundness * 0.5), which is more expensive to render. The recommended value is 16.

Autopilot

By default, toasts auto-expand after ~150ms and collapse ~4 seconds before dismissing. Control this behavior:

// Disable entirely (hover to expand, click away to collapse)
sileo.info({ title: "Manual", autopilot: false });

// Custom timing (milliseconds)
sileo.info({
  title: "Custom timing",
  autopilot: { expand: 250, collapse: 300 },
});

Internal defaults (derived from DEFAULT_TOAST_DURATION of 6000ms):

  • AUTO_EXPAND_DELAY = 150ms (6000 * 0.025)
  • AUTO_COLLAPSE_DELAY = 4000ms (6000 - 2000)

When autopilot is false or duration is null/0, auto expand/collapse is disabled.

Dismiss / Clear

// Dismiss a specific toast
const id = sileo.success({ title: "Will dismiss" });
sileo.dismiss(id);

// Clear all toasts
sileo.clear();

// Clear only toasts at a specific position
sileo.clear("bottom-center");

Toasts can also be swiped vertically (30px threshold) to dismiss them. This is built-in pointer-event swipe gesture behavior.

Sticky Toasts

Set duration: null to prevent auto-dismissal. The toast stays until dismissed programmatically or swiped:

sileo.warning({
  title: "Requires attention",
  description: "This won't go away on its own.",
  duration: null,
});

Global Defaults (Consistent Dark Theme)

<Toaster
  position="top-right"
  options={{
    fill: "#171717",
    roundness: 16,
    styles: {
      title: "text-white!",
      description: "text-white/75!",
      badge: "bg-white/10!",
      button: "bg-white/10! hover:bg-white/15!",
    },
  }}
/>

CSS Variables

Sileo exposes CSS custom properties for global overrides. Override them in :root or any parent element:

:root {
  /* State colors (oklch format) */
  --sileo-state-success: oklch(0.723 0.219 142.136);
  --sileo-state-loading: oklch(0.556 0 0);
  --sileo-state-error: oklch(0.637 0.237 25.331);
  --sileo-state-warning: oklch(0.795 0.184 86.047);
  --sileo-state-info: oklch(0.685 0.169 237.323);
  --sileo-state-action: oklch(0.623 0.214 259.815);

  /* Dimensions */
  --sileo-width: 350px;
  --sileo-height: 40px;

  /* Animation */
  --sileo-duration: 600ms;
}

Example: custom brand success color:

:root {
  --sileo-state-success: oklch(0.7 0.2 200);
}

Internal CSS Variables (per-toast, set via inline styles)

These are computed per-toast and set as CSS custom properties on [data-sileo-toast]:

VariableDescription
--_hCurrent toast height (collapsed or expanded)
--_pwPill width
--_pxPill X offset
--_htHeader transform (translate + scale)
--_coContent opacity (0 or 1)

Internal Color Variables (per-state, set via CSS)

VariableDescription
--sileo-toneThe resolved state color for badge/title
--sileo-tone-bgThe state color at 20% opacity for badge background
--sileo-btn-colorButton text color (equals state color)
--sileo-btn-bgButton background (state color at 15%)
--sileo-btn-bg-hoverButton hover background (state color at 25%)

TypeScript Exports

All types are exported from "sileo":

import type {
  SileoButton,
  SileoOptions,
  SileoPosition,
  SileoState,
  SileoStyles,
} from "sileo";

// SileoState = "success" | "loading" | "error" | "warning" | "info" | "action"

The SileoPromiseOptions<T> type is also exported from the toast module.


Accessibility

  • The viewport uses <section> with aria-live="polite" so screen readers announce new toasts without interrupting the user.
  • The toast root element is a <button> for keyboard focusability.
  • Each SVG icon has a <title> element for screen reader labeling.
  • Sileo respects prefers-reduced-motion: reduce by disabling all animations and transitions when the OS preference is set.

Architecture (Internal Details)

Understanding Sileo's internals helps when debugging or deeply customizing:

  1. Global store: A module-level singleton (store) holds all active toasts and notifies React via a listener Set. The Toaster component subscribes to this store and re-renders when toasts change.
  2. Toast IDs: When no id is provided by the user, toasts use "sileo-default" as their id. This means calling sileo.success(...) repeatedly without an id will replace the previous toast (same-id update behavior). Provide a unique id for multiple simultaneous toasts of the same state.
  3. SVG Gooey Effect: Each toast renders an <svg> with:

- A <filter> containing feGaussianBlur (stdDeviation = roundness * 0.5) + feColorMatrix + feComposite - Two <motion.rect> elements (pill + body) animated via motion/react spring transitions - The gooey filter creates the organic blob-merging effect between pill and expanded card

  1. Spring Physics: Animations use motion/react's spring transition with bounce: 0.25 and computed duration (default 0.6s). CSS transitions use a linear() easing approximation of the same spring curve.
  2. Expand Direction: Toasts at top-* positions expand downward; toasts at bottom-* positions expand upward (via CSS scaleY(-1) transform on the canvas).
  3. Timer Management: Each Toaster instance manages auto-dismiss timers per toast. Hovering over any toast pauses all timers; leaving resumes them. This hover-pause behavior is Toaster-level, not per-toast.
  4. Header Morphing: When a toast's state changes (e.g., loading -> success via promise), the header performs a blur-based crossfade animation between the old and new state, using two stacked layers (current + prev).

Integration Checklist

  • Install sileo (and ensure motion peer dep is available)
  • Mount one <Toaster /> at the root layout
  • Use sileo.success/error/warning/info/show/action based on context
  • For async flows, prefer sileo.promise(...)
  • For theming, either use theme prop or manual fill + styles + CSS variables
  • For programmatic dismissal, use dismiss(id) or clear(...)
  • Provide unique id values when multiple toasts should coexist simultaneously

Common Patterns

Form submission feedback

const handleSubmit = async (data: FormData) => {
  await sileo.promise(saveForm(data), {
    loading: { title: "Saving..." },
    success: { title: "Form saved" },
    error: (err: any) => ({
      title: "Save failed",
      description: err?.message,
    }),
  });
};

Undo action toast

const id = sileo.action({
  title: "Item deleted",
  description: "This action can be undone",
  duration: 8000,
  button: {
    title: "Undo",
    onClick: () => {
      restoreItem(itemId);
      sileo.dismiss(id);
    },
  },
});

Multiple simultaneous toasts

// Use unique ids to prevent replacement
sileo.info({ title: "Downloading file 1...", id: "download-1", duration: null });
sileo.info({ title: "Downloading file 2...", id: "download-2", duration: null });

// Dismiss individually
sileo.dismiss("download-1");
sileo.dismiss("download-2");

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.99%
按下载量换算107

Claude

31.62%
按下载量换算103

Cursor

19.28%
按下载量换算63

Gemini CLI

9.78%
按下载量换算32

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills