Skip to content

creating a multi-page app without forcing an appbar #584

@havok2063

Description

@havok2063

Is it possible to create a multi-page app without forcing the creation of an app bar with tabbed pages? I effectively have two "single-page" apps, each with their own top-level Page component, that I need to combine into a multi-page app, with each behind a route. I tried something like the following:

import solara

from sdss_solara.pages.jdaviz_embed import Page as Embed
from sdss_explorer.pages import Page as Dashboard

@solara.component
def Home():
    solara.Markdown("Solara Home")


routes = [
    solara.Route(path="/", component=Home, label="Home"),
    solara.Route(path="embed", component=Embed, label="Embed"),
    solara.Route(path="dashboard", component=Dashboard, label="Dashboard"),
]

but this forces an AppBar, which covers up components on the "embed" page. Additionally, navigating to the home page first correctly displays the "Solara Home" text, but then toggling to the embed page and back to home, the "Solara Home" content is missing.

In this case I don't need the page navigation, I just need to point to "site/solara/embed" and "site/solara/dashboard" separately and have them render as expected.

Also for reference, I am not running this with the solara server, the combined app will be sub-mounted into an existing FastAPI app. I think that just means that the SOLARA_APP env variable should point to the top-level solara application module.

I tried disabling the layout by adding the following in the above top-level module but that didn't seem to change anything.

@solara.component
def Layout(children=[]):
    # there will only be 1 child, which is the Page()
    return children[0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions