import panel as pn pn.extension() w1 = pn.widgets.TextInput(name='Text:') w2 = pn.widgets.FloatSlider(name='Slider') card = pn.Card(w1, w2, title='Card', background='WhiteSmoke') card w3 = pn.widgets.Select(options=['A', 'B', 'C']) card.append(w3) card print(card.collapsed) card.collapsed = True logo = 'https://panel.holoviz.org/_static/logo_horizontal.png' red = pn.Spacer(background='red', height=50) green = pn.Spacer(background='green', height=50) blue = pn.Spacer(background='blue', height=50) pn.Card( red, green, blue, header_background='#2f2f2f', header_color='white', header=pn.panel(logo, height=40), width=300, ) pn.Card( pn.indicators.Number(value=42, default_color='white', name='Completion', format='{value}%'), background='lightgray', hide_header=True, width=160 ) red = pn.Spacer(background='red', sizing_mode='stretch_both') green = pn.Spacer(background='green', sizing_mode='stretch_both') blue = pn.Spacer(background='blue', sizing_mode='stretch_both') pn.Card(red, green, blue, height=300, width=200, title='Fixed size') from bokeh.plotting import figure p1 = figure(height=250, sizing_mode='stretch_width', margin=5) p2 = figure(height=250, sizing_mode='stretch_width', margin=5) p1.line([1, 2, 3], [1, 2, 3]) p2.circle([1, 2, 3], [1, 2, 3]) pn.Card(p1, pn.layout.Divider(), p2, title="Responsive", sizing_mode='stretch_width')