Socket
Socket
Sign inDemoInstall

@paprika/toast

Package Overview
Dependencies
102
Maintainers
4
Versions
161
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @paprika/toast

Toast component is a controlled or uncontrolled component that provides a easy way to commmunicate to users regarding success, warning, info, and error messages.


Version published
Weekly downloads
4.2K
increased by0.79%
Maintainers
4
Install size
3.40 MB
Created
Weekly downloads
 

Readme

Source

@paprika/toast

Description

Toast component is a controlled or uncontrolled component that provides a easy way to commmunicate to users regarding success, warning, info, and error messages.

Installation

yarn add @paprika/toast

or with npm:

npm install @paprika/toast

Props

Toast

PropTyperequireddefaultDescription
autoCloseDelaynumberfalse5000Duration (in ms) before Toast will automatically close (if canAutoClose is true).
canAutoCloseboolfalsefalseWill automatically call onClose() after 5000ms (or longer if provided by autoCloseDelay). If uncontrolled, it will automatically close the Toast as well.
childrennodefalsenullContent of the Toast.
hasCloseButtonboolfalsetrueIf the component should have a 'close' button.
isOpenboolfalseundefinedHow "controlled" Toast is shown / hidden.
isFixedboolfalsefalseIf the Toast is fixed to the top of the viewport. This will render the Toast as a Portal.
isPoliteboolfalsefalseA11y: If the Toast is polite (will wait until screen reader is finished before speaking) or assertive (will interrupt immediately).
kind[ Toast.types.kind.SUCCESS, Toast.types.kind.WARNING, Toast.types.kind.ERROR, Toast.types.kind.INFO, Toast.types.kind.LOCKED, Toast.types.kind.VISUALLY_HIDDEN]falseToast.types.kind.INFODetermines the styling of the Toast.
onClosefuncfalse() => {}Callback that is executed after clicking the 'close' button.
renderDelaynumberfalse20Delay in ms before content of Toast is rendered (to improve UX with screen readers).
zIndexnumberfalsenullThe z-index of the Toast.

Usage

Please use <L10n /> component to wrap <Toast /> in your application.

Example:

import Toast from "@paprika/toast";
import L10n from "@paprika/l10n";

<L10n locale="en">
  <Toast>Notification</Toast>;
</L10n>;

Note: An uncontrolled Toast is expected to be displayed and opened once, if the desired behavior is to display the Toast more than once, an alternative method is to reset the Toast by updating its key or use a controlled Toast component instead.

  • Storybook Showcase
  • GitHub source code
  • Create GitHub issue
  • CHANGELOG

FAQs

Last updated on 06 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc