Version: 0.10.0 Last Updated: January 2026
Create beautiful terminal UIs using JSON or YAML configuration files. No Python expertise required — just define your layout in a config file and render it.
- Quick Start
- Installation
- Basic Concepts
- Component Types
- Shorthand Syntax
- Built-in Templates
- Variables
- Loading from Files
- Examples
- Reference
from styledconsole import Console
console = Console()
# Define your UI as a dictionary
console.render_dict({
"type": "frame",
"title": "Welcome",
"content": "Hello from JSON configuration!",
"border": "rounded",
"effect": "success"
})from styledconsole import Console, load_yaml
console = Console()
# Load from YAML string
ui = load_yaml("""
type: frame
title: Welcome
content: Hello from YAML!
border: rounded
effect: ocean
""")
console.render_object(ui)# Core library (JSON support built-in)
pip install styledconsole
# Add YAML support
pip install styledconsole[yaml]
# Or install everything
pip install styledconsole[all]StyledConsole UIs are built from components. Each component has a type and properties specific to that type.
type: frame # What kind of component
title: My Frame # Properties specific to frames
content: Hello!
border: roundedComponents can contain other components:
type: frame
title: Dashboard
content:
type: group
items:
- type: text
content: "Line 1"
- type: text
content: "Line 2"A bordered box with optional title.
type: frame
title: Status
content: All systems operational
border: rounded # solid, rounded, double, heavy, ascii, minimal, dashed
effect: success # Optional: gradient effect
width: 50 # Optional: fixed width
padding: 1 # Optional: internal paddingStyled text content.
type: text
content: Important message
style:
bold: true
color: redLarge ASCII art text.
type: banner
text: HELLO
font: slant # standard, slant, banner, big, small, mini
effect: fireData in rows and columns.
type: table
title: Server Status
columns:
- Server
- Status
- Uptime
rows:
- [api-1, Online, 99.9%]
- [api-2, Online, 99.8%]
- [db-1, Maintenance, 95.2%]
border: heavy
effect: oceanA container for multiple items (vertical layout).
type: group
items:
- type: text
content: Header
- type: frame
title: Section 1
content: Content here
- type: frame
title: Section 2
content: More contentVertical layout with automatic spacing.
type: layout
items:
- type: banner
text: DASHBOARD
effect: rainbow
- type: spacer
lines: 1
- type: frame
title: Status
content: OnlineA horizontal line separator.
type: rule
style: cyanVertical spacing.
type: spacer
lines: 2For common patterns, use shorthand syntax to reduce verbosity.
# Shorthand
items:
- "Just a string becomes text"
# Equivalent to
items:
- type: text
content: "Just a string becomes text"# Shorthand
frame: My content
title: My Title
# Equivalent to
type: frame
content: My content
title: My Title# Content as list
type: frame
title: Status
content:
- "Line 1"
- "Line 2"
- "Line 3"StyledConsole includes 22 ready-to-use templates for common UI patterns.
from styledconsole import Console
console = Console()
# Use a template with variables
console.render_template("info_box", title="Notice", content="Server maintenance scheduled")
console.render_template("success_box", content="Deployment complete!")
console.render_template("error_box", title="Error", content="Connection failed")| Template | Description | Variables |
|---|---|---|
info_box |
Blue information box | title, content |
warning_box |
Yellow warning box | title, content |
error_box |
Red error box | title, content |
success_box |
Green success box | title, content |
tip_box |
Aurora gradient tip | title, content |
note_box |
Steel gradient note | title, content |
| Template | Description | Variables |
|---|---|---|
header_banner |
Large ASCII banner | text, font, effect |
dashboard_header |
Dashboard title frame | title, subtitle |
page_header |
Simple page header | title |
| Template | Description | Variables |
|---|---|---|
status_card |
Status display card | title, status, message |
metric_card |
Metric with value | label, value, unit, trend |
progress_card |
Progress display | title, current, total, label |
| Template | Description | Variables |
|---|---|---|
notification |
Notification message | title, message, type |
toast |
Brief toast message | message, type |
| Template | Description | Variables |
|---|---|---|
section |
Content section | title, content |
card |
Simple card | title, content |
code_block |
Code display | title, code, language |
| Template | Description | Variables |
|---|---|---|
key_value |
Key-value pairs | title, items |
list_panel |
List of items | title, items |
| Template | Description | Variables |
|---|---|---|
two_column |
Two-column layout | left, right |
sidebar_layout |
Sidebar with main content | sidebar, main |
| Template | Description | Variables |
|---|---|---|
confirmation |
Confirmation dialog | title, message, options |
loading |
Loading indicator | message |
empty_state |
Empty state display | title, message, action |
# Info box
console.render_template("info_box",
title="System Notice",
content="Scheduled maintenance tonight at 2 AM"
)
# Metric card
console.render_template("metric_card",
label="CPU Usage",
value="45",
unit="%",
trend="up"
)
# Key-value display
console.render_template("key_value",
title="Configuration",
items="Host: localhost\nPort: 8080\nDebug: true"
)Templates support variable substitution using ${variable:default} syntax.
type: frame
title: ${title:Untitled}
content: Hello, ${name:World}!console.render_template("my_template", title="Welcome", name="Alice")
# Output: title="Welcome", content="Hello, Alice!"
console.render_template("my_template")
# Output: title="Untitled", content="Hello, World!"All built-in templates use variables:
# Template: info_box
# Definition:
# type: frame
# title: ${title:Info}
# content: ${content}
# effect: info
console.render_template("info_box", title="Notice", content="Check your inbox")from styledconsole import Console, load_json
console = Console()
# Load from file
with open("dashboard.json") as f:
ui = load_json(f.read())
console.render_object(ui)dashboard.json:
{
"type": "layout",
"items": [
{
"type": "banner",
"text": "DASHBOARD",
"effect": "rainbow"
},
{
"type": "frame",
"title": "Status",
"content": "All systems operational",
"effect": "success"
}
]
}from styledconsole import Console, load_yaml
console = Console()
# Load from file
with open("dashboard.yaml") as f:
ui = load_yaml(f.read())
console.render_object(ui)dashboard.yaml:
type: layout
items:
- type: banner
text: DASHBOARD
effect: rainbow
- type: frame
title: Status
content: All systems operational
effect: successtype: frame
title: Build Status
content: |
Tests: 427 passed
Coverage: 94%
Duration: 2.3s
border: rounded
effect: successtype: layout
items:
- type: banner
text: MONITOR
font: slant
effect: ocean
- type: spacer
lines: 1
- type: group
items:
- type: frame
title: CPU
content: "Usage: 45%"
effect: success
- type: frame
title: Memory
content: "Used: 2.4GB / 8GB"
effect: info
- type: frame
title: Disk
content: "Free: 120GB"
effect: warningtype: frame
title: Server Status
content:
type: table
columns: [Region, Server, Status, Uptime]
rows:
- [US-East, api-1, Online, 99.9%]
- [US-West, api-2, Online, 99.8%]
- [EU, api-3, Maintenance, 95.2%]
border: heavy
effect: oceantype: layout
items:
- type: frame
title: Notifications
content:
type: group
items:
- "INFO: New version available"
- "WARNING: Disk space low"
- "SUCCESS: Backup completed"
border: rounded
effect: info| Property | Type | Description |
|---|---|---|
type |
string | "frame" |
title |
string | Frame title |
content |
string/component | Frame content |
border |
string | Border style |
effect |
string | Effect preset name |
width |
int | Fixed width |
padding |
int | Internal padding |
| Property | Type | Description |
|---|---|---|
type |
string | "text" |
content |
string | Text content |
style |
object | Style properties |
| Property | Type | Description |
|---|---|---|
type |
string | "banner" |
text |
string | Banner text |
font |
string | Font name |
effect |
string | Effect preset |
| Property | Type | Description |
|---|---|---|
type |
string | "table" |
title |
string | Table title |
columns |
list | Column headers |
rows |
list | Row data |
border |
string | Border style |
effect |
string | Effect preset |
| Property | Type | Description |
|---|---|---|
type |
string | "group" |
items |
list | Child components |
| Property | Type | Description |
|---|---|---|
type |
string | "layout" |
items |
list | Child components |
| Property | Type | Description |
|---|---|---|
type |
string | "spacer" |
lines |
int | Number of blank lines |
| Property | Type | Description |
|---|---|---|
type |
string | "rule" |
style |
string | Line color/style |
Available effects: fire, ocean, sunset, forest, aurora, success, warning, error, info, rainbow, rainbow_neon, cyberpunk, matrix, dracula, nord_aurora
Available borders: solid, rounded, double, heavy, ascii, minimal, dashed, thick
- Python API — Full-featured Python interface
- Jinja2 Templates — Dynamic templates with loops and conditionals
- Visual Gallery — Screenshots and demos
- Examples Repository — 50+ working demos