Description Usage Arguments See Also Examples
View source: R/typeahead-textinput.R
A simple typeahead text input component
Update textInput.typeahead
1 2 3 4 5 | textInput.typeahead(id, placeholder, local, valueKey, tokens, template,
limit = 20)
updateTextInput.typeahead(session, id, dataset, valueKey, tokens, template,
limit = 20, placeholder = "")
|
id |
The id of the field |
placeholder |
The placeholder text. It is shown in the text input before any input has occurred |
local |
A data.frame containing all the information you want to make available to typeahead to display in the dropdown. You can use any of the variable in the dataset via the template argument |
valueKey |
The element that acts as the value key in the dataset usually an unique identifier of the row |
tokens |
A list whose length equal to nrow(local) where each element is array of string tokens. Typing the tokens will select the corresponding rows |
template |
A hogan template on how to show the content e.g. '<p> name </p>' where name is one of the variables in local |
limit |
An integer of the upper limit on how many hits to show in the typeahead dropdown |
session |
The Shiny session specified in shinyServer(function(input, output, session) ...). |
dataset |
The data.frame to render |
Other ShinySky elements: actionButton
,
select2Input
, shinyalert
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # ui.R
textInput.typeahead(
id="thti"
,placeholder="type 'name' or '2'"
,local=data.frame(name=c("name1","name2"),info=c("info1","info2"))
,valueKey = "name"
,tokens=c(1,2)
,template = HTML("<p class='repo-language'>{{info}}</p>
<p class='repo-name'>{{name}}</p>
<p class='repo-description'>You need to learn more CSS to customize this further</p>")
)
# run the below and go to the typeahead tab
if(interactive()) {
shinysky::run.shinysky.example()
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.