Hei,
I have a flexdashboard
with shiny
components.
The shiny components are placed on the dashboard with fillRow
in a customised manner.
Unfortunately the height of the actionButton
is not appropriate.
How can I change the height of the actionButton
?
My example Code:
---
title: "Action Button Example"
author:
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
runtime: shiny
---
Some Shiny elements
=======================================================================
```{r setup, include=FALSE}
# --------------------------------------------------------------------------------------------
# necessary packages
# --------------------------------------------------------------------------------------------
library(shiny)
library(tidyverse)
```
```{r section1, echo=FALSE}
# --------------------------------------------------------------------------------------------
# 'fillRow' (and 'fillCol') allows place shiny-elements in a custom style
# --------------------------------------------------------------------------------------------
fillRow(uiOutput("UItext"),
uiOutput("UIselect"),
uiOutput("UIbutton"),
flex = c(1,3,1),
width = "100%", height = "100%")
```
```{r section2, include=FALSE}
# --------------------------------------------------------------------------------------------
# Text
# --------------------------------------------------------------------------------------------
output$UItext <- renderText({
paste0("Textelement","<br>","in 2 lines")
})
# --------------------------------------------------------------------------------------------
# Selection
# --------------------------------------------------------------------------------------------
output$UIselect <- renderUI({
selectInput(inputId = "UIselect",
label = "Something to choose",
choices = c("",paste("Selection",1:3),paste0("And here a ",paste(rep("very",25),collapse = ", ")," long Text")),
selected = "",
width = "100%"
)
})
# --------------------------------------------------------------------------------------------
# (Delete) Button
# --------------------------------------------------------------------------------------------
# Color of Buttons:
# https://stackoverflow.com/questions/33620133/change-the-color-of-action-button-in-shiny
# https://getbootstrap.com/docs/4.0/components/buttons/
# Delete Button only, if selection is choosen
output$UIbutton <- renderUI({
actionButton(inputId = "UIbutton",
label = "Delete?",
width = "100%",
class = "btn-danger btn-lg",
style = "height: 60px
)
})
# --------------------------------------------------------------------------------------------
# Click on Delete Button: Delete Button should disapear!
# --------------------------------------------------------------------------------------------
observeEvent(input$UIbutton,{
# Empty shiny Elements
updateSelectInput(session,"UIselect", selected= "")
})
```
By the way: why do I get a "true" between the headers?
Thank you for any help!
V
2
Answers
Use something like this:
Here is a way:
and:
But there’s a bottom margin of 15px below the select input. To get rid of it, add this CSS chunk: