Skip to content

Navigate

To navigate to another page, you can use me.navigate. This is particularly useful for navigating across a multi-page app.

Example

import mesop as me


def navigate(event: me.ClickEvent):
  me.navigate("/about")


@me.page(path="/")
def home():
  me.text("This is the home page")
  me.button("navigate to about page", on_click=navigate)


@me.page(path="/about")
def about():
  me.text("This is the about page")

API

navigate

Navigates to the given URL.

PARAMETER DESCRIPTION
url

The URL to navigate to.

TYPE: str

query_params

A dictionary of query parameters to include in the URL, or me.query_params. If not provided, all current query parameters will be removed.

TYPE: dict[str, str | Sequence[str]] | QueryParams | None DEFAULT: None