Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More ā†’
Socket
Sign inDemoInstall
Socket

@chakra-ui/toast

Package Overview
Dependencies
Maintainers
2
Versions
687
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/toast

description

  • 6.1.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @chakra-ui/toast?

@chakra-ui/toast is a part of the Chakra UI library that provides a simple and customizable way to display toast notifications in a React application. It allows developers to show brief messages to users, such as success, error, warning, or informational messages, in a non-intrusive manner.

What are @chakra-ui/toast's main functionalities?

Basic Toast

This feature allows you to display a basic toast notification with a title, description, status, duration, and closable option.

import { useToast } from '@chakra-ui/react';

function Example() {
  const toast = useToast();

  return (
    <button
      onClick={() =>
        toast({
          title: 'Account created.',
          description: 'We've created your account for you.',
          status: 'success',
          duration: 5000,
          isClosable: true,
        })
      }
    >
      Show Toast
    </button>
  );
}

Custom Toast

This feature allows you to create a custom toast notification by rendering a custom component inside the toast.

import { useToast, Box, Button } from '@chakra-ui/react';

function CustomToast() {
  const toast = useToast();

  return (
    <Button
      onClick={() =>
        toast({
          position: 'bottom-left',
          render: () => (
            <Box color='white' p={3} bg='blue.500'>
              Hello World
            </Box>
          ),
        })
      }
    >
      Show Custom Toast
    </Button>
  );
}

Positioning Toasts

This feature allows you to position the toast notification at different locations on the screen, such as top-right, bottom-left, etc.

import { useToast, Button } from '@chakra-ui/react';

function PositionedToast() {
  const toast = useToast();

  return (
    <Button
      onClick={() =>
        toast({
          title: 'Notification',
          description: 'This is a toast notification.',
          status: 'info',
          position: 'top-right',
          duration: 3000,
          isClosable: true,
        })
      }
    >
      Show Positioned Toast
    </Button>
  );
}

Other packages similar to @chakra-ui/toast

Keywords

FAQs

Package last updated on 31 May 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc