
ui_yeah()
and ui_nope()
are technically superseded, but, unlike the rest
of the legacy ui_*()
functions, there's not yet a
drop-in replacement available in the cli package.
ui_yeah()
and ui_nope()
are no longer used internally in usethis.
ui_yeah(
x,
yes = c("Yes", "Definitely", "For sure", "Yup", "Yeah", "I agree", "Absolutely"),
no = c("No way", "Not now", "Negative", "No", "Nope", "Absolutely not"),
n_yes = 1,
n_no = 2,
shuffle = TRUE,
.envir = parent.frame()
)ui_nope(
x,
yes = c("Yes", "Definitely", "For sure", "Yup", "Yeah", "I agree", "Absolutely"),
no = c("No way", "Not now", "Negative", "No", "Nope", "Absolutely not"),
n_yes = 1,
n_no = 2,
shuffle = TRUE,
.envir = parent.frame()
)
A logical. ui_yeah()
returns TRUE
when the user selects a "yes"
option and FALSE
otherwise, i.e. when user selects a "no" option or
refuses to make a selection (cancels). ui_nope()
is the logical opposite
of ui_yeah()
.
A character vector.
For block styles, conditions, and questions, each element of the
vector becomes a line, and the result is processed by glue::glue()
.
For inline styles, each element of the vector becomes an entry in a
comma separated list.
A character vector of "yes" strings, which are randomly sampled to populate the menu.
A character vector of "no" strings, which are randomly sampled to populate the menu.
An integer. The number of "yes" strings to include.
An integer. The number of "no" strings to include.
A logical. Should the order of the menu options be randomly shuffled?
Used to ensure that glue::glue()
gets the correct
environment. For expert use only.
if (FALSE) {
ui_yeah("Do you like R?")
ui_nope("Have you tried turning it off and on again?", n_yes = 1, n_no = 1)
ui_yeah("Are you sure its plugged in?", yes = "Yes", no = "No", shuffle = FALSE)
}
Run the code above in your browser using DataLab