Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @react-md/alert

Index

Type aliases

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: "restart" | "prevent" | "allow"
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: "normal" | "next" | "immediate" | "replace"
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<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: () => 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: "bottom" | "top"
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: () => 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

AddMessageContext: Context<AddMessage<Message>> = ...
internal
DEFAULT_MESSAGE_QUEUE_TIMEOUT: 5000 = 5000
DEFAULT_TOAST_CLASSNAMES: Readonly<CSSTransitionClassNamesObject> = ...
remarks

@since 2.4.0

DEFAULT_TOAST_TIMEOUT: TransitionTimeout = 150
remarks

@since 2.4.0

MessageQueueActionsContext: Context<MessageQueueActions<Message>> = ...
internal
MessageQueueContext: Context<readonly Message[]> = ...
internal
MessageVisibilityContext: Context<boolean> = ...
internal
Snackbar: ForwardRefExoticComponent<SnackbarProps & RefAttributes<HTMLDivElement>> = ...
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

  • useMessageVisibility(): boolean
  • useQueue<M>(): readonly M[]

Generated using TypeDoc