DocsComponentsTemplatesThemesGitHub

Toaster

Toast region (bottom-right). Pair with the `toast()` function.

Code

import * as React from 'react';
import { Button, Toaster, toast } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div>
      <Button
        variant="gray"
        onClick={() =>
          toast({
            title: 'Saved to library',
            description: 'Morning Focus',
          })
        }
      >
        Show toast
      </Button>
      <Toaster />
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { Toaster } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/toaster.json

Guidelines

  • Mount once near the root. static renders inline (docs).

Props

PropTypeRequired
maxnumberNo
staticbooleanNo
itemsToastProps[]No
classNamestringNo

Edit this example on GitHub