Alignment
i have this code for the app bar of my Solara app:
and it displays the image attached, how can i move the image to the left hand side of the app bar?
12 Replies
Hey @Harry!
I would give chaning the children of
solara.AppBar
to be solara.Image(...)
and solara.v.Spacer()
. The Spacer
should fill the rest of the remaining (right aligned) space.Hi @Iisakki Rotko ! thank you for responding to my simple question lol. I have done that and it is now centred the image :/
Hey @Harry! I clearly should have tried running the code to check my solution :) We automatically inject a
solara.v.Spacer
before the children, but after AppBarTitle
. Would using solara.AppBarTitle
work? Something like
Hello,
I have an alignment issue too, but simpler than this question. I want a logo, a text/markdown title, and a button across the top banner of my web page. When I do the logo by itself, it aligns ok.
with solara.AppBar():
with solara.AppBarTitle(): solara.Image(image_path, '20%') (left image below) Then I try to add the dashboard Title and a button, the logo disappears just the title and button appear on vertically stacked, not horizontally. with solara.AppBar():
with solara.AppBarTitle(): solara.Image(image_path, '20%') solara.Markdown("# Title of Dashboard") solara.Button(label="Exit", on_click = exit_page) Any ideas what to do? I would like logo, title, button horizontally across banner. Thanks
with solara.AppBarTitle(): solara.Image(image_path, '20%') (left image below) Then I try to add the dashboard Title and a button, the logo disappears just the title and button appear on vertically stacked, not horizontally. with solara.AppBar():
with solara.AppBarTitle(): solara.Image(image_path, '20%') solara.Markdown("# Title of Dashboard") solara.Button(label="Exit", on_click = exit_page) Any ideas what to do? I would like logo, title, button horizontally across banner. Thanks
Sorry, if my post is confusing. I am a bit new to discord too.
Hey @Cold Sunshine! This (unfortunately) takes some trickery. Let me know if the following works for you:
Run and edit this code snippet at PyCafe
PyCafe - Solara - Simple Dashboard Example Using Solara Library
PyCafe: get your daily fix of Python!
I will try it out - Thanks!
This worked out great - I built my first working (but modest) dashboard. On to more fancy stuff now. 🙂
How do I change to the color of my AppBar?
The
AppLayout
should take a color
argument. There you can give it either a hex code, CSS color name, or a vuetify theme color name (like "primary"
)I don't see anything in docs and all my likely guesses failed
Yeah, it might be a bit unexpected that the argument goes on
AppLayout
and not AppBar
Ha! It works thanks