Python-first UI component library for Datastar/StarHTML applications
Project description
StarUI
Python-first UI component library for StarHTML applications
Modern, type-safe components with shadcn/ui styling and zero-configuration setup.
✨ Features
- 🎨 shadcn/ui components - Pixel-perfect implementations with modern design
- ⚡ Zero configuration - Works out of the box with sensible defaults
- 🚯 StarHTML native - Built specifically for StarHTML applications
- 📱 Responsive design - Mobile-first with Tailwind CSS v4
- 🔒 Type-safe APIs - Excellent developer experience with pragmatic typing
- 🚀 Modern Python - Python 3.12+ with latest language features
🚀 Quick Start
Installation
# With pip
pip install starui
# With uv (recommended)
uv add starui
Create Your First Project
# Initialize a new StarUI project
star init my-app
cd my-app
# Add some components
star add button
star add card
# Run development server
star dev app.py
Basic Usage
from starhtml import *
from starui import * # Gets all components automatically
# Create a StarHTML app
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")
)
)
if __name__ == "__main__":
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 Commands
# Project initialization
star init <project-name> # Create new StarUI project
# Component management
star add <component> # Add component to project
star list # List available components
# Development
star dev <app.py> # Development server with hot reload
star build # Build production CSS
🎯 Component API
Button Example
from starui import Button # Or: from starui import *
# Basic usage
Button("Click me")
# With variants and props
Button(
"Submit Form",
variant="default",
size="lg",
disabled=False,
type="submit",
onclick="handleSubmit()"
)
Card Example
from starui import * # Gets Card, CardHeader, CardTitle, CardContent, Button, etc.
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")
)
🔗 StarHTML Integration
StarUI is built specifically for StarHTML:
from starhtml import *
from starui import Button, Alert
app, rt = star_app(
hdrs=(
Link(rel="stylesheet", href="/static/css/starui.css"),
)
)
@rt("/")
def home():
return Div(
Alert(
"Welcome to your new StarUI app!",
variant="default"
),
Button("Get Started", variant="default"),
cls="p-8 max-w-md mx-auto"
)
💻 Development
Setup
# Clone the repository
git clone https://github.com/banditburai/starui.git
cd starui
# Install with uv (recommended)
uv sync --all-extras
# Or with pip
pip install -e ".[dev]"
Quality Checks
# Run all quality checks
uv run ruff check # Linting
uv run ruff format --check # Formatting
uv run pyright # Type checking
uv run pytest tests/ -v # Testing
Building
uv build # Build package
uv run star --version # Test CLI
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-component) - Make your changes with tests
- Run quality checks (
uv run ruff check && uv run pyright && uv run pytest) - Submit a Pull Request
🙏 Acknowledgments
- shadcn/ui - Design system and component inspiration
- StarHTML - The amazing Python web framework
- Tailwind CSS - Utility-first CSS framework
- FastHTML - Inspiration for Python-first web development
Made with ❤️ for the Python web development community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file starui-0.1.3.tar.gz.
File metadata
- Download URL: starui-0.1.3.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a1e594d4f51350f8634928787e4020019fcebb3e3ec399f0a453451797eba2e
|
|
| MD5 |
2d31ce8d6b40eba8c90ea7eac2331fcd
|
|
| BLAKE2b-256 |
439705377ebe570d1aaa8a412a593adbdfd9acb8faf7161ef14e2cc1c7aedd7a
|
Provenance
The following attestation bundles were made for starui-0.1.3.tar.gz:
Publisher:
release.yml on banditburai/starUI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starui-0.1.3.tar.gz -
Subject digest:
2a1e594d4f51350f8634928787e4020019fcebb3e3ec399f0a453451797eba2e - Sigstore transparency entry: 408532834
- Sigstore integration time:
-
Permalink:
banditburai/starUI@01d3dd29613ea9c6d9d354d7dd41eeeef38ce007 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/banditburai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@01d3dd29613ea9c6d9d354d7dd41eeeef38ce007 -
Trigger Event:
push
-
Statement type:
File details
Details for the file starui-0.1.3-py3-none-any.whl.
File metadata
- Download URL: starui-0.1.3-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d5bc20c8f8507de0d9cf08c9583de0c87a8dca6d21155a925a9cae987a1f4ff
|
|
| MD5 |
83daf087d6b73644a6f02af90ffe69ac
|
|
| BLAKE2b-256 |
90b4d14158a7ed1c2539878c0e676599292aca83649ccd50f6fd555779993675
|
Provenance
The following attestation bundles were made for starui-0.1.3-py3-none-any.whl:
Publisher:
release.yml on banditburai/starUI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starui-0.1.3-py3-none-any.whl -
Subject digest:
8d5bc20c8f8507de0d9cf08c9583de0c87a8dca6d21155a925a9cae987a1f4ff - Sigstore transparency entry: 408532853
- Sigstore integration time:
-
Permalink:
banditburai/starUI@01d3dd29613ea9c6d9d354d7dd41eeeef38ce007 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/banditburai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@01d3dd29613ea9c6d9d354d7dd41eeeef38ce007 -
Trigger Event:
push
-
Statement type: