Vik
Vik

Reputation: 549

Shiny R aligning buttons

I have two buttons in my U.i file

div(style="display:inline-block",submitButton("Analysis")),
  div(style="display:inline-block",downloadButton('downloadData', 'Download Data'))

Which gives the following output in the app

enter image description here

However I am trying to align these buttons so that the download data is on the right in the grey box and the analysis button is on the left in the grey box, instead of how it looks now. How do i go about this? The intended use is to become more advanced and create another button which is in the middle of the grey box. Im assuming you do something similar to

style="display:center-align"
style="display:right-align"
style="display:left-align"

but I'm not sure how to go about this process.

Upvotes: 12

Views: 35787

Answers (3)

kraggle
kraggle

Reputation: 347

element being part of a sidebarMenu

div(style="position:relative; left:calc(25%);", downloadButton("dd", "Download .zip"))

Upvotes: 2

Abraham JA
Abraham JA

Reputation: 126

I tried with the @Verena Haunschmid answer but it didn't work. This worked for me (it's pretty similar):

div(style = "display:inline-block; float:right", actionButton("hideshow", "Hide/Show"))

Upvotes: 4

Verena Praher
Verena Praher

Reputation: 1272

This works:

div(style="display:inline-block",submitButton("Analysis"), style="float:right"),
div(style="display:inline-block",downloadButton('downloadData', 'Download Data'), style="float:right")

But you should consider using a stylesheet, like explained in this answer: https://stackoverflow.com/a/25390164/1117932

Upvotes: 14

Related Questions