For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
/
144
Sponsor

Toast

A toast notification with slide-in and auto-dismiss.

Changes savedYour profile has been updated.
Customize

Installation

$ pnpm dlx shadcn@latest add @framecn/toast

Usage

import { Toast } from "@/components/ui/toast";
<Toast
  title="Changes saved"
  description="Your profile has been updated."
  variant="success"
  state="visible"
/>

Smooth transitions

The docs preview moves a cursor to a trigger button, clicks it, then slides the toast in and auto-dismisses via useToastTransition. Pair it with useCursorPath and useButtonTransition:

import { H, W } from "@/lib/customizer-config";
import { Cursor } from "@/components/framecn/cursor";
import { useCursorPath } from "@/components/framecn/use-cursor-path";
import { Button } from "@/components/framecn/button";
import { useButtonTransition } from "@/components/framecn/use-button-transition";
import { Toast } from "@/components/framecn/toast";
import { useToastTransition } from "@/components/framecn/use-toast-transition";
 
const BTN_X = W / 2;
const BTN_Y = H / 2;
 
const cursorStyle = useCursorPath([
  { at: 0, x: 80, y: 60 },
  { at: 40, x: BTN_X, y: BTN_Y, duration: 28 },
  { at: 68, x: BTN_X, y: BTN_Y, click: true, duration: 0 },
]);
 
const buttonStyle = useButtonTransition([
  { at: 40, state: "hover", duration: 16 },
  { at: 62, state: "press", duration: 8 },
  { at: 76, state: "idle", duration: 10 },
]);
 
const toastStyle = useToastTransition([
  { at: 84, state: "visible", duration: 12 },
  { at: 144, state: "hidden", duration: 12 },
]);
 
<>
  <Button label="Show toast" style={buttonStyle} />
  <Toast
    title="Changes saved"
    description="Your profile has been updated."
    variant="success"
    style={toastStyle}
  />
  <Cursor style={cursorStyle} variant="pointer" />
</>;

Anchor the toast bottom-right in your scene. style takes precedence over state when both are provided.

API Reference

Toast

PropTypeDefault
state"hidden" | "visible""hidden"
styleToastStyle- (takes precedence over state)
titlestringrequired
descriptionstring-
variant"default" | "success" | "error""default"
themePartial<FramecnTheme>-
classNamestring-