3

After having tried various things I found that straighforward but useful way of moving vertically a piece of text and want to share it so that other users of Stacks may benefit of it (as I myself benefit A LOT of thi site):

If you do

fluidRow(
column(width=1,offset=1, h4("Test")),
column(width=2,offset=1, numericInput("sf1.2", label = "Mesure #1", value = 0))

in a ui.R script with R shiny, you notice that "test" is off by regards to the numeric input. To have "test" nicely centered by regards to the numeric input just use the padding option:

fluidRow(
column(width=1,offset=1, h4("Test", style="padding:20px;")),
column(width=2,offset=1, numericInput("sf1.2", label = "Mesure #1", value = 0))
Xavier Prudent
  • 1,570
  • 3
  • 25
  • 54

2 Answers2

4

just use the padding option:

fluidRow(
column(width=1,offset=1, h4("Test", style="padding:20px;")),
column(width=2,offset=1, numericInput("sf1.2", label = "Mesure #1", value = 0))
Xavier Prudent
  • 1,570
  • 3
  • 25
  • 54
  • thank you for the answer, is there a way to do that dynamically (depending on the height of the column which changes)? Thanks – ChriiSchee Oct 11 '16 at 07:57
  • Dynamically I don't know, but you can set the column heights and then the padding accordingly, for setting the column height you can look here http://stackoverflow.com/questions/25340847/control-the-height-in-fluidrow-in-r-shiny – Xavier Prudent Oct 11 '16 at 15:39
1

The following lignes of code should be used to automate yours.

fluidRow(
column(width=1,offset=1, h3("Test", style="text-align: center;")),
column(width=2,offset=1, numericInput("sf1.2", label = "Mesure #1", value = 0))