nanxstats / awesome-shiny-extensions

🐝 Awesome R and Python packages offering extended UI or server components for the web framework Shiny

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Multi-Text Input Package

JerePlum99 opened this issue · comments

Hello! Really appreciate all the work being done here to aggregate shiny resources! No pressure to reply or resolve this, but I've looked everywhere and figured it was worth asking.

Are you aware of any package or method that could replicate a multi-text input similar to this? My goal is to allow a user to dynamically input search terms, I've though through textInput or selectInput, but I don't want to restrict users to any set choice and am not sure how to similate this. Let me know if you have any knowledge of something like this, no worries if you just close the issue though. Thank you!

image

You can simply use shiny::selectizeInput with it's create option activated. Please see my related answer here:

selectizeInput(
      inputId = "selectedPackages",
      label = "Enter R Package Name",
      choices = packagesDF$Package,
      selected = NULL,
      multiple = TRUE,
      width = "100%",
      options = list(
        'plugins' = list('remove_button'),
        'create' = TRUE,
        'persist' = TRUE
      )
    )

PS: in its dev version shiny::selectizeInput gains support for some new plugin options.

Agreed. If the requirements are mainly about creating new options and removing buttons, then using the selectizeInput() options and plugins would be the simplest solution.

If your requirement is actually much more complicated (such as the "OR" options), then another possibility is using the drag and drop components creatively.

@ismirsehregal That was exactly what I was looking for, still new to shiny and didn't know this functionality so appreciate you pointing me in the right direction!

@nanxstats Ill have to take a look at the drag and drop tools, the "AND/OR" functionality is on my roadmap but probably too much to figure out now. Thanks for the help!