JSPM

@workday/canvas-kit-react-toast

5.0.0-beta.1-next.6+33758d4b
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 151
  • Score
    100M100P100Q74200F
  • License Apache-2.0

A canvas styled toast component

Package Exports

  • @workday/canvas-kit-react-toast

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@workday/canvas-kit-react-toast) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Canvas Kit Toast

Canvas-styled React toast component. Allows for a brief message to be be shown about a process or action occurring in the app.

> Workday Design Reference

Installation

yarn add @workday/canvas-kit-react

or

yarn add @workday/canvas-kit-react-toast

Toast

Usage

Extends from the Popup component.

import * as React from 'react';
import {Popper} from '@workday/canvas-kit-react-popup';
import {Toast} from '@workday/canvas-kit-react-toast';

// We use Popper from Material UI for our positioning
<Popper placement={'top'} open={this.state.open} anchorElement={anchorEl}>
  <Toast onClose={this.handleClose}>{this.props.children}</Toast>
</Popper>;

Static Properties

Component Props

Required

Optional

onClose: () => void

Callback to handle close of your Toast and any other event when the Toast is closed.


onActionClick: () => void

Callback to handle an action link


actionText: string

The text to display for the link


transformOrigin: TransformOrigin

Origin from which the toast will animate from

Default:

{
  horizontal: 'center',
  vertical: 'top',
}

icon: CanvasSystemIcon

Pass whatever icon you'd like to display on the left side of the Toast You can import icons from

import {exclamationCircleIcon, checkIcon} from '@workday/canvas-system-icons-web';

iconColor: string

The color of the icon