add_cta_button: Create an HTML fragment for a CTA button

Description Usage Arguments Value Examples

View source: R/add_cta_button.R

Description

Create the HTML fragment for a call to action button. This can be used as part of the email body but, since this HTML, it must be contained within md(). There are options to specify the button text, the URL, and the button's alignment.

Usage

1
add_cta_button(url, text, align = "center")

Arguments

url

A URL for the button.

text

The text that is placed atop the CTA button.

align

The alignment of the button inside the main content area. Options are "center" (the default), "left", and "right".

Value

A character object with an HTML fragment that can be placed inside the message body wherever the CTA button should appear.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Create the button as an HTML fragment
cta_button <-
  add_cta_button(
    url = "http://www.website.net",
    text = "Press This Button"
  )

# Include the button in the email
# message body by using it as part of
# a vector inside of `md()`
email <-
  compose_email(
    body = md(
      c(
  "Pressing the button will take
  you to an example website",
  cta_button
      )
    )
  )

if (interactive()) email

rich-iannone/blastula documentation built on Oct. 17, 2020, 8:59 p.m.