Innate UIv0.1.0
Feedback

Toast

Transient, non-blocking feedback delivered through the Innate provider.

Example

The preview is interactive. The code below it is the docs demo source; demo-only layout classes can be omitted in application code.

tsx
import { Button, Toast } from "innate-ui";
import { Icon } from "@/docs/icons/Icon";

export function ToastDemo() {
  const { showToast } = Toast.useToast();

  const showNotification = () => {
    void showToast({
      content: (
        <>
          <Toast.Icon>
            <Icon name="statusSuccess" />
          </Toast.Icon>
          <Toast.Content>
            <strong>Toast created</strong>
            <span>This is a toast notification.</span>
          </Toast.Content>
        </>
      ),
      duration: 4000,
      tone: "success",
    });
  };

  return <Button onClick={showNotification}>Give me a toast</Button>;
}

API reference

This table is generated from Innate UI's exported TypeScript declarations and JSDoc. Native element attributes inherited by a prop type are not repeated here.

ToastOptions

PropTypeDefault
contentrequired

Toast content.

JSX.Children
duration

Lifetime in milliseconds. Use `null` to keep the toast open until dismissed.

JSX.ValueOrCell<number | null>
tone

Visual and semantic tone of the toast.

JSX.ValueOrCell<ToastTone>"neutral"
onClick

Called when the toast is activated by pointer or keyboard.

(event: MouseEvent | KeyboardEvent) => void

InnateProviderProps

PropTypeDefault
childrenrequired

Application content that can use Innate's shared services.

JSX.Children
tooltipDelay

Delay in milliseconds before the first tooltip opens.

number350
tooltipSkipDelay

Warm period in milliseconds during which subsequent tooltips open immediately.

number300
Inspect the typed source →