Skip to main content

Crate ratatui_zonekit

Crate ratatui_zonekit 

Source
Expand description

Extensible zone and plugin rendering system for ratatui.

ratatui-zonekit lets plugins own UI zones in a ratatui application. Plugins declare what they need (tabs, panels, overlays), and the host application decides where and how to render them.

§Design Principles

  • Request, don’t mutate: plugins request zones, the host approves.
  • Safe delegation: plugin renders are wrapped in catch_unwind.
  • Theme-agnostic: works with any styling system (themekit, raw Style, custom).
  • Model B: plugins declare intent, host renders. Plugins never touch Frame.

§Quick Start

use ratatui_zonekit::{ZonePlugin, ZoneId, RenderContext};
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;

struct MyPlugin;

impl ZonePlugin for MyPlugin {
    fn id(&self) -> &str { "my-plugin" }
    fn render(&self, _zone_id: ZoneId, _ctx: &RenderContext, area: Rect, buf: &mut Buffer) -> bool {
        use ratatui::widgets::{Paragraph, Widget};
        Paragraph::new("Hello from plugin!").render(area, buf);
        true
    }
}

Structs§

RenderContext
Context passed to a plugin during rendering.
SafeRenderer
Safe renderer that isolates plugin panics.
ZoneId
Unique identifier for a zone, assigned by the host.
ZoneRegistry
Manages zone allocation and plugin ownership.
ZoneRequest
A plugin’s request to create or own a zone.
ZoneSpec
A resolved zone — the host’s response to a ZoneRequest.

Enums§

RegistrationResult
Registration result — whether a zone request was granted or denied.
ZoneEvent
Events delivered to zone plugins.
ZoneHint
Where a plugin wants its zone to appear.

Traits§

ZonePlugin
A plugin that owns one or more zones in the TUI.