chore(ui): added API reference comments for Toast component (#7129)

This commit is contained in:
Shahed Nasser
2024-04-23 13:25:06 +02:00
committed by GitHub
parent 14748755ee
commit cfd765bece
5 changed files with 139 additions and 9 deletions
@@ -14,13 +14,49 @@ interface ToastComponentProps {
dismissLabel?: string
}
/**
* This component is based on the [Sonner](https://sonner.emilkowal.ski/toast) toast library.
*/
export const Toast = ({
/**
* Optional ID of the toast.
*/
id,
/**
* @ignore
*
* @privateRemarks
* As the Toast component is created using
* the `toast` utility functions, the variant is inferred
* from the utility function.
*/
variant = "info",
/**
* @ignore
*
* @privateRemarks
* The `toast` utility functions accept this as a parameter.
*/
title,
/**
* The toast's text.
*/
description,
/**
* The toast's action buttons.
*/
action,
/**
* @ignore
*
* @privateRemarks
* The `toast` utility functions don't allow
* passing this prop.
*/
onDismiss,
/**
* The label of the dismiss button, if available.
*/
dismissLabel = "Close",
}: ToastComponentProps) => {
const hasActionables = !!action || onDismiss
@@ -18,10 +18,28 @@ interface ToasterProps
| "toastOptions"
> {}
/**
* This component is based on the [Toaster component of the Sonner library](https://sonner.emilkowal.ski/toaster).
*/
const Toaster = ({
/**
* The position of the created toasts.
*/
position = "bottom-right",
/**
* The gap between the toast components.
*/
gap = 12,
/**
* The space from the edges of the screen.
*/
offset = 24,
/**
* The time in milliseconds that a toast is shown before it's
* automatically dismissed.
*
* @defaultValue 4000
*/
duration,
...props
}: ToasterProps) => {