using-streamlit-session-state
CommunityPersist widget state across Streamlit reruns.
Authorn-elia
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Streamlit reruns the entire script on every interaction, resetting non-persistent variables. This Skill shows how to use st.session_state to persist values across reruns, enabling stable, per-user experiences.
Core Features & Use Cases
- Persist widget state across reruns by linking widgets to session_state via keys.
- Initialize and safely access session data, avoiding KeyError and race conditions.
- Implement per-page or multi-page state sharing and robust callbacks.
Quick Start
Set up initial state with st.session_state.setdefault("key", default), attach widgets with a key parameter (e.g., st.text_input("Name", key="user_name")), then read and update state from st.session_state in your callbacks and page logic.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: using-streamlit-session-state Download link: https://github.com/n-elia/barbarapp/archive/main.zip#using-streamlit-session-state Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.