Skip to main content

streamlit components of antd design

Project description

Streamlit-Antd-Components

Open in Streamlit GitHub PyPI

A Streamlit component to display Antd-Design, streamlit widgets extension.

Check out the Demo App for more example. demo

highlight

  • support streamlit theme(light or dark mode,or custom theme)
  • support Bootstrap Icon
  • support nested data widgets(menu,tree,cascader...)
  • more style params

Install

pip install streamlit-antd-components

Usage

This library now provides component blow:

  • buttons A group of buttons component.
  • tabs A tabs component.
  • segmented Segmented Controls.
  • menu A versatile menu for navigation
  • tree A hierarchical list structure component.
  • cascader Chooses cascade items in one float layer for better user experience.
  • switch Switching between two states or on-off state
  • divider A divider line separates different content
  • transfer Double column transfer choice box
  • alert Alert component for feedback

buttons example

import streamlit as st
from streamlit_antd_components import buttons

btn = buttons(['button1', 'button2', 'button3'], align='center', shape='round', format_func='title')
st.write(f'The selected button label is: {btn}')

buttons

tabs example

import streamlit as st
from streamlit_antd_components import tabs

tab = tabs(['tab1', 'tab2', 'tab3'], align='center', format_func='title')
st.write(f'The selected tab label is: {tab}')

tabs

menu example

import streamlit as st
from streamlit_antd_components import menu, MenuItem

item = menu([
    MenuItem('menu1', icon='house'),
    MenuItem('menu2', icon='app', children=[
        MenuItem('menu3', icon='twitter'),
        MenuItem('disabled', disabled=True),
    ]),
], format_func='title', open_all=True)
st.write(f'The selected menu label is: {item}')

menu

tree example

import streamlit as st
from streamlit_antd_components import tree, TreeItem

item = tree([
    TreeItem('tree1', icon='table'),
    TreeItem('tree2', icon='table', children=[
        TreeItem('tree3', icon='image'),
        TreeItem('disabled', disabled=True),
    ]),
], index=0, format_func='title', open_all=True, checkbox=True, show_line=True)
st.write(f'The selected tree label is: {item}')

tree

cascader example

import streamlit as st
from streamlit_antd_components import cascader, CasItem

item = cascader(
    items=[
        CasItem('cas1', icon='google'),
        CasItem('cas2', icon='twitter', children=[
            CasItem('cas3', icon='apple'),
            CasItem('disabled', disabled=True),
        ]),
        CasItem('cas4'),
    ], index=0, format_func='title', clear=True)
st.write(f'The selected cascader label is: {item}')

cascader

switch example

import streamlit as st
from streamlit_antd_components import switch, BsIcon

s = switch(value=True, checked=BsIcon('sun'), unchecked=BsIcon('moon'))
st.write(f'switch return value :{s}')

switch

divider example

from streamlit_antd_components import divider

divider(label='divider', icon='house')

divider

transfer example

import streamlit as st
from streamlit_antd_components import transfer

t = transfer(
    items=[f'item{i}' for i in range(20)],
    index=[0, 1],
)
st.write(f'The transfer label is {t}')

transfer

segmented example

import streamlit as st
from streamlit_antd_components import segmented

s = segmented(
    items=[f'item{i}' for i in range(5)],
)
st.write(f'The segmented label is {s}')

segmented

alert example

from streamlit_antd_components import alert

alert('some message', icon=True)

alert

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file streamlit_antd_components-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_antd_components-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ee93a0211eb49a62ef89edb59d64e713c5952f9951d40d379337d0e4b6a4450c
MD5 5bfe76cba2f8c9b84b0b1de9c973bb13
BLAKE2b-256 a46d93d46527a663779644fc308a9bffea09ee1a318133b3689c37fd0c59de10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page