From 6cc1e85eebe3d8e63aa87ebd206a1361b710e80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= Date: Tue, 23 Jul 2024 22:59:10 +0200 Subject: [PATCH] improve toast docs (#823) --- docs/library/overlay/toast.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/library/overlay/toast.md b/docs/library/overlay/toast.md index d3a27257d..d4ca9181c 100644 --- a/docs/library/overlay/toast.md +++ b/docs/library/overlay/toast.md @@ -54,7 +54,7 @@ rx.vstack( ### Customization -If the presets don't fit your needs, you can customize the toast by passing to `rx.toast` some kwargs. +If the presets don't fit your needs, you can customize the toasts by passing to `rx.toast` or to `rx.toast.options` some kwargs. ```python demo rx.button( @@ -66,4 +66,21 @@ rx.button( style={"background-color": "green", "color": "white", "border": "1px solid green"} ) ) -``` \ No newline at end of file +``` + +The following props are available for customization: + +- `description`: `str | Var`: Toast's description, renders underneath the title. +- `close_button`: `bool`: Whether to show the close button. +- `invert`: `bool`: Dark toast in light mode and vice versa. +- `important`: `bool`: Control the sensitivity of the toast for screen readers. +- `duration`: `int`: Time in milliseconds that should elapse before automatically closing the toast. +- `position`: `LiteralPosition`: Position of the toast. +- `dismissible`: `bool`: If false, it'll prevent the user from dismissing the toast. +- `action`: `ToastAction`: Renders a primary button, clicking it will close the toast. +- `cancel`: `ToastAction`: Renders a secondary button, clicking it will close the toast. +- `id`: `str | Var`: Custom id for the toast. +- `unstyled`: `bool`: Removes the default styling, which allows for easier customization. +- `style`: `Style`: Custom style for the toast. +- `on_dismiss`: `Any`: The function gets called when either the close button is clicked, or the toast is swiped. +- `on_auto_close`: `Any`: Function that gets called when the toast disappears automatically after it's timeout (`duration` prop).