简体   繁体   中英

How to add a link to Chakra UI toast?

I am using Chakra UI in my Next.js project. Is it possible to add links to a Chakra UI toast, or even format the text inside it? If yes, how?

yes, read the official documentation

You can add a custom render component

function CustomToastExample() {
  const toast = useToast()
  return (
    <Button
      onClick={() =>
        toast({
          position: 'bottom-left',
          render: () => (
            <Box color='white' p={3} bg='blue.500'>
              <YOUR_LINK_HERE>
            </Box>
          ),
        })
      }
    >
      Show Toast
    </Button>
  )
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM