{"library":"streamlit-code-editor","title":"Streamlit Code Editor","type":"library","description":"Streamlit Code Editor is an active, community-driven component that integrates a React-Ace based code editor into Streamlit applications. It currently stands at version 0.1.22, offering features like custom themes, syntax highlighting for various languages, and customizable interface elements. The library maintains an active release cadence, with updates addressing performance, bug fixes, and new features.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install streamlit-code-editor"],"cli":null},"imports":["from code_editor import code_editor"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/bouzidanas/streamlit-code-editor","docs":null,"changelog":null,"pypi":"https://pypi.org/project/streamlit-code-editor/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import streamlit as st\nfrom code_editor import code_editor\n\ndef main():\n    st.set_page_config(layout=\"wide\")\n    st.title(\"My Streamlit Code Editor App\")\n\n    initial_code = \"\"\"import pandas as pd\n\ndef greet(name):\n    return f\"Hello, {name}!\"\n\nprint(greet(\"Streamlit\"))\n\"\"\"\n\n    st.subheader(\"Edit your Python code:\")\n    response_dict = code_editor(initial_code, lang=\"python\", key=\"my_editor\")\n\n    if response_dict and response_dict[\"type\"] == \"submit\":\n        st.write(\"You submitted the following code:\")\n        st.code(response_dict[\"text\"], language=\"python\")\n\nif __name__ == \"__main__\":\n    main()","lang":"python","description":"This quickstart demonstrates how to embed a basic Python code editor in a Streamlit app. It uses `st.title` and `st.subheader` for layout and `code_editor` to render the interactive editor. The `key` argument is important for maintaining state across reruns, and the `response_dict` captures the editor's output, allowing submission handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}