Skip to main content

Carbon Design System buttons for Streamlit

Project description

Streamlit Carbon Button

Beautiful Carbon Design System buttons for your Streamlit apps! 🎨

Carbon Buttons Streamlit PyPI

Features

  • 🎯 Carbon Design System - Professional IBM design language
  • 🎨 4 Button Types - Primary, Secondary, Danger, and Ghost
  • 🔧 100+ Carbon Icons - Extensive library of pre-integrated SVG icons
  • Default Button - Teal shadow indicator for primary actions
  • 📱 Responsive - Adapts to container width
  • 🌓 Dark Mode - Automatic theme detection
  • Accessible - Keyboard navigation and screen reader support

Installation

pip install streamlit-carbon-button

Quick Start

import streamlit as st
from streamlit_carbon_button import carbon_button, CarbonIcons

# Simple button
if carbon_button("Click me!"):
    st.success("Button clicked!")

# Button with icon
if carbon_button("Save", icon=CarbonIcons.SAVE):
    st.success("Saved!")

# Default button with teal shadow
if carbon_button("Submit", is_default=True):
    st.balloons()

Button Types

# Primary (default) - Subtle grey
carbon_button("Primary", button_type="primary")

# Secondary - With border
carbon_button("Secondary", button_type="secondary")

# Danger - Red accent
carbon_button("Delete", button_type="danger")

# Ghost - Minimal style
carbon_button("Cancel", button_type="ghost")

Icons

All 18 available Carbon icons:

CarbonIcons.ADD        CarbonIcons.CLOSE      CarbonIcons.COPY
CarbonIcons.DELETE     CarbonIcons.DOWNLOAD   CarbonIcons.UPLOAD
CarbonIcons.SAVE       CarbonIcons.SEARCH     CarbonIcons.SETTINGS
CarbonIcons.FILTER     CarbonIcons.HOME       CarbonIcons.INFO
CarbonIcons.WARNING    CarbonIcons.SUCCESS    CarbonIcons.HELP
CarbonIcons.DOCUMENT   CarbonIcons.CHART_BAR  CarbonIcons.PLAY

Default Button Feature

Mark important actions with a subtle teal shadow:

col1, col2 = st.columns(2)

with col1:
    if carbon_button("Save", is_default=True):
        st.success("Saved!")
        
with col2:
    if carbon_button("Cancel", button_type="ghost"):
        st.info("Cancelled")

Advanced Examples

Icon-Only Buttons

# Perfect for toolbars
cols = st.columns(4)

with cols[0]:
    if carbon_button("", icon=CarbonIcons.ADD):
        st.info("Add")
        
with cols[1]:
    if carbon_button("", icon=CarbonIcons.EDIT):
        st.info("Edit")

Dynamic Default Buttons

# Change default based on state
is_edited = st.session_state.get('edited', False)

if carbon_button("Save", is_default=is_edited):
    st.success("Saved!")
    st.session_state.edited = False

Full Width Buttons

if carbon_button("Submit Application", use_container_width=True):
    st.success("Submitted!")

API Reference

carbon_button(
    label: str,                       # Button text
    key: str = None,                  # Unique key
    button_type: str = "primary",     # primary|secondary|danger|ghost
    icon: str = None,                 # Icon from CarbonIcons
    disabled: bool = False,           # Disable state
    use_container_width: bool = False,# Full width
    is_default: bool = False,         # Teal shadow indicator
) -> bool                             # True when clicked

Links

License

MIT License - see LICENSE for details.

Carbon Design System icons are used under Apache 2.0 License.

Project details


Download files

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

Source Distribution

streamlit_carbon_button-1.3.0.tar.gz (573.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_carbon_button-1.3.0-py3-none-any.whl (573.3 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_carbon_button-1.3.0.tar.gz.

File metadata

  • Download URL: streamlit_carbon_button-1.3.0.tar.gz
  • Upload date:
  • Size: 573.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for streamlit_carbon_button-1.3.0.tar.gz
Algorithm Hash digest
SHA256 34da9e7b9982dfc506c8ac1670ba08133c053d1918aa76e56d9f41e04caa0cb4
MD5 82a3c5e4a7dafc1196446a5a8bbe660e
BLAKE2b-256 cb62ecd8f4472fd4994b3faf0a0c68a40e9c06650ede18dd6341dba56cdd8e7e

See more details on using hashes here.

File details

Details for the file streamlit_carbon_button-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_carbon_button-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9c189a2e05f4463e06eed13e6d91dbf1403bcc59c9387b4bb5a1bea722eae27
MD5 0c4aad83a23679ff2f586b3a6be51f6e
BLAKE2b-256 b809d5a2342b9c3663ff52052bdf8d2a01ab16e604a5e45a559255a986c3942b

See more details on using hashes here.

Supported by

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