Skip to content
Back to skills

Shinyjs

ASecurity

R shinyjs package for JavaScript operations. Use for show/hide, enable/disable, and custom JS in Shiny.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added June 5, 2026
datajavascriptjava

Security analysis

A100/100

Scanned June 5, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill shinyjs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Shinyjs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Shinyjs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-shinyjs/badge)](https://www.skillsdirectory.com/skills/leolin990405-shinyjs)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: shinyjs
description: R shinyjs package for JavaScript operations. Use for show/hide, enable/disable, and custom JS in Shiny.
---

# shinyjs Package

JavaScript operations in Shiny without writing JS.

## Setup

```r
library(shiny)
library(shinyjs)

ui <- fluidPage(
  useShinyjs(),  # Required!
  # ... rest of UI
)
```

## Show/Hide

```r
# UI
div(id = "myDiv", "Content to show/hide")
actionButton("toggle", "Toggle")

# Server
observeEvent(input$toggle, {
  toggle("myDiv")
})

# Other options
show("myDiv")
hide("myDiv")
toggle("myDiv", anim = TRUE, animType = "fade")
```

## Enable/Disable

```r
# UI
textInput("text", "Input"),
actionButton("btn", "Submit")

# Server
observe({
  if (nchar(input$text) > 0) {
    enable("btn")
  } else {
    disable("btn")
  }
})

# Toggle
toggleState("btn", condition = nchar(input$text) > 0)
```

## CSS Classes

```r
addClass("myDiv", "highlight")
removeClass("myDiv", "highlight")
toggleClass("myDiv", "highlight")
```

## HTML Content

```r
html("myDiv", "New content")
html("myDiv", "<b>Bold</b>", add = TRUE)
```

## Reset

```r
# Reset input to default
reset("text")
reset("form")  # Reset all inputs in container
```

## Run JavaScript

```r
# Run custom JS
runjs("alert('Hello!')")
runjs("$('#myDiv').css('color', 'red')")

# Extended functions
extendShinyjs(text = "shinyjs.hello = function() { alert('Hi!'); }")
# Then call: js$hello()
```

## Delay

```r
delay(1000, show("myDiv"))  # Show after 1 second
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.