Skip to main content

streamlit components of antd design

Project description

Streamlit-Antd-Components

A Streamlit component to display Antd-Design.

Install

pip install streamlit-antd-components

Usage

This library now provides two component:

  • antd_menu A versatile menu for navigation
  • antd_tree A hierarchical list structure component.

antd_menu

Hightlights

  • support nested menus
  • support streamlit theme(light or dark mode,or custom theme)
  • support Bootstrap Icon
  • support hyperlink menu

Demo

Demo code

import streamlit as st
from streamlit_antd_components import antd_menu, MenuItem, MenuDivider

items = [
    MenuItem('Homepage', 'homepage', icon='house'),
    MenuItem('App', 'app', icon='app', children=[
        MenuItem('Store', 'store', icon='bag-check'),
        MenuItem('Brand', 'brand', icon='award', children=[
            MenuItem('Github', 'github', icon='github'),
            MenuItem('Google', 'google', icon='google'),
            MenuItem('Apple', 'apple', icon='apple'),
        ]),
    ]),
    MenuItem('Setting', 'setting', icon='gear', children=[
        MenuItem('Admin', 'admin', icon='person-circle'),
        MenuItem('Guest', 'guest', icon='person'),
    ]),
    MenuItem('Disabled', 'disabled', icon='send', disabled=True),
    MenuDivider(),
    MenuItem('Reference', 'reference', children_as_group=True, children=[
        MenuItem('Antd Design menu', 'antd', icon='heart', href='https://ant.design/components/menu#menu'),
        MenuItem('Bootstrap icon', 'icon', icon='bootstrap', href='https://icons.getbootstrap.com/'),
        MenuItem('streamlit-components-tutorial', 'sct', icon='info-circle',
                 href='https://streamlit-components-tutorial.netlify.app/'),
    ]),
]
with st.sidebar.container():
    item = antd_menu(
        items=items,
        selected_key='apple',
    )
st.write(f'The selected item key is **{item}**')

antd_tree

Hightlights

  • support nested tree

  • support streamlit theme(light or dark mode,or custom theme)

  • support Bootstrap Icon

  • support checkbox to multiple select

  • Demo

Demo code

import streamlit as st
from streamlit_antd_components import antd_tree, TreeItem

with st.sidebar.container():
    data = [
        TreeItem('table1', 'table1'),
        TreeItem('image', 'image', icon='images', children=[
            TreeItem('image1', 'image1', icon='image-alt'),
            TreeItem('image2', 'image2', icon='image-fill'),
        ]),
        TreeItem('table2', 'table2', children=[
            TreeItem('table2-1', 'table2-1'),
            TreeItem('table2-2', 'table2-2'),
        ]),
        TreeItem('table3', 'table3', disabled=True),
        TreeItem('table4', 'table4'),
    ]
    item = antd_tree(
        items=data,
        selected_keys=['image1'],
        checkbox=True,
        show_line=True,
        icon='table',
    )
st.write(f'The selected item key is **{item}**')

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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_antd_components-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f9b448e717977eb9e704eb679cd2e4b85fa2f75074ba06e4db7a5fbd9c6fb45
MD5 8c6520b7ad5572201760abda19e82415
BLAKE2b-256 315dd9db38818257d432e3d26e57f4150e5cda1b0d32603c58b65492d5fbe548

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