How do I center a RadioBoxGroup with a Markdown box


I’m trying to center a RadioBoxGroup but can’t seem to figure it out. I’ve tried using spacers and messing with parameters but couldn’t get anywhere.

title = pn.pane.Markdown("Title Goes Here", style={'text-align':'center'})
rb = pn.widgets.RadioBoxGroup(options=['A', 'B'], value='A', inline=False)
pn.Column(title, rb)
1 Like

Hi @mjslamot

Centering can be difficult to figure out before you have developed a bit of experience and some tricks.

Adding a background color to your elements while you experiment often enables you to better understand the extent, position and consequences of changing the code.

The below seems to align things horizontally.


import panel as pn

title = pn.pane.Markdown("Title Goes Here", align="center", background="salmon")
rb = pn.widgets.RadioBoxGroup(
    options=["A", "B"], value="A", inline=False, align="center", background="salmon", width=25
pn.Column(title, rb, pn.layout.HSpacer(), background="whitesmoke", width=400).servable()