Not able to use streamlit extras component

Summary

i need to create a button that has width of the side bar in streamlit , i am tryiny to use from streamlit_extras.stylable_container but the libraray says reportmissingissue

Steps to reproduce

Code snippet:

add code here

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

I am using python 3.11 in vs code

Links

  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

Can you please your GitHub repo link or the code snippet where are you getting the error.

I think streamlit_extras.stylable_container library is not an offical one and it is not recommended also.
Instead you can use the st.sidebar function to create a sidebar and then use st.sidebar.button to create the button within sidebar.
For, changing the width of button you can use custom CSS to do the same, here you can use the st.markdown function to add custom css.
See st.markdown - Streamlit Docs
st.sidebar - Streamlit Docs


Probably no need to add CSS modifications because st.button accepts the kwarg use_container_width=True

import streamlit as st

with st.sidebar:
    st.button("default")
    st.button("use_container_width=**True**", use_container_width=True)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.