Routes¶
- marimo.routes(routes: dict[str, Callable[[], object] | Callable[[], Coroutine[None, None, object]] | object]) None¶
- Renders a list of routes that are switched based on the URL path. - Routes currently don’t support nested routes, or dynamic routes (e.g. - #/user/:id). If you’d like to see these features, please let us know on GitHub: https://github.com/marimo-team/marimo/issues- For a simple-page-application (SPA) experience, you should use hash-based routing. For example, prefix your routes with - #/.- If you are using a multi-page-application (MPA) with - marimo.create_asgi_app, you should use path-based routing. For example, prefix your routes with- /.- Examples. - mo.routes( { "#/": render_home, "#/about": render_about, "#/contact": render_contact, mo.routes.CATCH_ALL: render_home, } ) - Args. - routes: a dictionary of routes, where the key is the URL path and the value is a function that returns the content to display.
 - Returns. - An - Htmlobject.