{"id":13733067,"url":"https://github.com/wleepang/shiny-directory-input","last_synced_at":"2025-05-08T09:31:29.686Z","repository":{"id":54193554,"uuid":"49921549","full_name":"wleepang/shiny-directory-input","owner":"wleepang","description":"An shiny input widget for selecting directories","archived":false,"fork":false,"pushed_at":"2021-03-03T21:45:46.000Z","size":94,"stargazers_count":48,"open_issues_count":5,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-15T01:33:19.103Z","etag":null,"topics":["r","shiny","shiny-applications","widget"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wleepang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-19T02:50:37.000Z","updated_at":"2024-07-08T22:48:47.000Z","dependencies_parsed_at":"2022-08-13T08:50:47.393Z","dependency_job_id":null,"html_url":"https://github.com/wleepang/shiny-directory-input","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wleepang%2Fshiny-directory-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wleepang%2Fshiny-directory-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wleepang%2Fshiny-directory-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wleepang%2Fshiny-directory-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wleepang","download_url":"https://codeload.github.com/wleepang/shiny-directory-input/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253036451,"owners_count":21844217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r","shiny","shiny-applications","widget"],"created_at":"2024-08-03T03:00:37.322Z","updated_at":"2025-05-08T09:31:29.410Z","avatar_url":"https://github.com/wleepang.png","language":"R","funding_links":[],"categories":["UI Components","Tools","R"],"sub_categories":["File Input","Packages"],"readme":"# directoryInput\nA widget for interactive selection of directories for R Shiny Applications\n\n![directory widget](screenshot.png)\n\n# Application\nProvides an input for users to select directories via an interactive, and os native \ndialog, rather than having to type in paths in a `textInput()`.\n\n\u003e **NOTE**: This is intended to only be used with _locally run_ shiny applications.  It will not work on server deployed applications because it uses OS shell calls to present a directory choosing dialog.  There is currently no way (that I'm aware) of _securely_ presenting a client side directory selection dialog from a hosted web application.\n\n# Install the package\nFirst install the `shiny` R-package from CRAN as it is required:\n\n```r\ninstall.packages('shiny')\n```\n\nThen install this package from github:\n\n```r\ndevtools::install_github('wleepang/shiny-directory-input')\n```\n\n## Special Requirements\n\n* Windows:\n  * PowerShell 3 or higher\n\n# Run the demo\n\nSimply run the code to see the widget in action:\n\n```r\nlibrary(shinyDirectoryInput)\nshinyDirectoryInput::runDirinputExample()\n```\n\n# Use the widget\n\nIn `global.R` in your own app (create it if it doesn't already exist) add the line:\n\n```r\nlibrary('shinyDirectoryInput')\n```\n\n### In `ui.R`:\n* Add the widget\n```r\ndirectoryInput('directory', label = 'select a directory')\n```\n\n* Add the widget with a default value\n```r\ndirectoryInput('directory', label = 'select a directory', value = '~')\n```\n\n\n### In `server.R`:\n* **Important**: Pass `session` into the server, it is used to communicate with the client-side widget\n```\nshinyServer(function(input, output, session) {\n  # ...\n}\n```\n\n* Invoke the dialog\n```\npath = readDirectoryInput(session, 'directory')\n```\n\n* Update the widget value\n```\npath = 'path/to/directory'\nupdateDirectoryInput(session, 'directory', value = path)\n```\n\n* Example: Observe when a user clicks the `...` button to select a new directory\n```r\nobserveEvent(\n  ignoreNULL = TRUE,\n  eventExpr = {\n    input$directory\n  },\n  handlerExpr = {\n    if (input$directory \u003e 0) {\n      # condition prevents handler execution on initial app launch\n      \n      # launch the directory selection dialog with initial path read from the widget\n      path = choose.dir(default = readDirectoryInput(session, 'directory'))\n      \n      # update the widget value\n      updateDirectoryInput(session, 'directory', value = path)\n    }\n  }\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwleepang%2Fshiny-directory-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwleepang%2Fshiny-directory-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwleepang%2Fshiny-directory-input/lists"}