Shiny: Add support for ifelse logic in conditionalPanel

Created on 23 May 2015  路  2Comments  路  Source: rstudio/shiny

Many times I want to do something along the lines of

conditionalPanel("input.test", "yep"),
conditionalPanel("!input.test", "nope")

Some syntactic sugar here would be awesome :) Hopefully the above could be translated into

conditionalPanel("input.test", iftrue = "yep", iffalse = "nope")

(clearly I'm not great at naming arguments)

Intermediate Low Help Wanted Low Type

Most helpful comment

@jcheng5 I keep running into cases where I really want this functionality.

What does the shiny team think about

conditionalPanel(condition, ..., ns = NS(NULL), else = NULL)

I used to be absolutely terrified about this idea, but now that conditionalPanel already has another named argument, I'm starting to think it's not that bad.

All 2 comments

@jcheng5 I keep running into cases where I really want this functionality.

What does the shiny team think about

conditionalPanel(condition, ..., ns = NS(NULL), else = NULL)

I used to be absolutely terrified about this idea, but now that conditionalPanel already has another named argument, I'm starting to think it's not that bad.

Sorry for taking so long to get to this 馃槃 This is a nice enhancement, I think it's safe to say we'd consider a PR.

Was this page helpful?
0 / 5 - 0 ratings