St.date to grey out date from a list

Hi,

I would like to know if there is a way to give a list of dates to st.date, and have it grey out the rest of the dates.
e.g: in this case, the user wouldn’t be able to select July 1st, 4th and 5th.

Thank you,
Youssef A.

Hi @Youssef_Adiem, welcome to the Streamlit Community! :wave: :partying_face:

st.date_input’s min_value and max_value keyword parameters let you set the minimum selectable date and maximum selectable date, respectively. Dates not in those ranges will be greyed out like in the example below:

import streamlit as st
import datetime

d = st.date_input(
    "When's your birthday",
    value=datetime.date(2022, 7, 15),
    min_value=datetime.date(2022, 7, 10),
)

Notice all dates prior to July 10, 2022 are greyed out.

Unfortunately, it is not currently possible to grey out select dates as you’ve described. I would encourage you to submit a feature request on GitHub!

Best, :balloon:
Snehan

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