Skip to content

Page layout is not "centered" by default in multipage apps #6237

@arnaudmiribel

Description

@arnaudmiribel

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

Page layout is not "centered" by default in multipage apps, as would be expected by the default value in st.set_page_config.

Instead, it inherits the layout from the previously visited page.

I would call it a bug, but could also hear that this is expected because no explicit call to st.set_page_config was made...

Example:
CleanShot 2023-03-06 at 15 48 29

Reproducible Code Example

#streamlit_app.py
import streamlit as st

st.write(st.__version__)
st.title("Hello world")
#pages/one.py
import streamlit as st

st.set_page_config(layout="wide")
st.title("Wide layout")
#pages/two.py
import streamlit as st

st.set_page_config(layout="centered")
st.title("Centered layout")


### Steps To Reproduce

_No response_

### Expected Behavior

The `streamlit_app` page should have its layout = `"centered"`, as is meant to be the default for `st.set_page_config()`.

### Current Behavior

The `streamlit_app` page inherits its layout from the previously visited page

### Is this a regression?

- [ ] Yes, this used to work in a previous version.

### Debug info

- Streamlit version: 1.19.0
- Python version: 
- Operating System: Mac OSX
- Browser: Chrome
- Virtual environment: None


### Additional Information

_No response_

### Are you willing to submit a PR?

- [ ] Yes, I am willing to submit a PR!

Metadata

Metadata

Assignees

Labels

feature:multipage-appsRelated to multipage app navigationpriority:P3Medium prioritystatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions