Skip to content

Commit 2cefb52

Browse files
fix: Correct st.chat_input position (#3)
1 parent 9435a12 commit 2cefb52

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

streamlit_navigation_bar/templates/base.css

+21
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ iframe[title="streamlit_navigation_bar.st_navbar"] {
1414
left: 0;
1515
}
1616
header[data-testid="stHeader"] {
17+
/* In order for the navbar to not "blink" when switching pages */
1718
z-index: 0;
19+
20+
/* Match navbar's height, e.g. for when `margin` is `True` */
1821
height: {{ ui.height }};
22+
23+
/* Match navbar's background color, e.g. for when `margin` is `True` */
1924
background-color: {{ ui.bg_color }};
2025
}
26+
div[data-testid="stAppViewBlockContainer"] {
27+
/* Match Streamlit's default spacing after the body */
28+
margin-bottom: calc(5.875rem + {{ ui.height }});
29+
}
2130
#stDecoration {
2231
visibility: hidden;
2332
}
@@ -29,7 +38,10 @@ header[data-testid="stHeader"] {
2938
{% block hide_menu %}{% endblock %}
3039
{% endif %}
3140
div[data-testid="stToolbar"] {
41+
/* Align the button vertically to the navbar pages */
3242
top: calc(({{ ui.height }} - 2rem) / 2);
43+
44+
/* Leave space to the left that is equal to the top and bottom */
3345
right: 0.3125rem;
3446
}
3547
div[class="stStatusWidget"] {
@@ -69,7 +81,10 @@ section.main {
6981
{% block hide_sidebar %}{% endblock %}
7082
{% endif %}
7183
div[data-testid="collapsedControl"] {
84+
/* Align the button vertically to the navbar pages */
7285
top: calc(({{ ui.height }} - 2rem) / 2);
86+
87+
/* Leave space to the right that is equal to the top and bottom */
7388
left: 0.3125rem;
7489
}
7590
div[data-testid="collapsedControl"] path:nth-of-type(2) {
@@ -85,6 +100,12 @@ div[data-testid="stSidebarContent"] button[data-testid="baseButton-header"]:hove
85100
background-color: rgba(151, 166, 195, 0.25);
86101
}
87102

103+
{# style_chat_input #}
104+
div[data-testid="stBottom"] {
105+
/* Compensate for section.main being repositioned */
106+
bottom: {{ ui.height }};
107+
}
108+
88109
{# fix_shadow #}
89110
{% if options["fix_shadow"] %}
90111
{% block fix_shadow %}{% endblock %}

streamlit_navigation_bar/templates/options.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ div[data-testid="collapsedControl"] {
1313
{% endblock %}
1414

1515
{% block fix_shadow %}
16-
section[data-testid='stSidebar'] {
16+
section[data-testid="stSidebar"] {
1717
box-shadow: rgba(0, 0, 0, 0.16) -2rem 0px 2rem 2rem;
1818
}
1919
{% endblock %}

0 commit comments

Comments
 (0)