nextui/apps/docs/content/components/toast/custom-close-icon.raw.jsx
Maharshi Alpesh d64fcc8389
feat(toast): introduce Toast component (#4437)
* feat: initial commit

* chore: adding the animation

* chore: nits

* chore: fixes and adding draft1 of stories

* chore: adding the docs draft

* chore: adding the swiping interaction for toast removal

* chore: adding the tests

* fix: improving the progress bar logix

* chore: refactoring and refining the animations

* fix: making the animations compatible with the positons

* chore: fixing the styles

* chore: modifying the animations

* chore: improving the animations

* chore: adding the decorator to the story-book

* chore: fixing the animations and positions

* fix: handle expand region on touch

* feat: adding the promises support

* chore: updating the styles

* chore: improving styles

* chore: styles correction

* fix: adding junior's suggestions

* chore: correcting styles

* fix: fixing the timer behavior

* chore: adding the spinner to the toast

* chore: full width for mobile

* chore: modifying styles

* chore: fixing the positions on smaller devices

* chore: adding story with description

* chore: adding credits for sonner

* fix: adding junior's suggestions

* chore: adding the exit animation

* fix: adding junior's suggestions

* chore: improving the swipe animations

* fix: fixing the swipe animations on touch

* chore: adding tests

* chore: adding swipe threshild and initial position variable

* fix: fixing autoclose in timeout

* chore: modifying the docs

* chore: fixing the conflict

* chore: adding marcus' suggestions

* chore: adding the bottom animations

* chore: modying docs

* chore: removing nextui references

* chore: adding info about the provider

* chore: updating the docs

* chore: versions in package.json

* chore: nits

* chore: adding junior's suggestions

* chore: nits

* fix: applying junior's suggestions

* chore: adding junior's suggestions

* chore: using domMax

* fix: adding Marcus's suggestions

* chore: add global toast props and custom close icon

* chore: adding the defaultTimout provider prop

* chore: modifying defaultTimeout

* chore: nits

* fix: adding Marcus' suggestions

* chore: fixing bg

* chore(deps): bump RA deps

* fix: fixing the color discrepancy due to the timer

* chore: moving the kapan ai to the left side

* refactor(toast): update author

* chore: nit

* chore: improvements

* chore: updating the solid variant

---------

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
Co-authored-by: WK Wong <wingkwong.code@gmail.com>
2025-02-11 10:01:46 -03:00

45 lines
997 B
JavaScript

import {addToast, Button} from "@heroui/react";
const CustomToastComponent = () => {
return (
<Button
variant="flat"
onPress={() => {
addToast({
hideIcon: true,
title: "Toast Title",
description: "Toast Description",
classNames: {
closeButton: "opacity-100 absolute right-4 top-1/2 -translate-y-1/2",
},
closeIcon: (
<svg
fill="none"
height="32"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
viewBox="0 0 24 24"
width="32"
>
<path d="M18 6 6 18" />
<path d="m6 6 12 12" />
</svg>
),
});
}}
>
Show Toast
</Button>
);
};
export default function App() {
return (
<div className="flex gap-2">
<CustomToastComponent />
</div>
);
}