Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @react-md/alert

Index

Type aliases

AddMessage

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

Type parameters

Type declaration

    • (message: M): void
    • This function is used to add a message to the queue.

      Parameters

      • message: M

      Returns void

DuplicateBehavior

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

HideMessage

HideMessage: () => void

Type declaration

    • (): 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.

      Returns void

MessagePriority

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

PopMessage

PopMessage: () => void

Type declaration

    • (): void
    • This function is used to immediately remove the current message from the queue without an exit animation.

      Returns void

ResetQueue

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

Type parameters

Type declaration

    • (): readonly 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.

      Returns readonly M[]

RestartVisibilityTimer

RestartVisibilityTimer: () => void

Type declaration

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

      Returns void

SnackbarPosition

SnackbarPosition: "bottom" | "top"

StartVisibilityTimer

StartVisibilityTimer: () => void

Type declaration

    • (): 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.

      Returns void

StopVisibilityTimer

StopVisibilityTimer: () => void

Type declaration

    • (): 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.

      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<readonly 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>(): readonly M[]

Generated using TypeDoc