Streamlit Antd Components

raw JSON →
0.3.2 verified Mon Apr 27 auth: no python

A library providing custom Streamlit components built on Ant Design and Mantine. Currently at version 0.3.2, it offers rich UI widgets like buttons, menus, tags, and more for Streamlit apps. Release cadence is irregular; last update was in 2023.

pip install streamlit-antd-components
error ModuleNotFoundError: No module named 'streamlit_antd_components'
cause The package is not installed or installed in the wrong environment.
fix
Run pip install streamlit-antd-components in your environment.
error StreamlitAPIException: Unsupported component type: object
cause Passing a list of dicts to `sac.buttons` instead of a list of strings.
fix
Change to sac.buttons(['Item1', 'Item2']).
error AttributeError: module 'streamlit_antd_components' has no attribute 'Buttons'
cause Using a wrong alias or incorrect import; the correct spelling is `Buttons` (capital B).
fix
Use sac.Buttons(...) or import correctly: import streamlit_antd_components as sac.
gotcha The library only works with Streamlit version <1.24.0 due to changes in Streamlit's component communication protocol.
fix Pin Streamlit to 1.23.0 or downgrade: `pip install streamlit==1.23.0`
deprecated The `sac.buttons` component expects a list of strings, not a list of dicts.
fix Use `sac.buttons(['A', 'B', 'C'], ...)` instead of `sac.buttons([{'label':'A'}])`
gotcha Importing `streamlit_antd_components` directly without alias may cause namespace conflicts.
fix Use `import streamlit_antd_components as sac` and reference as `sac.Buttons` etc.

Create a simple menu component with Ant Design styling.

import streamlit as st
import streamlit_antd_components as sac

menu_item = sac.menu([
    sac.MenuItem('Home', icon='house'),
    sac.MenuItem('Settings', icon='gear'),
], index=0, format_func='title', key='menu')
st.write(f'Selected: {menu_item}')