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

File metadata

File hashes

Hashes for streamlit_antd_components-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 829dcd5e8bc5e07fcba8e5ccee510d89bc1c0fdc58791b346bf5ad4be4af3e30
MD5 a0549478e8c2e569a5224cc7834c473f
BLAKE2b-256 5353efa87e090272e56fdce87e39c869ad0e0c5e15fa9897d41590b9d53fa1b8

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