Type: Package
Title: Curve Text Elements in 'Shiny' Using 'CircleType.js'
Version: 1.0.2
Description: Enables curving text elements in 'Shiny' apps.
License: MIT + file LICENSE
Encoding: UTF-8
Imports: shiny
RoxygenNote: 7.1.1
URL: https://github.com/etiennebacher/circletyper
BugReports: https://github.com/etiennebacher/circletyper/issues
Suggests: testthat (≥ 3.0.0), spelling
Config/testthat/edition: 3
Language: en-US
NeedsCompilation: no
Packaged: 2022-09-21 07:25:29 UTC; etienne
Author: Etienne Bacher [aut, cre, cph]
Maintainer: Etienne Bacher <etienne.bacher@protonmail.com>
Repository: CRAN
Date/Publication: 2022-09-21 07:40:02 UTC

Apply a curvature on text elements

Description

Apply a curvature on text elements

Usage

circletype(ui_element, dir = 1, radius = 200)

Arguments

ui_element

Text element on which the curvature should be applied. Must be something like ‘h1()', 'h2()', etc. This element MUST have an id. Doesn’t work on other HTML elements such as buttons.

dir

Sets the text direction, must be equal to 1 (clockwise) or -1 (counter-clockwise).

radius

Sets the desired text radius. The lower the value, the more curved the text.

Value

A curved text.

Examples

if (interactive()) {
library(shiny)

ui <- fluidPage(
  use_circletype(), # load dependencies
  circletype(h1("this is a title", id = "test_h1"), dir = -1, radius = 200)
)

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

shinyApp(ui, server)
}

Remove circletype effect

Description

Remove circletype effect

Usage

remove_circletype(id, session = NULL)

Arguments

id

Id of the text element that has a circletype effect.

session

Session of the Shiny app

Value

Removes circletype effect

Examples

if (interactive()) {
library(shiny)
library(circletyper)

ui <- fluidPage(
  use_circletype(), # load dependencies

  circletype(strong("this is a bold text", id = "teststrong")),

  br(),

  # You can also remove the circletype effect
  actionButton("remove", "remove circletype effect for bold text")
)

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


  observeEvent(input$remove, {
    remove_circletype("teststrong", session = session)
  })

}

shinyApp(ui, server)
}

Load CircleType dependencies

Description

Load CircleType dependencies

Usage

use_circletype()

Value

Load dependencies

Examples

if (interactive()) {
library(shiny)

ui <- fluidPage(
  use_circletype(), # load dependencies
  circletype(h1("this is a title", id = "test_h1"), dir = -1, radius = 200)
)

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

shinyApp(ui, server)
}