Skip to content

Set page title

If you want to set the page title, you can use me.set_page_title which will set the page title displayed on the browser tab.

This change does not persist if you navigate to a new page. The title will be reset to the title configured in me.page.

Example

import mesop as me


def on_blur(e: me.InputBlurEvent):
  me.set_page_title(e.value)


def load(e: me.LoadEvent):
  me.set_theme_mode("system")


@me.page(
  on_load=load,
  security_policy=me.SecurityPolicy(
    allowed_iframe_parents=["https://google.github.io"]
  ),
  path="/set_page_title",
)
def app():
  with me.box(style=me.Style(margin=me.Margin.all(15))):
    me.input(label="Page title", on_blur=on_blur)

API

set_page_title

Sets the page title.

PARAMETER DESCRIPTION
title

The new page title

TYPE: str