axiom-coding-agent-setup 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/agent-browser/SKILL.md +55 -0
- package/.agents/skills/developing-with-streamlit/SKILL.md +220 -0
- package/.agents/skills/developing-with-streamlit/skills/building-streamlit-chat-ui/SKILL.md +195 -0
- package/.agents/skills/developing-with-streamlit/skills/building-streamlit-custom-components-v2/SKILL.md +233 -0
- package/.agents/skills/developing-with-streamlit/skills/building-streamlit-custom-components-v2/references/packaged-components.md +212 -0
- package/.agents/skills/developing-with-streamlit/skills/building-streamlit-custom-components-v2/references/state-sync.md +149 -0
- package/.agents/skills/developing-with-streamlit/skills/building-streamlit-custom-components-v2/references/theme-css-variables.md +243 -0
- package/.agents/skills/developing-with-streamlit/skills/building-streamlit-custom-components-v2/references/troubleshooting.md +121 -0
- package/.agents/skills/developing-with-streamlit/skills/building-streamlit-dashboards/SKILL.md +147 -0
- package/.agents/skills/developing-with-streamlit/skills/building-streamlit-multipage-apps/SKILL.md +218 -0
- package/.agents/skills/developing-with-streamlit/skills/choosing-streamlit-selection-widgets/SKILL.md +139 -0
- package/.agents/skills/developing-with-streamlit/skills/connecting-streamlit-to-snowflake/SKILL.md +188 -0
- package/.agents/skills/developing-with-streamlit/skills/creating-streamlit-themes/SKILL.md +486 -0
- package/.agents/skills/developing-with-streamlit/skills/displaying-streamlit-data/SKILL.md +199 -0
- package/.agents/skills/developing-with-streamlit/skills/improving-streamlit-design/SKILL.md +191 -0
- package/.agents/skills/developing-with-streamlit/skills/optimizing-streamlit-performance/SKILL.md +323 -0
- package/.agents/skills/developing-with-streamlit/skills/organizing-streamlit-code/SKILL.md +91 -0
- package/.agents/skills/developing-with-streamlit/skills/setting-up-streamlit-environment/SKILL.md +128 -0
- package/.agents/skills/developing-with-streamlit/skills/using-streamlit-cli/SKILL.md +165 -0
- package/.agents/skills/developing-with-streamlit/skills/using-streamlit-custom-components/SKILL.md +170 -0
- package/.agents/skills/developing-with-streamlit/skills/using-streamlit-layouts/SKILL.md +229 -0
- package/.agents/skills/developing-with-streamlit/skills/using-streamlit-markdown/SKILL.md +207 -0
- package/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state/SKILL.md +144 -0
- package/.agents/skills/developing-with-streamlit/templates/.gitattributes +3 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/README.md +188 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-companies/pyproject.toml +12 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-companies/streamlit_app.py +365 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-compute/pyproject.toml +12 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-compute/streamlit_app.py +461 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-compute-snowflake/.streamlit/secrets.toml.example +20 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-compute-snowflake/pyproject.toml +11 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-compute-snowflake/snowflake.yml +18 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-compute-snowflake/streamlit_app.py +527 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-feature-usage/pyproject.toml +12 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-feature-usage/streamlit_app.py +307 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-metrics/pyproject.toml +12 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-metrics/streamlit_app.py +426 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-metrics-snowflake/.streamlit/secrets.toml.example +20 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-metrics-snowflake/pyproject.toml +11 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-metrics-snowflake/snowflake.yml +18 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-metrics-snowflake/streamlit_app.py +463 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-seattle-weather/pyproject.toml +12 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-seattle-weather/streamlit_app.py +252 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-stock-peers/pyproject.toml +12 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-stock-peers/streamlit_app.py +342 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-stock-peers-snowflake/.streamlit/secrets.toml.example +20 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-stock-peers-snowflake/pyproject.toml +11 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-stock-peers-snowflake/snowflake.yml +18 -0
- package/.agents/skills/developing-with-streamlit/templates/apps/dashboard-stock-peers-snowflake/streamlit_app.py +384 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/README.md +128 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_configs/dracula.toml +39 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_configs/github.toml +37 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_configs/minimal.toml +39 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_configs/nord.toml +39 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_configs/snowflake.toml +42 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_configs/solarized-light.toml +38 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_configs/spotify.toml +34 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_configs/stripe.toml +35 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_shared/streamlit_app.py +336 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/_templates/pyproject.toml.tmpl +12 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/dracula/.streamlit/config.toml +39 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/dracula/pyproject.toml +10 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/dracula/streamlit_app.py +337 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/github/.streamlit/config.toml +37 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/github/pyproject.toml +10 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/github/streamlit_app.py +337 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/manage.py +332 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/minimal/.streamlit/config.toml +39 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/minimal/pyproject.toml +10 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/minimal/streamlit_app.py +337 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/nord/.streamlit/config.toml +39 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/nord/pyproject.toml +10 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/nord/streamlit_app.py +337 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/snowflake/.streamlit/config.toml +42 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/snowflake/pyproject.toml +10 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/snowflake/streamlit_app.py +337 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/solarized-light/.streamlit/config.toml +38 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/solarized-light/pyproject.toml +10 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/solarized-light/streamlit_app.py +337 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/spotify/.streamlit/config.toml +34 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/spotify/pyproject.toml +10 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/spotify/streamlit_app.py +337 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/stripe/.streamlit/config.toml +35 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/stripe/pyproject.toml +10 -0
- package/.agents/skills/developing-with-streamlit/templates/themes/stripe/streamlit_app.py +337 -0
- package/.agents/skills/fastapi/SKILL.md +436 -0
- package/.agents/skills/fastapi/references/dependencies.md +142 -0
- package/.agents/skills/fastapi/references/other-tools.md +76 -0
- package/.agents/skills/fastapi/references/streaming.md +105 -0
- package/.agents/skills/frontend-design/LICENSE.txt +177 -0
- package/.agents/skills/frontend-design/SKILL.md +42 -0
- package/.agents/skills/gradio/SKILL.md +84 -0
- package/.agents/skills/gradio/references/api-signatures.md +115 -0
- package/.agents/skills/gradio/references/event-listeners.md +130 -0
- package/.agents/skills/gradio/references/examples.md +613 -0
- package/.agents/skills/ui-ux-pro-max/SKILL.md +659 -0
- package/.agents/skills/ui-ux-pro-max/data +1 -0
- package/.agents/skills/ui-ux-pro-max/scripts +1 -0
- package/.env.axiom +8 -0
- package/AGENTS.md +2 -1
- package/README.md +19 -3
- package/bin/cli.js +11 -1
- package/opencode.json +7 -4
- package/package.json +1 -1
- package/skills-lock.json +36 -0
- package/.agents/skills/n8n-patterns/SKILL.md +0 -272
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
## Streamlit theme CSS variables for CCv2 components (`--st-*`)
|
|
2
|
+
|
|
3
|
+
Streamlit injects a set of `--st-*` CSS custom properties into CCv2 components so your component can match the app’s active theme from within your component CSS (including when `isolate_styles=True` and you’re rendering inside a shadow root).
|
|
4
|
+
|
|
5
|
+
**Recommendation:** Prefer `var(--st-…)` over hard-coded colors and sizes. These variables automatically adapt to a user's current Streamlit theme (light/dark/custom), so most components **do not** need separate “dark mode vs light mode” styling.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- Quick start
|
|
10
|
+
- Gotchas: serialization + fallbacks
|
|
11
|
+
- Cheat sheet: the 90% variables (intent → `--st-*`)
|
|
12
|
+
- Foundation tokens (surfaces, text, borders, shape)
|
|
13
|
+
- Typography tokens
|
|
14
|
+
- Data display tokens (dataframes/tables)
|
|
15
|
+
- Data visualization tokens (chart palettes)
|
|
16
|
+
- Semantic/status palette (red/green/etc.)
|
|
17
|
+
- Appendix: full variable index (alphabetical)
|
|
18
|
+
|
|
19
|
+
### Quick start
|
|
20
|
+
|
|
21
|
+
Use them like any CSS variable:
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
.card {
|
|
25
|
+
background: var(--st-secondary-background-color);
|
|
26
|
+
color: var(--st-text-color);
|
|
27
|
+
border: 1px solid var(--st-border-color);
|
|
28
|
+
border-radius: var(--st-base-radius);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.primaryButton {
|
|
32
|
+
background: var(--st-primary-color);
|
|
33
|
+
color: var(--st-background-color);
|
|
34
|
+
border-radius: var(--st-button-radius);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Gotchas: serialization rules + safe fallbacks
|
|
39
|
+
|
|
40
|
+
These variables originate from Streamlit’s theme object and are serialized into strings:
|
|
41
|
+
|
|
42
|
+
- **Strings**: passed through (e.g. `--st-primary-color: #ff4b4b`).
|
|
43
|
+
- **Numbers**: stringified (e.g. `--st-base-font-weight: 400`).
|
|
44
|
+
- **Booleans**: become `"1"` or `"0"` (e.g. `--st-link-underline`).
|
|
45
|
+
- **Arrays**: become a comma-joined string (e.g. `--st-heading-font-sizes: 2.75rem,2.25rem,...`).
|
|
46
|
+
- If you need individual items in JS, split on `","`.
|
|
47
|
+
- **Missing values (`null` / `undefined`)**: become `unset` so consumers fall back to initial/inherited CSS behavior.
|
|
48
|
+
|
|
49
|
+
### Cheat sheet: the 90% variables (intent → `--st-*`)
|
|
50
|
+
|
|
51
|
+
Use this section as your starting point. It covers what most components need most of the time.
|
|
52
|
+
|
|
53
|
+
| Intent | Variables |
|
|
54
|
+
| ------------------------- | ---------------------------------------------------------------------- |
|
|
55
|
+
| App/page background | `--st-background-color` |
|
|
56
|
+
| Panel/card background | `--st-secondary-background-color` |
|
|
57
|
+
| Body text | `--st-text-color` |
|
|
58
|
+
| Headings | `--st-heading-color`, `--st-heading-font` |
|
|
59
|
+
| Primary accent / emphasis | `--st-primary-color` |
|
|
60
|
+
| Links | `--st-link-color`, `--st-link-underline` |
|
|
61
|
+
| Borders / dividers | `--st-border-color`, `--st-border-color-light` |
|
|
62
|
+
| Widget outline borders | `--st-widget-border-color` |
|
|
63
|
+
| Corner radius | `--st-base-radius`, `--st-button-radius` |
|
|
64
|
+
| Code blocks | `--st-code-background-color`, `--st-code-text-color`, `--st-code-font` |
|
|
65
|
+
|
|
66
|
+
### Foundation tokens (surfaces, text, borders, shape)
|
|
67
|
+
|
|
68
|
+
#### Surfaces and content colors
|
|
69
|
+
|
|
70
|
+
- `--st-background-color` (page background)
|
|
71
|
+
- `--st-secondary-background-color` (panels, cards, containers)
|
|
72
|
+
- `--st-text-color` (default text)
|
|
73
|
+
- `--st-heading-color` (derived heading color)
|
|
74
|
+
- `--st-primary-color` (brand / accent)
|
|
75
|
+
- `--st-link-color` (link color)
|
|
76
|
+
- `--st-link-underline` (boolean serialized to `"1"` / `"0"`)
|
|
77
|
+
|
|
78
|
+
#### Borders and separators
|
|
79
|
+
|
|
80
|
+
- `--st-border-color` (default borders/dividers)
|
|
81
|
+
- `--st-border-color-light` (derived lighter border)
|
|
82
|
+
- `--st-widget-border-color` (widget borders)
|
|
83
|
+
|
|
84
|
+
#### Shape (radii)
|
|
85
|
+
|
|
86
|
+
- `--st-base-radius`
|
|
87
|
+
- `--st-button-radius`
|
|
88
|
+
|
|
89
|
+
#### Code block colors
|
|
90
|
+
|
|
91
|
+
- `--st-code-background-color`
|
|
92
|
+
- `--st-code-text-color`
|
|
93
|
+
|
|
94
|
+
### Typography tokens
|
|
95
|
+
|
|
96
|
+
#### Font families
|
|
97
|
+
|
|
98
|
+
- `--st-font` (body font)
|
|
99
|
+
- `--st-heading-font`
|
|
100
|
+
- `--st-code-font`
|
|
101
|
+
|
|
102
|
+
#### Body sizing and weights
|
|
103
|
+
|
|
104
|
+
- `--st-base-font-size`
|
|
105
|
+
- `--st-base-font-weight` (number)
|
|
106
|
+
|
|
107
|
+
#### Headings (H1–H6)
|
|
108
|
+
|
|
109
|
+
Arrays (comma-joined):
|
|
110
|
+
|
|
111
|
+
- `--st-heading-font-sizes` (array; typically 6 values for H1–H6)
|
|
112
|
+
- `--st-heading-font-weights` (array; typically 6 values for H1–H6)
|
|
113
|
+
|
|
114
|
+
Per-level convenience variables:
|
|
115
|
+
|
|
116
|
+
- `--st-heading-font-size-1`
|
|
117
|
+
- `--st-heading-font-size-2`
|
|
118
|
+
- `--st-heading-font-size-3`
|
|
119
|
+
- `--st-heading-font-size-4`
|
|
120
|
+
- `--st-heading-font-size-5`
|
|
121
|
+
- `--st-heading-font-size-6`
|
|
122
|
+
- `--st-heading-font-weight-1` (number)
|
|
123
|
+
- `--st-heading-font-weight-2` (number)
|
|
124
|
+
- `--st-heading-font-weight-3` (number)
|
|
125
|
+
- `--st-heading-font-weight-4` (number)
|
|
126
|
+
- `--st-heading-font-weight-5` (number)
|
|
127
|
+
- `--st-heading-font-weight-6` (number)
|
|
128
|
+
|
|
129
|
+
#### Code typography
|
|
130
|
+
|
|
131
|
+
- `--st-code-font-size`
|
|
132
|
+
- `--st-code-font-weight` (number)
|
|
133
|
+
|
|
134
|
+
### Data display tokens (dataframes/tables)
|
|
135
|
+
|
|
136
|
+
- `--st-dataframe-border-color`
|
|
137
|
+
- `--st-dataframe-header-background-color`
|
|
138
|
+
|
|
139
|
+
### Data visualization tokens (chart palettes)
|
|
140
|
+
|
|
141
|
+
Chart palette variables are **arrays serialized as comma-joined strings**:
|
|
142
|
+
|
|
143
|
+
- `--st-chart-categorical-colors` (discrete series)
|
|
144
|
+
- `--st-chart-sequential-colors` (low → high)
|
|
145
|
+
- `--st-chart-diverging-colors` (negative ↔ positive around a midpoint)
|
|
146
|
+
|
|
147
|
+
If you need the palette values in JS, split on commas:
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
export default function (component) {
|
|
151
|
+
const { parentElement } = component;
|
|
152
|
+
|
|
153
|
+
const host = parentElement.host ?? parentElement;
|
|
154
|
+
const raw = getComputedStyle(host)
|
|
155
|
+
.getPropertyValue('--st-chart-categorical-colors')
|
|
156
|
+
.trim();
|
|
157
|
+
const palette = raw ? raw.split(',') : [];
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Semantic/status palette
|
|
162
|
+
|
|
163
|
+
These are best for status UI (badges, alerts, validation messages), not for primary layout surfaces.
|
|
164
|
+
|
|
165
|
+
Each “family” typically comes in three variants:
|
|
166
|
+
|
|
167
|
+
- **Base**: `--st-<name>-color`
|
|
168
|
+
- **Background**: `--st-<name>-background-color`
|
|
169
|
+
- **Text**: `--st-<name>-text-color`
|
|
170
|
+
|
|
171
|
+
Families:
|
|
172
|
+
|
|
173
|
+
- Red: `--st-red-color`, `--st-red-background-color`, `--st-red-text-color`
|
|
174
|
+
- Orange: `--st-orange-color`, `--st-orange-background-color`, `--st-orange-text-color`
|
|
175
|
+
- Yellow: `--st-yellow-color`, `--st-yellow-background-color`, `--st-yellow-text-color`
|
|
176
|
+
- Blue: `--st-blue-color`, `--st-blue-background-color`, `--st-blue-text-color`
|
|
177
|
+
- Green: `--st-green-color`, `--st-green-background-color`, `--st-green-text-color`
|
|
178
|
+
- Violet: `--st-violet-color`, `--st-violet-background-color`, `--st-violet-text-color`
|
|
179
|
+
- Gray: `--st-gray-color`, `--st-gray-background-color`, `--st-gray-text-color`
|
|
180
|
+
|
|
181
|
+
### Appendix: full variable index (alphabetical)
|
|
182
|
+
|
|
183
|
+
- `--st-background-color`
|
|
184
|
+
- `--st-base-font-size`
|
|
185
|
+
- `--st-base-font-weight`
|
|
186
|
+
- `--st-base-radius`
|
|
187
|
+
- `--st-blue-background-color`
|
|
188
|
+
- `--st-blue-color`
|
|
189
|
+
- `--st-blue-text-color`
|
|
190
|
+
- `--st-border-color`
|
|
191
|
+
- `--st-border-color-light`
|
|
192
|
+
- `--st-button-radius`
|
|
193
|
+
- `--st-chart-categorical-colors`
|
|
194
|
+
- `--st-chart-diverging-colors`
|
|
195
|
+
- `--st-chart-sequential-colors`
|
|
196
|
+
- `--st-code-background-color`
|
|
197
|
+
- `--st-code-font`
|
|
198
|
+
- `--st-code-font-size`
|
|
199
|
+
- `--st-code-font-weight`
|
|
200
|
+
- `--st-code-text-color`
|
|
201
|
+
- `--st-dataframe-border-color`
|
|
202
|
+
- `--st-dataframe-header-background-color`
|
|
203
|
+
- `--st-font`
|
|
204
|
+
- `--st-gray-background-color`
|
|
205
|
+
- `--st-gray-color`
|
|
206
|
+
- `--st-gray-text-color`
|
|
207
|
+
- `--st-green-background-color`
|
|
208
|
+
- `--st-green-color`
|
|
209
|
+
- `--st-green-text-color`
|
|
210
|
+
- `--st-heading-color`
|
|
211
|
+
- `--st-heading-font`
|
|
212
|
+
- `--st-heading-font-size-1`
|
|
213
|
+
- `--st-heading-font-size-2`
|
|
214
|
+
- `--st-heading-font-size-3`
|
|
215
|
+
- `--st-heading-font-size-4`
|
|
216
|
+
- `--st-heading-font-size-5`
|
|
217
|
+
- `--st-heading-font-size-6`
|
|
218
|
+
- `--st-heading-font-sizes`
|
|
219
|
+
- `--st-heading-font-weight-1`
|
|
220
|
+
- `--st-heading-font-weight-2`
|
|
221
|
+
- `--st-heading-font-weight-3`
|
|
222
|
+
- `--st-heading-font-weight-4`
|
|
223
|
+
- `--st-heading-font-weight-5`
|
|
224
|
+
- `--st-heading-font-weight-6`
|
|
225
|
+
- `--st-heading-font-weights`
|
|
226
|
+
- `--st-link-color`
|
|
227
|
+
- `--st-link-underline`
|
|
228
|
+
- `--st-orange-background-color`
|
|
229
|
+
- `--st-orange-color`
|
|
230
|
+
- `--st-orange-text-color`
|
|
231
|
+
- `--st-primary-color`
|
|
232
|
+
- `--st-red-background-color`
|
|
233
|
+
- `--st-red-color`
|
|
234
|
+
- `--st-red-text-color`
|
|
235
|
+
- `--st-secondary-background-color`
|
|
236
|
+
- `--st-text-color`
|
|
237
|
+
- `--st-violet-background-color`
|
|
238
|
+
- `--st-violet-color`
|
|
239
|
+
- `--st-violet-text-color`
|
|
240
|
+
- `--st-widget-border-color`
|
|
241
|
+
- `--st-yellow-background-color`
|
|
242
|
+
- `--st-yellow-color`
|
|
243
|
+
- `--st-yellow-text-color`
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
## Troubleshooting CCv2 components
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Packaged assets and manifests (`asset_dir`, component key)
|
|
6
|
+
- Renaming / placeholder drift
|
|
7
|
+
- Inline strings vs file-backed assets (path heuristic)
|
|
8
|
+
- Globs (0 matches or multiple matches)
|
|
9
|
+
- Defaults, callbacks, and missing result attributes
|
|
10
|
+
- Keys (Python `key=` vs frontend `key`)
|
|
11
|
+
- Shadow DOM / `isolate_styles` surprises
|
|
12
|
+
- Frontend build (Vite) gotchas
|
|
13
|
+
- DOM clobbering (overwriting injected HTML/CSS)
|
|
14
|
+
|
|
15
|
+
### Packaged assets and manifests (`asset_dir`, component key)
|
|
16
|
+
|
|
17
|
+
#### “Component '<name>' must be declared in pyproject.toml with asset_dir to use file-backed js/css.”
|
|
18
|
+
|
|
19
|
+
You passed a **path-like** `js=`/`css=` string (like `index-*.js` or `assets/index-*.js`) but Streamlit can’t find an `asset_dir` for this component key.
|
|
20
|
+
|
|
21
|
+
Fix:
|
|
22
|
+
|
|
23
|
+
- If you want **inline JS/CSS**, pass a **multi-line** string with the actual code (not a path).
|
|
24
|
+
- If you want **packaged assets**, ensure:
|
|
25
|
+
- Your wheel includes a `pyproject.toml` with `[[tool.streamlit.component.components]] ... asset_dir = ...`
|
|
26
|
+
- You call `st.components.v2.component("<project>.<component>", js="...", css="...")` with the matching fully-qualified key.
|
|
27
|
+
|
|
28
|
+
Important context:
|
|
29
|
+
|
|
30
|
+
- This error is expected if you test packaged wrappers via plain Python import in some environments.
|
|
31
|
+
- Prefer `streamlit run ...` for packaged verification because manifest discovery is part of Streamlit runtime initialization.
|
|
32
|
+
|
|
33
|
+
### Inline strings vs file-backed assets (path heuristic)
|
|
34
|
+
|
|
35
|
+
CCv2 uses a heuristic: strings that “look like” paths are treated as file references. A multi-line string is always treated as inline content.
|
|
36
|
+
|
|
37
|
+
Fix:
|
|
38
|
+
|
|
39
|
+
- Prefer triple-quoted multi-line strings for inline `html`/`css`/`js`.
|
|
40
|
+
- Avoid single-line minified JS/CSS in `js=`/`css=`; add a newline if you must.
|
|
41
|
+
|
|
42
|
+
### Globs (0 matches or multiple matches)
|
|
43
|
+
|
|
44
|
+
Globs must match **exactly one** file under `asset_dir`.
|
|
45
|
+
|
|
46
|
+
Fix:
|
|
47
|
+
|
|
48
|
+
- Clean the build output directory before rebuilding.
|
|
49
|
+
- Make your bundler output a predictable `index-<hash>.js` / `index-<hash>.css` (or `assets/index-<hash>...` if you emit into an `assets/` subdir).
|
|
50
|
+
- If you started from Streamlit’s `component-template`, run `npm run clean` from your `frontend/` directory to clear the `build/` output so `index-*.js` matches exactly one file.
|
|
51
|
+
|
|
52
|
+
### Renamed project/package still shows old template names
|
|
53
|
+
|
|
54
|
+
Symptoms:
|
|
55
|
+
|
|
56
|
+
- Old names like `streamlit-component-x` / `streamlit_component_x` remain in paths or metadata.
|
|
57
|
+
- Imports, manifest component keys, and registration keys no longer align.
|
|
58
|
+
|
|
59
|
+
Fix:
|
|
60
|
+
|
|
61
|
+
- Rename/update all related surfaces together:
|
|
62
|
+
- root `pyproject.toml` project name
|
|
63
|
+
- import package folder and `MANIFEST.in` paths
|
|
64
|
+
- `[tool.setuptools.packages.find]` and `[tool.setuptools.package-data]`
|
|
65
|
+
- in-package manifest (`<import_name>/pyproject.toml`)
|
|
66
|
+
- wrapper registration key (`"<project.name>.<component.name>"`)
|
|
67
|
+
- README/example imports and install commands
|
|
68
|
+
- Rebuild frontend and reinstall editable package after rename.
|
|
69
|
+
|
|
70
|
+
### Defaults, callbacks, and missing result attributes
|
|
71
|
+
|
|
72
|
+
#### `default={...}` doesn’t apply / missing result attributes
|
|
73
|
+
|
|
74
|
+
Defaults only apply to **state keys**, and Streamlit expects those keys to be declared via `on_<key>_change` callback parameters at mount time.
|
|
75
|
+
|
|
76
|
+
Fix:
|
|
77
|
+
|
|
78
|
+
- If you pass `default={"value": ...}`, also pass `on_value_change=lambda: None`.
|
|
79
|
+
- For triggers, don’t expect defaults; triggers are transient and default to `None`.
|
|
80
|
+
|
|
81
|
+
### Keys (Python `key=` vs frontend `key`)
|
|
82
|
+
|
|
83
|
+
- Python `key=` is the user-visible Streamlit element key.
|
|
84
|
+
- The frontend also receives a `key` string that is **generated by Streamlit** and is not the same as the Python `key` unless you explicitly pass the user key through `data`.
|
|
85
|
+
|
|
86
|
+
Fix:
|
|
87
|
+
|
|
88
|
+
- If your frontend needs a stable identifier, pass it in `data={"user_key": key, ...}`.
|
|
89
|
+
|
|
90
|
+
### Shadow DOM / `isolate_styles` surprises
|
|
91
|
+
|
|
92
|
+
#### Shadow DOM (`isolate_styles=True`) surprises
|
|
93
|
+
|
|
94
|
+
With `isolate_styles=True` (default):
|
|
95
|
+
|
|
96
|
+
- Your component is mounted in a **shadow root**.
|
|
97
|
+
- `parentElement` is a `ShadowRoot`.
|
|
98
|
+
- Global CSS (like Tailwind injected into the document) won’t automatically style your component.
|
|
99
|
+
|
|
100
|
+
Fix:
|
|
101
|
+
|
|
102
|
+
- Keep `isolate_styles=True` for safety and use CSS variables and component-local styles.
|
|
103
|
+
- Use `isolate_styles=False` only when you intentionally need global styling behavior.
|
|
104
|
+
|
|
105
|
+
### Frontend build gotchas (Vite)
|
|
106
|
+
|
|
107
|
+
If you deviate from the template’s Vite config (or you’re wiring Vite into an existing repo), these are the common footguns:
|
|
108
|
+
|
|
109
|
+
- **Missing `base: "./"`**: relative asset URLs can break when served from Streamlit’s component URL path.
|
|
110
|
+
- **Stale build artifacts**: Vite outputs hashed filenames; if you keep old builds around, `index-*.js` can match multiple files. Clean the build dir before rebuilding.
|
|
111
|
+
|
|
112
|
+
### DOM clobbering (overwriting injected HTML/CSS)
|
|
113
|
+
|
|
114
|
+
#### Accidentally overwriting your component DOM
|
|
115
|
+
|
|
116
|
+
If you directly set `parentElement.innerHTML = ...`, you can overwrite the HTML/CSS that Streamlit injected from your `html=`/`css=` arguments.
|
|
117
|
+
|
|
118
|
+
Fix:
|
|
119
|
+
|
|
120
|
+
- Prefer `querySelector` + modifying children.
|
|
121
|
+
- If you need dynamic HTML, create a new child element and set **that** element’s `innerHTML`.
|
package/.agents/skills/developing-with-streamlit/skills/building-streamlit-dashboards/SKILL.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: building-streamlit-dashboards
|
|
3
|
+
description: Building dashboards in Streamlit. Use when creating KPI displays, metric cards, or data-heavy layouts. Covers borders, cards, responsive layouts, and dashboard composition.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Streamlit dashboards
|
|
8
|
+
|
|
9
|
+
Compose metrics, charts, and data into clean dashboard layouts.
|
|
10
|
+
|
|
11
|
+
## Cards with borders
|
|
12
|
+
|
|
13
|
+
Use `border=True` to create visual cards. Supported on `st.container`, `st.metric`, `st.columns`, and `st.form`:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
# Container card
|
|
17
|
+
with st.container(border=True):
|
|
18
|
+
st.subheader("Sales Overview")
|
|
19
|
+
st.line_chart(sales_data)
|
|
20
|
+
|
|
21
|
+
# Metric card
|
|
22
|
+
st.metric("Revenue", "$1.2M", "+12%", border=True)
|
|
23
|
+
|
|
24
|
+
# Column cards
|
|
25
|
+
for col in st.columns(3, border=True):
|
|
26
|
+
with col:
|
|
27
|
+
st.metric("Users", "1.2k")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Card labels
|
|
31
|
+
|
|
32
|
+
Add context to cards with headers or bold text:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
# With subheader
|
|
36
|
+
with st.container(border=True):
|
|
37
|
+
st.subheader("Monthly Trends")
|
|
38
|
+
st.line_chart(data)
|
|
39
|
+
|
|
40
|
+
# With bold label
|
|
41
|
+
with st.container(border=True):
|
|
42
|
+
st.markdown("**Top Products**")
|
|
43
|
+
st.dataframe(top_products)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## KPI rows
|
|
47
|
+
|
|
48
|
+
Use horizontal containers for responsive metric rows:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
with st.container(horizontal=True):
|
|
52
|
+
st.metric("Revenue", "$1.2M", "-7%", border=True)
|
|
53
|
+
st.metric("Users", "762k", "+12%", border=True)
|
|
54
|
+
st.metric("Orders", "1.4k", "+5%", border=True)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Horizontal containers wrap on smaller screens. Prefer them over `st.columns` for metric rows.
|
|
58
|
+
|
|
59
|
+
## Metrics with sparklines
|
|
60
|
+
|
|
61
|
+
Add trend context with `chart_data`:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
weekly_values = [700, 720, 715, 740, 762, 755, 780]
|
|
65
|
+
|
|
66
|
+
st.metric(
|
|
67
|
+
"Active Users",
|
|
68
|
+
"780k",
|
|
69
|
+
"+3.2%",
|
|
70
|
+
border=True,
|
|
71
|
+
chart_data=weekly_values,
|
|
72
|
+
chart_type="line", # or "bar"
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Sparklines show y-values only—use for evenly-spaced data like daily/weekly snapshots.
|
|
77
|
+
|
|
78
|
+
## Dashboard layout
|
|
79
|
+
|
|
80
|
+
Combine cards into a dashboard:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
# KPI row
|
|
84
|
+
with st.container(horizontal=True):
|
|
85
|
+
st.metric("Revenue", "$1.2M", "-7%", border=True, chart_data=rev_trend, chart_type="line")
|
|
86
|
+
st.metric("Users", "762k", "+12%", border=True, chart_data=user_trend, chart_type="line")
|
|
87
|
+
st.metric("Orders", "1.4k", "+5%", border=True, chart_data=order_trend, chart_type="bar")
|
|
88
|
+
|
|
89
|
+
# Charts row
|
|
90
|
+
col1, col2 = st.columns(2)
|
|
91
|
+
with col1:
|
|
92
|
+
with st.container(border=True):
|
|
93
|
+
st.subheader("Revenue by Region")
|
|
94
|
+
st.bar_chart(region_data, x="region", y="revenue")
|
|
95
|
+
|
|
96
|
+
with col2:
|
|
97
|
+
with st.container(border=True):
|
|
98
|
+
st.subheader("Monthly Trend")
|
|
99
|
+
st.line_chart(monthly_data, x="month", y="value")
|
|
100
|
+
|
|
101
|
+
# Data table
|
|
102
|
+
with st.container(border=True):
|
|
103
|
+
st.subheader("Recent Orders")
|
|
104
|
+
st.dataframe(orders_df, hide_index=True)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Sidebar filters
|
|
108
|
+
|
|
109
|
+
Put filters in the sidebar to maximize dashboard space:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
with st.sidebar:
|
|
113
|
+
date_range = st.date_input("Date range", value=(start, end))
|
|
114
|
+
region = st.multiselect("Region", regions, default=regions)
|
|
115
|
+
|
|
116
|
+
# Main area is all dashboard content
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Dashboard templates
|
|
120
|
+
|
|
121
|
+
Ready-to-use dashboard templates are available in `templates/apps/`:
|
|
122
|
+
|
|
123
|
+
| Template | Features |
|
|
124
|
+
|----------|----------|
|
|
125
|
+
| `dashboard-metrics` | Metric cards with sparklines, date filtering, focus mode |
|
|
126
|
+
| `dashboard-metrics-snowflake` | Same as above, with Snowflake connection |
|
|
127
|
+
| `dashboard-companies` | Company comparison, filterable data tables |
|
|
128
|
+
| `dashboard-compute` | `@st.fragment` for independent updates, popover filters |
|
|
129
|
+
| `dashboard-compute-snowflake` | Same as above, with Snowflake connection |
|
|
130
|
+
| `dashboard-feature-usage` | Feature adoption tracking, trend analysis |
|
|
131
|
+
| `dashboard-seattle-weather` | Weather data visualization |
|
|
132
|
+
| `dashboard-stock-peers` | Stock peer comparison |
|
|
133
|
+
| `dashboard-stock-peers-snowflake` | Same as above, with Snowflake connection |
|
|
134
|
+
|
|
135
|
+
Each template uses synthetic data that can be replaced with real queries. See `templates/apps/README.md` for setup instructions.
|
|
136
|
+
|
|
137
|
+
## Related skills
|
|
138
|
+
|
|
139
|
+
- `using-streamlit-layouts`: Columns, containers, tabs, dialogs
|
|
140
|
+
- `displaying-streamlit-data`: Charts, dataframes, column configuration
|
|
141
|
+
- `optimizing-streamlit-performance`: Caching and fragments for heavy dashboards
|
|
142
|
+
|
|
143
|
+
## References
|
|
144
|
+
|
|
145
|
+
- [st.container](https://docs.streamlit.io/develop/api-reference/layout/st.container)
|
|
146
|
+
- [st.metric](https://docs.streamlit.io/develop/api-reference/data/st.metric)
|
|
147
|
+
- [st.columns](https://docs.streamlit.io/develop/api-reference/layout/st.columns)
|