You can do it with CSS, but this should ONLY be considered a ālock on a screen doorā solution. As with any generic password field, anyone with some willingness to fiddle with their browser developer tools can inspect the element and change it from a password type to a normal text input, and get the password that way.
import streamlit as st
st.text_input("Password", type="password")
# Add css to hide item with title "Show password text"
st.markdown(
"""
<style>
[title="Show password text"] {
display: none;
}
</style>
""",
unsafe_allow_html=True,
)