Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @react-md/alert

Index

Type aliases

AddMessage

AddMessage<M>: (message: M) => void

This function is used to add a message to the queue.

Type parameters

Type declaration

    • (message: M): void
    • Parameters

      • message: M

      Returns void

DuplicateBehavior

DuplicateBehavior: "restart" | "prevent" | "allow"

HideMessage

HideMessage: () => void

This function is used to trigger the exit animation for the current message. Once the animation finishes, the PopMessage function will be called to remove it from the queue.

Type declaration

    • (): void
    • Returns void

MessagePriority

MessagePriority: "normal" | "next" | "immediate" | "replace"

PopMessage

PopMessage: () => void

This function is used to immediately remove the current message from the queue without an exit animation.

Type declaration

    • (): void
    • Returns void

ResetQueue

ResetQueue<M>: () => M[]

This will allow you to reset the entire queue and immediately hide all notifications. This will return the current queue at the time of reset if you would like to do some manual logic for adding items to the queue.

Type parameters

Type declaration

    • (): M[]
    • Returns M[]

RestartVisibilityTimer

RestartVisibilityTimer: () => void

This function will restart the visibility timer. This is useful for handling duplicate messages or browser focus loss/gain behavior.

Type declaration

    • (): void
    • Returns void

SnackbarPosition

SnackbarPosition: "bottom" | "top"

StartVisibilityTimer

StartVisibilityTimer: () => void

This function will start the visibility timer for the current message. The default behavior is to start the timer once the message finishes its' enter animation. Once the timeout finished, the HideMessage function will be called to start the exit animation.

Type declaration

    • (): void
    • Returns void

StopVisibilityTimer

StopVisibilityTimer: () => void

This function will stop the visibility timer for the current message. This is nice to use when the browser is blurred while a toast is visible and then trigger the RestartVisibilityTimer once the focus is returned so that toasts are not shown and hidden without the user being aware.

Type declaration

    • (): void
    • Returns void

Variables

Const AddMessageContext

AddMessageContext: Context<AddMessage<Message>> = ...
internal

Const DEFAULT_MESSAGE_QUEUE_TIMEOUT

DEFAULT_MESSAGE_QUEUE_TIMEOUT: 5000 = 5000

Const DEFAULT_TOAST_CLASSNAMES

DEFAULT_TOAST_CLASSNAMES: CSSTransitionClassNames = ...

Const DEFAULT_TOAST_TIMEOUT

DEFAULT_TOAST_TIMEOUT: TransitionTimeout = 150

Const MessageQueueActionsContext

MessageQueueActionsContext: Context<MessageQueueActions<Message>> = ...
internal

Const MessageQueueContext

MessageQueueContext: Context<Message[]> = ...
internal

Const MessageVisibilityContext

MessageVisibilityContext: Context<boolean> = ...
internal

Const Snackbar

Snackbar: ForwardRefExoticComponent<SnackbarProps & RefAttributes<HTMLDivElement>> = ...

Const Toast

Toast: ForwardRefExoticComponent<ToastProps & RefAttributes<HTMLDivElement>> = ...

This is a very low-level component that can be used to animate a new toast in to a Snackbar as it is mainly just a wrapper of the CSSTransition component. If you are using this component, it is generally recommended to provide the onEntered callback as a function to start the hide visibility timer and the onExited callback to remove the current toast from your queue.

Functions

MessageQueue

useAddMessage

useMessageQueueActions

useMessageVisibility

  • useMessageVisibility(): boolean

useQueue

  • useQueue<M>(): M[]

Generated using TypeDoc