Skip to content

Feedback

Toast

A short message that comes and goes by itself: a change saved, an upload done.

    Installation

    Terminal
    pnpm add @elsikora/keystone-ui-kit

    Usage

    Import
    import { Toast, ToastAction } from "@elsikora/keystone-ui-kit";
    docs/toast/default.example.tsx
    import { useState } from "react";import {  Button,  Toast,  ToastClose,  ToastDescription,  ToastProvider,  ToastTitle,  ToastViewport,} from "@elsikora/keystone-ui-kit";
    export default function ToastDefaultExample() {  const [open, setOpen] = useState<boolean>(false);
      return (    <ToastProvider>      <Button        variant="outline"        onClick={(): void => {          setOpen(true);        }}      >        Save      </Button>      <Toast open={open} onOpenChange={setOpen}>        <ToastTitle>Saved</ToastTitle>        <ToastDescription>The limits apply to new rounds.</ToastDescription>        <ToastClose />      </Toast>      <ToastViewport />    </ToastProvider>  );}

    Examples

    Default

      Failure

        API reference

        Toast

        PropTypeDefaultDescription
        variant"default" | "destructive""default"A failure is announced at once.
        openboolean-Shown, when the caller holds the state.
        onOpenChange(open: boolean) => void-Called when it shows or goes.
        durationnumber5000Milliseconds before it goes.

        ToastAction

        PropTypeDefaultDescription
        altTextstring-How to do the same without the toast.

        Notes

        • F8 moves the focus to the toasts; Escape closes one. Never put the only way to do something in a toast.