    # toast() validates position argument

        Code
          toast("Test", position = "invalid")
        Condition
          Error in `normalize_toast_position()`:
          ! Invalid toast position: 'invalid'. Must specify one vertical position (top, middle, bottom) and one horizontal position (left, center, right).

    # toast() validates type argument

        Code
          toast("Test", type = "invalid")
        Condition
          Error in `toast()`:
          ! `type` must be one of "primary", "secondary", "success", "info", "warning", "danger", "error", "light", or "dark", not "invalid".

    # toast() duration_s throws for invalid values

        Code
          toast("Test", duration_s = -5)
        Condition
          Error in `toast()`:
          ! `duration_s` must be a single non-negative number or NA.
        Code
          toast("Test", duration_s = "invalid")
        Condition
          Error in `toast()`:
          ! `duration_s` must be a single non-negative number or NA.
        Code
          toast("Test", duration_s = c(5, 10))
        Condition
          Error in `toast()`:
          ! `duration_s` must be a single non-negative number or NA.

    # as.tags.bslib_toast creates proper HTML structure

        Code
          cat(format(tag))
        Output
Test
    # as.tags.bslib_toast respects accessibility attributes

        Code
          cat(format(as.tags(t_danger)))
        Output
Error message
    ---

        Code
          cat(format(as.tags(t_info)))
        Output
Info message
    ---

        Code
          cat(format(as.tags(t_default)))
        Output
Default message
    # as.tags.bslib_toast includes close button appropriately

        Code
          cat(format(as.tags(t_header)))
        Output
Title
Message
    ---

        Code
          cat(format(as.tags(t_no_header)))
        Output
Message
    ---

        Code
          cat(format(as.tags(t_non_closable)))
        Output
Message
    ---

        Code
          cat(format(as.tags(t_manual)))
        Output
Message
# toast() icon renders in body without header Code cat(format(tag)) Output
★
You have new messages
# toast() icon renders in body with header Code cat(format(tag)) Output
New Mail
★
Message content
# toast() icon works with closable button in body Code cat(format(tag)) Output
★
Warning message
    # toast_header() icon renders in header

        Code
          cat(format(tag))
        Output
★ Notification now
Body content
    # toast_header() icon with status and title

        Code
          cat(format(tag))
        Output
✓ Success just now
Operation completed
# toast with both header icon and body icon Code cat(format(tag)) Output
H Title
B
Message content
# normalize_toast_position() errors on invalid input Code normalize_toast_position("top") Condition Error in `normalize_toast_position()`: ! Invalid toast position: 'top'. Must specify one vertical position (top, middle, bottom) and one horizontal position (left, center, right). Code normalize_toast_position("left") Condition Error in `normalize_toast_position()`: ! Invalid toast position: 'left'. Must specify one vertical position (top, middle, bottom) and one horizontal position (left, center, right). Code normalize_toast_position("top bottom left") Condition Error in `normalize_toast_position()`: ! Invalid toast position: 'top bottom left'. Must specify one vertical position (top, middle, bottom) and one horizontal position (left, center, right). Code normalize_toast_position(c("top", "bottom", "left")) Condition Error in `normalize_toast_position()`: ! Invalid toast position: 'top bottom left'. Must specify one vertical position (top, middle, bottom) and one horizontal position (left, center, right). Code normalize_toast_position("top invalid") Condition Error in `normalize_toast_position()`: ! Invalid toast position: 'top invalid'. Must specify one vertical position (top, middle, bottom) and one horizontal position (left, center, right). Code normalize_toast_position("foo bar") Condition Error in `normalize_toast_position()`: ! Invalid toast position: 'foo bar'. Must specify one vertical position (top, middle, bottom) and one horizontal position (left, center, right). # show_toast() and hide_toast() warn if nothing to show/hide Code hide_toast(show_toast(toast(), session = session), session = session) Condition Warning: `toast` has no content; no toast to show. Warning: `id` is NULL; no toast to hide. # hide_toast() works Code hide_toast(toast()) Condition Error in `hide_toast()`: ! Cannot hide a toast without an ID. Provide the toast ID.