Feature Flags
June 11, 2026 · View on GitHub
Canonical source:
Cargo.toml [features]. This document is a human-readable companion.
This guide is the human-readable feature matrix.
For the canonical API surface, also check docs.rs and src/lib.rs.
Core model
unicode-width,unicode-segmentation,smallvec, andcompact_strare always part of the small core (4 direct required deps).crosstermis a default feature, not a hard requirement.- Resolved tree (cargo tree, deduped): 10 crates with
default-features = false, 25 with default features, 67 with--features full— versus 68 for a ratatui + crossterm app. "Light" refers to this dependency footprint and the small public API, not stripped binary size or build speed. - The low-level core (
Backend,AppState,frame(), widgets, events, style/layout types) works without terminal I/O.
Main flags
| Flag | What it enables |
|---|---|
crossterm | Built-in terminal runtime: run(), run_with(), run_inline(), terminal polling, clipboard query, terminal helpers |
async | run_async() and tokio-based message-driven apps |
serde | Serialize/Deserialize for style, theme, and layout-related public types |
image | Image loading helpers for terminal image widgets |
qrcode | ui.qr_code(...) |
syntax | Convenience: enables all per-language syntax-* bundles below |
syntax-* | Per-language syntax bundles such as syntax-rust, syntax-python, syntax-typescript |
kitty-compress | zlib compression for Kitty image protocol uploads |
full | Convenience bundle: enables crossterm, async, serde, image, qrcode, and kitty-compress (does not include syntax — add language bundles separately) |
What disappears without crossterm
When you disable default features and do not re-enable crossterm:
run()and terminal-owned loops are unavailable- terminal helpers such as color scheme detection are unavailable
- terminal clipboard query support is unavailable
What still remains:
BackendAppStateframe()Context, widgets, events, styles, layout, charts
That makes SLT usable as a rendering core for non-terminal environments.
Recommended combos
| Goal | Suggested dependency |
|---|---|
| Regular terminal app | superlighttui = "..." |
| Async terminal app | superlighttui = { version = "...", features = ["async"] } |
| QR output | superlighttui = { version = "...", features = ["qrcode"] } |
| Syntax-highlighted code blocks | superlighttui = { version = "...", features = ["syntax", "syntax-rust"] } |
| Custom backend only | superlighttui = { version = "...", default-features = false } |
AI-friendly rule of thumb
When reading or generating code:
- if you see
run()/run_inline()/ clipboard query usage, assumecrosstermis needed - if you see
run_async(), assumeasyncis needed - if you see
ui.qr_code(...), assumeqrcodeis needed - if you see
code_block_lang(...)with tree-sitter behavior, checksyntaxflags
Related docs
docs/BACKENDS.md- no-default-features and custom backend pathdocs/README.md- docs indexsrc/lib.rs- crate-level rustdoc and cfg-gated API surface