Fullscreen mode for components.html() or components.iframe()

Hey, I want to have a view fullscreen option in the components.html() similar to the fullscreen option while displaying the dataframe in st.write().

I searched through the discussions and figured out that this has been fixed in https://github.com/streamlit/streamlit/pull/1713 .

However, I am not sure on how to use Element.requestFullscreen() web API with the components.html() to make the view fullscreen option available.

Any help in this regard will be highly appreciated!

1 Like

@Mahima-ai did you figure this out at all?

Sharing the answer from this thread here:

While we don’t prevent st.html components from calling Element.requestFullscreen() (which you can read more about here), we also don’t automatically add a fullscreen button overlay on the st.html component.

As a result, to have a fullscreen option display, you would need to do the following:

  1. The code that you pass to st.html would need to make a call to the Element.requestFullscreen() API.
  2. If you want a button to appear to allow users to select the fullscreen option, you’d need to implement it with HTML + JS in the code passed to st.html.

Thanks Caroline. I have not had a chance yet to try and implementation but I will look into it. I imagine with pydeck specifically it would require injecting in relevant code to replace the output to HTML pydeck generates.