Skip to content

banditburai/starUI

Repository files navigation

StarHTML — Python Web Framework

StarUI — Python Component Library

PyPI version Python 3.12+

Python-first UI component library for StarHTML. shadcn/ui components with zero-configuration setup.

Documentation · StarHTML · Quick Start · Issues

Quick Start

uv add starui
from starhtml import *
from components.ui.button import Button
from components.ui.card import Card, CardHeader, CardTitle, CardContent

app, rt = star_app()

@rt("/")
def home():
    return Card(
        CardHeader(
            CardTitle("Welcome to StarUI")
        ),
        CardContent(
            Button("Get Started", variant="default"),
            Button("Learn More", variant="outline")
        )
    )

serve()

Available Components

Component Description Variants
Button Interactive buttons default, destructive, outline, secondary, ghost, link
Alert Important messages default, destructive
Badge Status indicators default, secondary, destructive, outline
Card Content containers Header, Content, Footer sections
Input Form inputs All HTML input types with validation
Label Form labels Accessible form labeling

CLI

star init <project-name>          # Create new project
star add <component>              # Add component to project
star list                         # List available components
star dev <app.py>                 # Dev server with hot reload
star build                        # Build production CSS

Component API

Button

Button("Click me")

Button(
    "Submit Form",
    variant="default",
    size="lg",
    disabled=False,
    type="submit",
    onclick="handleSubmit()"
)

Card

Card(
    CardHeader(
        CardTitle("Product Card")
    ),
    CardContent(
        P("This is the card content with detailed information."),
        Button("Learn More", variant="outline")
    ),
    class_name="max-w-md"
)

Configuration

StarUI works with zero configuration, but you can customize it:

# starui.config.py (optional)
from starui.config import ProjectConfig
from pathlib import Path

config = ProjectConfig(
    project_root=Path.cwd(),
    css_output=Path("static/css/starui.css"),
    component_dir=Path("components/ui")
)

Development

git clone https://github.com/banditburai/starui.git
cd starui
uv sync --all-extras
uv run ruff check && uv run pyright && uv run pytest tests/ -v

Contributions welcome — see CONTRIBUTING.md.

Acknowledgments

Built on shadcn/ui design patterns, StarHTML, and Tailwind CSS.