Skip to content
13 changes: 13 additions & 0 deletions content/develop/api-reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ Display text in subheader formatting.
st.subheader("This is a subheader")
```

</RefCard>
<RefCard href="/develop/api-reference/text/st.badge">

<Image pure alt="screenshot" src="/images/api/badge.jpg" />

<h4>Badge</h4>

Display a small, colored badge.

```python
st.badge("New")
```

</RefCard>
<RefCard href="/develop/api-reference/text/st.caption">

Expand Down
2 changes: 2 additions & 0 deletions content/develop/api-reference/caching-and-state/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ description: st.context displays a read-only dict of cookies and headers

<Autofunction function="context.headers" />

<Autofunction function="context.locale" />

<Autofunction function="context.timezone" />

<Autofunction function="context.timezone_offset" />
63 changes: 13 additions & 50 deletions content/develop/api-reference/command-line/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,23 @@ When you install Streamlit, a command-line (CLI) tool gets installed
as well. The purpose of this tool is to run Streamlit apps, change Streamlit configuration options,
and help you diagnose and fix issues.

To see all of the supported commands:
## Available commands

```bash
streamlit --help
```

### Run Streamlit apps

```bash
streamlit run your_script.py [-- script args]
```

Runs your app. At any time you can stop the server with **Ctrl+c**.
- [`streamlit cache clear`](/develop/api-reference/cli/cache): Clear the on-disk cache.
- [`streamlit config show`](/develop/api-reference/cli/config): Show all configuration options.
- [`streamlit docs`](/develop/api-reference/cli/docs): Open the Streamlit docs.
- [`streamlit hello`](/develop/api-reference/cli/hello): Run an example Streamlit app.
- [`streamlit help`](/develop/api-reference/cli/help): Show the available CLI commands.
- [`streamlit init`](/develop/api-reference/cli/init): Create the files for a new Streamlit app.
- [`streamlit run`](/develop/api-reference/cli/run): Run your Streamlit app.
- [`streamlit version`](/develop/api-reference/cli/version): Show the version of Streamlit.

<Note>
### Run your app

When passing your script some custom arguments, **they must be passed after
two dashes**. Otherwise the arguments get interpreted as arguments to Streamlit
itself.

</Note>

To see the Streamlit 'Hello, World!' example app, run `streamlit hello`.

### View Streamlit version

To see what version of Streamlit is installed, just type:
The most important command is `streamlit run`, which is summarized for convenience here:

```bash
streamlit version
streamlit run your_script.py
```

### View documentation

```bash
streamlit docs
```

Opens the Streamlit documentation (i.e. this website) in a web browser.

### Clear cache

```bash
streamlit cache clear
```

Clears persisted files from the on-disk [Streamlit cache](/develop/api-reference/caching-and-state), if
present.

### View all configuration options

As described in [Configuration](/develop/concepts/configuration), Streamlit has several
configuration options. To view them all, including their current values, just type:

```bash
streamlit config show
```
At any time, in your terminal, you can stop the server with **Ctrl+C**.
14 changes: 14 additions & 0 deletions content/develop/api-reference/command-line/cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: streamlit cache
slug: /develop/api-reference/cli/cache
---

## `$ streamlit cache clear`

Clear persisted files from the on-disk [Streamlit cache](/develop/api-reference/caching-and-state), if present.

### Syntax

```
streamlit cache clear
```
14 changes: 14 additions & 0 deletions content/develop/api-reference/command-line/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: streamlit config show
slug: /develop/api-reference/cli/config
---

## `$ streamlit config show`

Print all the available configuration options, including their descriptions, default values, and current values. For more information about configuration options, see [`config.toml`](/develop/api-reference/configuration/config.toml).

### Syntax

```
streamlit config show
```
14 changes: 14 additions & 0 deletions content/develop/api-reference/command-line/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: streamlit docs
slug: /develop/api-reference/cli/docs
---

## `$ streamlit docs`

Open the Streamlit docs in your default browser.

### Syntax

```
streamlit docs
```
44 changes: 44 additions & 0 deletions content/develop/api-reference/command-line/hello.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: streamlit hello
slug: /develop/api-reference/cli/hello
---

## `$ streamlit hello`

Run the Hello app, an example Streamlit app included with the Streamlit library.

### Syntax

```
streamlit hello
```

### Options

The `hello` command accepts configuration options (just like the `run` command does). Configuration options are passed in the form of `--<section>.<option>=<value>`. For example, if you want to set the primary color of your app to blue, you could use one of the three equivalent options:

- `--theme.primaryColor=blue`
- `--theme.primaryColor="blue"`
- `--theme.primaryColor=#0000FF`

For a complete list of configuration options, see [`config.toml`](/develop/api-reference/configuration/config.toml) in the API reference. For examples, see below.

### Example

#### Example 1: Run the Hello app with default settings

To verify that Streamlit is installed correctly, this command runs an example app included in the Streamlit library. From any directory, execute the following:

```
streamlit hello
```

Streamlit will start the Hello app and open it in your default browser. The source for the Hello app can be [viewed in GitHub](https://github.com/streamlit/streamlit/tree/develop/lib/streamlit/hello).

#### Example 2: Run the Hello app with a custom config option value

To run the Hello app with a blue accent color, from any directory, execute the following:

```
streamlit hello --theme.primaryColor=blue
```
14 changes: 14 additions & 0 deletions content/develop/api-reference/command-line/help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: streamlit help
slug: /develop/api-reference/cli/help
---

## `$ streamlit help`

Print the available commands for the Streamlit CLI tool. This command is equivalent to executing `streamlit --help`.

### Syntax

```
streamlit help
```
63 changes: 63 additions & 0 deletions content/develop/api-reference/command-line/init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: streamlit init
slug: /develop/api-reference/cli/init
---

## `$ streamlit init`

This command creates the files for a new Streamlit app.

### Syntax

```
streamlit init <directory>
```

### Arguments

`<directory>` (Optional): The directory location of the new project. If no directory is provided, the current working directory will be used.

### Examples

#### Example 1: Create project files the current working directory

1. In your current working directory (CWD), execute the following:

```bash
streamlit init
```

Streamlit creates the following files:
```
CWD/
├── requirements.txt
└── streamlit_app.py
```

2. In your terminal, Streamlit prompts, `❓ Run the app now? [Y/n]`. Enter `Y` for yes.

This is equivalent to executing `streamlit run streamlit_app.py` from your current working directory.

3. Begin editing your `streamlit_app.py` file and save your changes.

#### Example 2: Create project files in another directory

1. In your current working directory (CWD), execute the following:

```bash
streamlit init project
```

Streamlit creates the following files:
```
CWD/
└── project/
├── requirements.txt
└── streamlit_app.py
```

2. In your terminal, Streamlit prompts, `❓ Run the app now? [Y/n]`. Enter `Y` for yes.

This is equivalent to executing `streamlit run project/streamlit_app.py` from your current working directory.

3. Begin editing your `streamlit_app.py` file and save your changes.
2 changes: 2 additions & 0 deletions content/develop/api-reference/command-line/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ slug: /develop/api-reference/cli/run

## `$ streamlit run`

This command starts your Streamlit app.

### Syntax

```
Expand Down
14 changes: 14 additions & 0 deletions content/develop/api-reference/command-line/version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: streamlit version
slug: /develop/api-reference/cli/version
---

## `$ streamlit version`

Print Streamlit's version number. This command is equivalent to executing `streamlit --version`.

### Syntax

```
streamlit version
```
Loading