mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
* 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>
118 lines
2.7 KiB
JavaScript
118 lines
2.7 KiB
JavaScript
import {addToast, Button} from "@heroui/react";
|
|
|
|
export default function App() {
|
|
return (
|
|
<div className="flex flex-wrap gap-2">
|
|
<Button
|
|
variant="flat"
|
|
onPress={() => {
|
|
addToast({
|
|
title: "Toast Title",
|
|
});
|
|
}}
|
|
>
|
|
Default
|
|
</Button>
|
|
|
|
<Button
|
|
variant="flat"
|
|
onPress={() => {
|
|
addToast({
|
|
title: "Toast Title",
|
|
description: "Toast Description",
|
|
});
|
|
}}
|
|
>
|
|
With Description
|
|
</Button>
|
|
|
|
<Button
|
|
variant="flat"
|
|
onPress={() => {
|
|
addToast({
|
|
title: "Toast Title",
|
|
description: "Toast Description",
|
|
hideIcon: true,
|
|
});
|
|
}}
|
|
>
|
|
Hidden Icon
|
|
</Button>
|
|
|
|
<Button
|
|
variant="flat"
|
|
onPress={() => {
|
|
addToast({
|
|
title: "Toast Title",
|
|
description: "Toast Description",
|
|
promise: new Promise((resolve) => setTimeout(resolve, 3000)),
|
|
});
|
|
}}
|
|
>
|
|
Promise (3000ms)
|
|
</Button>
|
|
|
|
<Button
|
|
variant="flat"
|
|
onPress={() => {
|
|
addToast({
|
|
title: "Toast Title",
|
|
description: "Toast Description",
|
|
endContent: (
|
|
<Button size="sm" variant="flat">
|
|
Upgrade
|
|
</Button>
|
|
),
|
|
});
|
|
}}
|
|
>
|
|
With endContent
|
|
</Button>
|
|
|
|
<Button
|
|
variant="flat"
|
|
onPress={() => {
|
|
addToast({
|
|
title: "Toast Title",
|
|
description: "Toast Description",
|
|
timeout: 3000,
|
|
shouldShowTimeoutProgess: true,
|
|
});
|
|
}}
|
|
>
|
|
Show Timeout Progress (3000ms)
|
|
</Button>
|
|
|
|
<Button
|
|
variant="flat"
|
|
onPress={() =>
|
|
addToast({
|
|
title: "Toast title",
|
|
description: "Toast displayed successfully",
|
|
icon: (
|
|
<svg height={24} viewBox="0 0 24 24" width={24}>
|
|
<g
|
|
fill="none"
|
|
stroke="currentColor"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeMiterlimit={10}
|
|
strokeWidth={1.5}
|
|
>
|
|
<path
|
|
d="M11.845 21.662C8.153 21.662 5 21.088 5 18.787s3.133-4.425 6.845-4.425c3.692 0 6.845 2.1 6.845 4.4s-3.134 2.9-6.845 2.9z"
|
|
data-name="Stroke 1"
|
|
/>
|
|
<path d="M11.837 11.174a4.372 4.372 0 10-.031 0z" data-name="Stroke 3" />
|
|
</g>
|
|
</svg>
|
|
),
|
|
})
|
|
}
|
|
>
|
|
Custom Icon
|
|
</Button>
|
|
</div>
|
|
);
|
|
}
|