-
Notifications
You must be signed in to change notification settings - Fork 496
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* API pages and docstrings (#1117) * Update generate.py * Update streamlit.json * Add st.feedback page * fragment and dialog GA * Update generate.py * Update streamlit.json * Add st.context page * Update streamlit.json * Update streamlit.json * API reference cards * Release notes * Cheat sheet * Remove commented code Reference usage of components is available in style-guide.js * What's new * Remove curly quotes * Update streamlit version * Add workaround for context properties * Existing app updates (#1120) * Update config-toml.md (#1123)
- Loading branch information
1 parent
d630dac
commit 12ec72b
Showing
32 changed files
with
10,038 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -779,6 +779,19 @@ Display a download button widget. | |
st.download_button("Download file", file) | ||
``` | ||
|
||
</RefCard> | ||
<RefCard href="/develop/api-reference/widgets/st.feedback"> | ||
|
||
<Image pure alt="screenshot" src="/images/api/feedback.jpg" /> | ||
|
||
<h4>Feedback</h4> | ||
|
||
Display a rating or sentiment button group. | ||
|
||
```python | ||
st.feedback("stars") | ||
``` | ||
|
||
</RefCard> | ||
<RefCard href="/develop/api-reference/execution-flow/st.form_submit_button"> | ||
|
||
|
@@ -2277,7 +2290,8 @@ st.write(user_info) | |
Create and register a custom component. | ||
|
||
```python | ||
st.components.v1.declare_component( | ||
from st.components.v1 import declare_component | ||
declare_component( | ||
"custom_slider", | ||
"/frontend", | ||
) | ||
|
@@ -2292,7 +2306,8 @@ st.components.v1.declare_component( | |
Display an HTML string in an iframe. | ||
|
||
```python | ||
st.components.v1.html( | ||
from st.components.v1 import html | ||
html( | ||
"<p>Foo bar.</p>" | ||
) | ||
``` | ||
|
@@ -2306,7 +2321,8 @@ st.components.v1.html( | |
Load a remote URL in an iframe. | ||
|
||
```python | ||
st.components.v1.iframe( | ||
from st.components.v1 import iframe | ||
iframe( | ||
"docs.streamlit.io" | ||
) | ||
``` | ||
|
@@ -2320,17 +2336,15 @@ st.components.v1.iframe( | |
<br /> | ||
|
||
<TileContainer> | ||
<RefCard href="/develop/api-reference/utilities/st.experimental_user"> | ||
<RefCard href="/develop/api-reference/utilities/st.context"> | ||
|
||
<h4>User info</h4> | ||
<h4>Context</h4> | ||
|
||
`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud. | ||
`st.context` provides a read-only interface to access cookies and headers. | ||
|
||
```python | ||
if st.experimental_user.email == "[email protected]": | ||
st.write("Welcome back, ", st.experimental_user.email) | ||
else: | ||
st.write("You are not authorized to view this page.") | ||
st.context.cookies | ||
st.context.headers | ||
``` | ||
|
||
</RefCard> | ||
|
@@ -2353,12 +2367,21 @@ st.help(pd.DataFrame) | |
Renders HTML strings to your app. | ||
|
||
```python | ||
css = """ | ||
<style> | ||
p { color: red; } | ||
</style> | ||
""" | ||
st.html(css) | ||
st.html("<p>Foo bar.</p>") | ||
``` | ||
|
||
</RefCard> | ||
<RefCard href="/develop/api-reference/utilities/st.experimental_user" size="full"> | ||
|
||
<h4>User info</h4> | ||
|
||
`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud. | ||
|
||
```python | ||
if st.experimental_user.email == "[email protected]": | ||
st.write("Welcome back, ", st.experimental_user.email) | ||
else: | ||
st.write("You are not authorized to view this page.") | ||
``` | ||
|
||
</RefCard> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,17 +9,15 @@ There are a handful of methods that allow you to create placeholders in your | |
app, provide help using doc strings, get and modify configuration options and query parameters. | ||
|
||
<TileContainer> | ||
<RefCard href="/develop/api-reference/utilities/st.experimental_user" size="half"> | ||
<RefCard href="/develop/api-reference/utilities/st.context" size="half"> | ||
|
||
<h4>User info</h4> | ||
<h4>Context</h4> | ||
|
||
`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud. | ||
`st.context` provides a read-only interface to access cookies and headers. | ||
|
||
```python | ||
if st.experimental_user.email == "[email protected]": | ||
st.write("Welcome back, ", st.experimental_user.email) | ||
else: | ||
st.write("You are not authorized to view this page.") | ||
st.context.cookies | ||
st.context.headers | ||
``` | ||
|
||
</RefCard> | ||
|
@@ -42,12 +40,21 @@ st.help(pd.DataFrame) | |
Renders HTML strings to your app. | ||
|
||
```python | ||
css = """ | ||
<style> | ||
p { color: red; } | ||
</style> | ||
""" | ||
st.html(css) | ||
st.html("<p>Foo bar.</p>") | ||
``` | ||
|
||
</RefCard> | ||
<RefCard href="/develop/api-reference/utilities/st.experimental_user" size="half"> | ||
|
||
<h4>User info</h4> | ||
|
||
`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud. | ||
|
||
```python | ||
if st.experimental_user.email == "[email protected]": | ||
st.write("Welcome back, ", st.experimental_user.email) | ||
else: | ||
st.write("You are not authorized to view this page.") | ||
``` | ||
|
||
</RefCard> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: st.context | ||
slug: /develop/api-reference/utilities/st.context | ||
description: st.context displays a read-only dict of cookies and headers | ||
--- | ||
|
||
<Autofunction function="streamlit.context" /> | ||
|
||
<Autofunction function="context.cookies" /> | ||
|
||
<Autofunction function="context.headers" /> |
Oops, something went wrong.