Live Chat

We'll need to share your messages (and your email address if you're logged in) with our live chat provider, Drift. Here's their privacy policy.

If you don't want to do this, you can email us instead at contact@anvil.works.

Navigating between pages

Are you new here?

Anvil is a tool for building full-stack web apps with nothing but Python and a drag-and-drop designer. Learn more on our website, or sign up and try it yourself -- it's free!

Anvil apps are split into Forms. You can include one Form inside another, and use Links to switch between them.

Our Material Design theme has a sidebar for navigation. Drop Links into it and configure their click handlers to add an instance of the desired Form to the main Form’s content_panel:

from Page1 import Page1

# ...

  def link_1_click(self, **event_args):
    """This method is called when the link is clicked"""
    self.content_panel.clear()
    self.content_panel.add_component(Page1())

This is an example app showing navigation between pages using the sidebar.

Click here to clone the example app in the Anvil designer.

Animation of navigation between pages

Here is a video tutorial showing step-by-step how to set up navigation Links.

For detailed information, see the Navigation section of the reference docs.

Tabbed browsing and other navigation styles

If you have a particular style of navigation in mind, for example a tabbed browsing experience, you can modify the template HTML of your theme to create any look and feel you like. The basic principle of using Links to navigate between Forms still applies, but you’ll put the slots in a different place. See Themes in the reference docs for more information.

We will create a custom Theme for you if you are a Business Plan customer. Contact us at support@anvil.works to discuss further.