Resize actionButton and its label

How can I make actionButtonits label smaller, but the icon is still in the center of the button? I managed to make the button and the text smaller, but the result is a small button with small text that is not centered in the button. I think I'm probably wrong. Here is an example where the button / text is reduced, but the result is a button with text not centered.

library(shiny)

shinyApp(
    shinyUI(fluidPage(
        inputPanel(
            ## Original
            actionButton('button', 'Hi'),

            ## Text is smaller
            gsub('Hi', '<font size="1">Hi</font>',
                 actionButton('button1', 'Hi')),

            ## Text is smaller and button is smaller, but text is outside of button
            gsub('Hi', '<font size="1" align="center">Hi</font>',
                 actionButton('button2', 'Hi', style='height:20px'))
            )
    )),
    shinyServer(function(input,output){})
)
+4
source share
1 answer

You should just focus on HTML and CSS here. There is nothing R and brilliant here. actionButton- this is just HTML <button>. You can set properties for font size and padding (space around text).

actionButton('button2', 'Hi', style='padding:4px; font-size:80%'))
+5

Source: https://habr.com/ru/post/1611345/


All Articles