[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KGGRVVW6TYEAHZKDT6BD87":3,"skill-same:01M6KGGRVVW6TYEAHZKDT6BD87":58},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":43,"install":44,"resources":57},"01M6KGGRVVW6TYEAHZKDT6BD87","choosing-streamlit-selection-widgets",null,"Choosing the right Streamlit selection widget. Use when deciding between radio buttons, selectbox, segmented control, pills, or other option selection widgets. Helps pick the right widget for the number of options and selection type.","legout\u002Fpi-config","legout","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1469563?v=4","01M6KGERP7E8TF4XARRKPFJ6HQ","Volker L.","01M6KGERT1FYD049PP1WW923TZ",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fchoosing-streamlit-selection-widgets\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31],"selection","streamlit","widgets","choosing streamlit selection widgets","option","pick","use","options","widget","control","type","number","for","2026-11-10 10:12:30",false,"---\nname: choosing-streamlit-selection-widgets\ndescription: Choosing the right Streamlit selection widget. Use when deciding between radio buttons, selectbox, segmented control, pills, or other option selection widgets. Helps pick the right widget for the number of options and selection type.\nlicense: Apache-2.0\n---\n\n# Streamlit selection widgets\n\nThe right selection widget for the job. Streamlit has evolved—many old patterns are now anti-patterns.\n\n## When to use what\n\nUse `st.segmented_control` or `st.pills` when you want all options visible at once. Use `st.selectbox` or `st.multiselect` when options should be hidden in a dropdown.\n\n| Widget | Best For |\n|--------|----------|\n| `st.segmented_control` | 2-5 options, single select, all visible |\n| `st.pills` | 2-5 options, multi-select, all visible |\n| `st.selectbox` | Many options, single select, dropdown |\n| `st.multiselect` | Many options, multi-select, dropdown |\n\n## Segmented control (options visible, single select)\n\n```python\n# BAD\nstatus = st.radio(\"Status\", [\"Draft\", \"Published\"], horizontal=True)\n\n# GOOD\nstatus = st.segmented_control(\"Status\", [\"Draft\", \"Published\"])\n```\n\nFor vertical layouts, `st.radio(..., horizontal=False)` is still a great choice.\n\nCleaner, more modern look than horizontal radio buttons.\n\n## Pills (options visible, multi-select)\n\n```python\n# Multi-select with few options\nselected = st.pills(\n    \"Tags\",\n    [\"Python\", \"SQL\", \"dbt\", \"Streamlit\"],\n    selection_mode=\"multi\"\n)\n```\n\nCan also be used to mimic an \"example\" widget, especially with `label_visibility=\"collapsed\"`:\n```python\nst.pills(\"Examples\", [\"Show me sales data\", \"Top customers\"], label_visibility=\"collapsed\")\n```\n\nMore visual and easier to use than `st.multiselect` for small option sets.\n\n## Selectbox (many options, single select)\n\n```python\ncountry = st.selectbox(\n    \"Select a country\",\n    [\"USA\", \"UK\", \"Canada\", \"Germany\", \"France\", ...]\n)\n```\n\nDropdowns scale better than radio\u002Fpills for long lists.\n\n## Multiselect (many options, multi-select)\n\n```python\ncountries = st.multiselect(\n    \"Select countries\",\n    [\"USA\", \"UK\", \"Canada\", \"Germany\", \"France\", ...]\n)\n```\n\n## Toggle vs checkbox\n\nUse `st.toggle` for settings that trigger changes in the app. Reserve `st.checkbox` for forms.\n\n```python\n# GOOD: Toggle for app settings\ndark_mode = st.toggle(\"Dark mode\")\nshow_advanced = st.toggle(\"Show advanced options\")\n\n# GOOD: Checkbox in forms\nwith st.form(\"signup\"):\n    agree = st.checkbox(\"I agree to the terms\")\n    st.form_submit_button(\"Sign up\")\n```\n\n## Forms with border=False\n\nRemove the default form border for cleaner inline forms. Keep the border for longer forms where visual grouping helps.\n\n```python\n# Inline form without border\nwith st.form(key=\"add_item\", border=False):\n    with st.container(horizontal=True, vertical_alignment=\"bottom\"):\n        st.text_input(\"New item\", label_visibility=\"collapsed\", placeholder=\"Add item\")\n        st.form_submit_button(\"Add\", icon=\":material\u002Fadd:\")\n\n# Longer form - keep the border for visual grouping\nwith st.form(\"signup\"):\n    st.text_input(\"Name\")\n    st.text_input(\"Email\")\n    st.selectbox(\"Role\", [\"Admin\", \"User\"])\n    st.form_submit_button(\"Submit\")\n```\n\n## Custom options in selectbox and multiselect\n\nAllow users to add their own options with `accept_new_options`:\n\n```python\n# Works with multiselect\ntickers = st.multiselect(\n    \"Stock tickers\",\n    options=[\"AAPL\", \"MSFT\", \"GOOGL\", \"NVDA\"],\n    default=[\"AAPL\"],\n    accept_new_options=True,\n    placeholder=\"Choose stocks or type your own\"\n)\n\n# Also works with selectbox\ncountry = st.selectbox(\n    \"Country\",\n    options=[\"USA\", \"UK\", \"Canada\"],\n    accept_new_options=True,\n    placeholder=\"Select or type a country\"\n)\n```\n\n## References\n\n- [st.segmented_control](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.segmented_control)\n- [st.pills](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.pills)\n- [st.selectbox](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.selectbox)\n- [st.multiselect](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.multiselect)\n- [st.toggle](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.toggle)\n- [st.checkbox](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.checkbox)\n- [st.form](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fexecution-flow\u002Fst.form)\n","# Streamlit selection widgets\n\nThe right selection widget for the job. Streamlit has evolved—many old patterns are now anti-patterns.\n\n## When to use what\n\nUse `st.segmented_control` or `st.pills` when you want all options visible at once. Use `st.selectbox` or `st.multiselect` when options should be hidden in a dropdown.\n\n| Widget | Best For |\n|--------|----------|\n| `st.segmented_control` | 2-5 options, single select, all visible |\n| `st.pills` | 2-5 options, multi-select, all visible |\n| `st.selectbox` | Many options, single select, dropdown |\n| `st.multiselect` | Many options, multi-select, dropdown |\n\n## Segmented control (options visible, single select)\n\n```python\n# BAD\nstatus = st.radio(\"Status\", [\"Draft\", \"Published\"], horizontal=True)\n\n# GOOD\nstatus = st.segmented_control(\"Status\", [\"Draft\", \"Published\"])\n```\n\nFor vertical layouts, `st.radio(..., horizontal=False)` is still a great choice.\n\nCleaner, more modern look than horizontal radio buttons.\n\n## Pills (options visible, multi-select)\n\n```python\n# Multi-select with few options\nselected = st.pills(\n    \"Tags\",\n    [\"Python\", \"SQL\", \"dbt\", \"Streamlit\"],\n    selection_mode=\"multi\"\n)\n```\n\nCan also be used to mimic an \"example\" widget, especially with `label_visibility=\"collapsed\"`:\n```python\nst.pills(\"Examples\", [\"Show me sales data\", \"Top customers\"], label_visibility=\"collapsed\")\n```\n\nMore visual and easier to use than `st.multiselect` for small option sets.\n\n## Selectbox (many options, single select)\n\n```python\ncountry = st.selectbox(\n    \"Select a country\",\n    [\"USA\", \"UK\", \"Canada\", \"Germany\", \"France\", ...]\n)\n```\n\nDropdowns scale better than radio\u002Fpills for long lists.\n\n## Multiselect (many options, multi-select)\n\n```python\ncountries = st.multiselect(\n    \"Select countries\",\n    [\"USA\", \"UK\", \"Canada\", \"Germany\", \"France\", ...]\n)\n```\n\n## Toggle vs checkbox\n\nUse `st.toggle` for settings that trigger changes in the app. Reserve `st.checkbox` for forms.\n\n```python\n# GOOD: Toggle for app settings\ndark_mode = st.toggle(\"Dark mode\")\nshow_advanced = st.toggle(\"Show advanced options\")\n\n# GOOD: Checkbox in forms\nwith st.form(\"signup\"):\n    agree = st.checkbox(\"I agree to the terms\")\n    st.form_submit_button(\"Sign up\")\n```\n\n## Forms with border=False\n\nRemove the default form border for cleaner inline forms. Keep the border for longer forms where visual grouping helps.\n\n```python\n# Inline form without border\nwith st.form(key=\"add_item\", border=False):\n    with st.container(horizontal=True, vertical_alignment=\"bottom\"):\n        st.text_input(\"New item\", label_visibility=\"collapsed\", placeholder=\"Add item\")\n        st.form_submit_button(\"Add\", icon=\":material\u002Fadd:\")\n\n# Longer form - keep the border for visual grouping\nwith st.form(\"signup\"):\n    st.text_input(\"Name\")\n    st.text_input(\"Email\")\n    st.selectbox(\"Role\", [\"Admin\", \"User\"])\n    st.form_submit_button(\"Submit\")\n```\n\n## Custom options in selectbox and multiselect\n\nAllow users to add their own options with `accept_new_options`:\n\n```python\n# Works with multiselect\ntickers = st.multiselect(\n    \"Stock tickers\",\n    options=[\"AAPL\", \"MSFT\", \"GOOGL\", \"NVDA\"],\n    default=[\"AAPL\"],\n    accept_new_options=True,\n    placeholder=\"Choose stocks or type your own\"\n)\n\n# Also works with selectbox\ncountry = st.selectbox(\n    \"Country\",\n    options=[\"USA\", \"UK\", \"Canada\"],\n    accept_new_options=True,\n    placeholder=\"Select or type a country\"\n)\n```\n\n## References\n\n- [st.segmented_control](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.segmented_control)\n- [st.pills](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.pills)\n- [st.selectbox](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.selectbox)\n- [st.multiselect](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.multiselect)\n- [st.toggle](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.toggle)\n- [st.checkbox](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fwidgets\u002Fst.checkbox)\n- [st.form](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fexecution-flow\u002Fst.form)\n",{"name":5,"license":15,"description":7},"main","3efae68c898153694a2f4aad309c7ff9847b5602","installed-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fchoosing-streamlit-selection-widgets",0,"https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config","https:\u002F\u002Fgithub.com\u002Flegout","2026-04-28 16:32:33",{"source":8,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add legout\u002Fpi-config --skill choosing-streamlit-selection-widgets",{"tool":50,"command":51},"bunx","bunx skills add legout\u002Fpi-config --skill choosing-streamlit-selection-widgets",{"tool":53,"command":54},"pnpm","pnpm dlx skills add legout\u002Fpi-config --skill choosing-streamlit-selection-widgets","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fchoosing-streamlit-selection-widgets\u002FSKILL.md",true,[],[59,85,107,120,133,153],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":63,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":32},"01M6KGW7MYKZ8MWFKN1V8ZJ2EG","visual-explainer","Generate beautiful, self-contained HTML pages that visually explain systems, code changes, plans, and data. Use when the user asks for a diagram, architecture overview, diff review, plan review, project recap, comparison table, or any visual explanation of technical concepts. Also use proactively when you are about to render a complex ASCII table (4+ rows or 3+ columns) — present it as a styled HTML page instead.","MIT","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Fskills\u002Fvisual-explainer\u002FSKILL.md",[],[67,68,69,70,71,72,73,74,75,25,76,77,78,79,80,81,82,83,84,31],"visual explainer","explainer","visual","image","architecture","generate","plan","table","view","files","project","present","as","ascii table","ascii","you","concepts","surf",{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":63,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":32},"01M6KGTMTJR6RXXC8AF29MQQW5","table-extractor",">","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Ftable-extractor\u002FSKILL.md",[],[74,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106],"table extractor","PDF","MCP","gpt","extraction","office","data","parsing","extract","en","zh","camelot","sonnet","opus","tables",{"skillNo":108,"name":109,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":63,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":32},"01M6KGSWF2R22Z63PAY5NT6GRY","smart-ocr","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fsmart-ocr\u002FSKILL.md",[],[113,114,93,94,115,95,96,97,99,116,100,101,102,117,118,104,105,119],"ocr","smart ocr","support","text","multilingual","processing","paddleocr",{"skillNo":121,"name":122,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":63,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":32},"01M6KGMKKFNC1PRNX2W3E243DR","html-slides","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fhtml-slides\u002FSKILL.md",[],[126,127,128,129,94,130,95,97,101,102,131,132,104,105],"slides","html","html slides","pptx","web","revealjs","presentation",{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":32},"01M6KGJGVM0TWW632Y6VQQV2WN","using-streamlit-session-state","Using st.session_state to manage state across Streamlit reruns. Use when persisting data, handling widget state, implementing callbacks, or debugging state issues. Covers initialization patterns, widget-state association, and common gotchas.","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fusing-streamlit-session-state\u002FSKILL.md",[],[140,141,20,142,143,144,145,98,146,25,147,148,149,27,150,151,152],"state","session","session state","using streamlit session state","debugging","issues","common","manage","patterns","across","Callbacks","implementing","initialization",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":32},"01M6KGJD12GJB7W0ZG66JK00F6","using-streamlit-markdown","Covers all Markdown features in Streamlit including GitHub-flavored syntax plus Streamlit extensions like colored text, badges, Material icons, and LaTeX. Use when formatting text, labels, tooltips, or any text-rendering element.","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fusing-streamlit-markdown\u002FSKILL.md",[],[160,20,161,162,163,164,116,165,25,166,167,168,169,170,171,172],"markdown","using streamlit markdown","github","icons","LaTeX","syntax","formatting","element","material","rendering","extensions","features","labels"]