Remove fade out when disabling an input widget

I am running a simple code locally.

import streamlit as st
st.text_input("lorem", disabled=False)

I would like not to have this fade out effect that greys out the widget. Is that possible?

Hey Hi !
you can use custom HTML and CSS with streamlit also they example below may work

import streamlit as st

# Add custom HTML and CSS to style the disabled input
st.markdown("""
    <style>
        /* Add your custom styling here */
        .disabled-input {
            color: #000 !important;  /* Set text color for disabled input */
            background-color: #f8f9fa !important;  /* Set background color for disabled input */
            border: 1px solid #ced4da !important;  /* Set border color for disabled input */
        }
    </style>
""", unsafe_allow_html=True)

# Create a text input with custom styling
st.text_input("lorem", key="my_input", disabled=False, help="This is a custom-styled input.")

# Disable the input using JavaScript after the page loads
st.script("""
    document.getElementById("my_input").disabled = true;
""")

I get the error
AttributeError: module β€˜streamlit’ has no attribute β€˜script’

But even if I disable the text_input at run without the st.script, the fade effect still there despite your markdown style configuration.

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