【问题标题】:How to add a link to Chakra UI toast?How to add a link to Chakra UI toast?
【发布时间】:2022-12-01 23:17:29
【问题描述】:

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?

【问题讨论】:

    标签: javascript reactjs typescript next.js chakra-ui


    【解决方案1】:

    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>
      )
    }
    

    【讨论】:

      猜你喜欢
      • 2022-12-02
      • 2022-12-02
      • 2022-12-19
      • 2011-04-06
      • 2022-12-01
      • 2018-10-17
      • 2022-12-02
      • 2022-11-09
      • 2023-02-01
      相关资源
      最近更新 更多