Package 'prompter'

Title: Add Tooltips in 'Shiny' Apps with 'Hint.css'
Description: In 'Shiny' apps, it is sometimes useful to store information on a particular item in a tooltip. 'Prompter' allows you to easily create such tooltips, using 'Hint.css'.
Authors: Etienne Bacher [aut, cre, cph]
Maintainer: Etienne Bacher <[email protected]>
License: MIT + file LICENSE
Version: 1.2.0
Built: 2024-11-04 04:34:11 UTC
Source: https://github.com/etiennebacher/prompter

Help Index


Add a tooltip for a specific element

Description

Add a tooltip for a specific element

Usage

add_prompt(
  ui_element,
  position = "bottom",
  message = NULL,
  type = NULL,
  size = NULL,
  permanent = FALSE,
  rounded = FALSE,
  animate = TRUE,
  bounce = FALSE,
  arrow = TRUE,
  shadow = TRUE
)

Arguments

ui_element

Element on which a tooltip will be added.

position

Position of the tooltip. Can be 'bottom', 'bottom-left', 'bottom-right', 'left', 'right', 'top', 'top-left', 'top-right'. Default is 'bottom'.

message

Message to include in the tooltip. This argument is mandatory.

type

Type of the tooltip. Can be 'NULL' (default), 'error', 'warning', 'info', 'success'.

size

Size of the tooltip. Can be 'NULL' (default), 'small', 'medium', 'large'.

permanent

Boolean indicating whether the tooltip should be visible permanently (or at the contrary only when hovering the element). Default is 'FALSE'.

rounded

Boolean indicating whether the corners of the tooltip should be rounded. Default is 'FALSE'.

animate

Boolean indicating whether there is a small animation when the tooltip appears. Default is 'TRUE'.

bounce

Boolean indicating whether there is a small boucing animation when the tooltip appears. Default is 'FALSE'.

arrow

Boolean indicating whether there is an arrow on the tooltip. Default is 'TRUE'.

shadow

Boolean indicating whether there should be a shadow effect. Default is 'TRUE'.

Value

A tooltip when hovering the element concerned.

Examples

if (interactive()) {
library(shiny)

ui <- fluidPage(

  use_prompt(),

  add_prompt(
    tableOutput("table"),
    position = "bottom", type = "warning",
    message = "this is a table", permanent = FALSE,
    rounded = TRUE, animate = FALSE
  )

  # also works with magrittr's pipe
  # tableOutput("table") %>%
  #   add_prompt(
  #     position = "bottom", type = "warning",
  #     message = "this is a button", permanent = FALSE,
  #     rounded = TRUE, animate = FALSE
  #   )
)

server <- function(input, output, session) {

  output$table <- renderTable(head(mtcars))

}

shinyApp(ui, server)
}

Load hint.css dependencies

Description

Load hint.css dependencies

Usage

use_prompt()

Value

Include dependencies of Hint.css