Skip to content

feat(render): layout border-sides + renderer option polish for 0.x presets #79

Closed

Description

@unhappychoice

Tracks #76 (0.x release scope).

Background

The 0.x presets (#77) aim for "polished design composition". The design vocabulary is hero / subtitle / divider / body / typography hierarchy.

Originally a text_divider renderer was proposed, but since Panel already has title and border, letting layout choose borders per side lets a section divider be expressed as a single row with border = "top" + title = "..." (equivalent to ratatui's Block::default().borders(Borders::TOP).title(...)). No static decorative widget needed.

New: per-side layout border support

Today src/layout.rs::build_block hardcodes Borders::ALL:

let mut b = Block::default()
    .borders(Borders::ALL)
    .border_type(to_border_type(panel.border))
    ...

Add side variants to BorderSpec:

#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum BorderSpec {
    None,
    Plain,      // existing: 4-side plain
    Rounded,    // existing
    Thick,      // existing
    Double,     // existing
    Top,        // NEW: top-only plain
    // Bottom / Horizontal / Vertical — future
}

border = "top" only raises ratatui's Borders::TOP. The existing title = "..." rides along (styled via the panel_title token — theme-aware; rule styling uses panel_border).

Usage:

[[row]]
height = { length = 6 }
border = "top"
title = "branch"
  [[row.child]]
  widget = "branch_status"

Renders as:

─── branch ──────────────────────────
<branch_status widget>

The row doubles as section divider + body.

Future expansion: today BorderSpec mixes style and side. If we later want an object form like border = { sides = "top", style = "rounded" }, it lands then. For 0.x, ship Top alone (YAGNI).

Existing-renderer option polish

text_ascii — broaden hero expressivity

  • figlet font bundling: today's comment says "custom fonts land when we make a config decision on font bundling" — still unimplemented. Bundle banner / big / standard / small at minimum. Selectable via render = { type = "text_ascii", style = "figlet", font = "banner" }.
  • blocks-style color override: currently hardcoded to theme.text. Allow theme-token override, e.g. color = "panel_title".

media_image — hero image / logo / avatar placement

Currently no options:

  • align — "left" | "center" | "right"
  • fit — "contain" | "cover" | "stretch" (today's behavior ≈ stretch)
  • max_width / max_height — cell-count caps
  • padding — surrounding whitespace

gauge_line — inline label

Show year: ▓▓▓▓░░░░ 32% (118 of 365)-style label + value inline inside the widget:

  • label — prefix string (e.g. "year")
  • value_format — "percent" | "fraction" | "both" (32% / 118/365 / 32% (118 of 365))

grid_table — one-line format for subtitle / branch row

  • layout — "rows" | "inline" (inline = key: value · key: value horizontal)
  • column_align — per-column alignment

list_plain / list_timeline — visual rhythm

  • bullet — "•" | "●" | "▪" | "→" | "none"
  • max_items — display cap
  • list_timeline: date_format — "relative" (2h ago) / "absolute" (2026-04-23)

chart_sparkline — inline label

  • label — prefix string
  • style — "bars" | "line"

status_badge — ambient look

  • padding — horizontal padding
  • shape — "rounded" | "square" | "none"

Remaining renderers (not used directly in presets, but for catalog completeness)

Empty options already work, so this is best-effort:

  • chart_pie — legend position, donut mode, palette override
  • chart_line / chart_scatter — axis visibility, legend, marker style
  • chart_bar — horizontal / stacked / max bars
  • gauge_circle — ring thickness, label position
  • grid_heatmap — custom cell char, palette override
  • grid_calendar — week-start day, marker style

Definition of Done

  • Add BorderSpec::Top; make layout.rs::build_block configurable per side
  • Bundle 4 figlet fonts + font option on text_ascii
  • color option on text_ascii blocks style
  • 5 options on media_image (align / fit / max_width / max_height / padding)
  • Inline label on gauge_line (label + value_format)
  • Inline layout on grid_table
  • list_plain / list_timeline bullet + max_items + date_format
  • Inline label on chart_sparkline
  • status_badge padding + shape
  • Fill in option_schemas() for each renderer (reflected in auto-generated docs)
  • Run cargo xtask to regenerate reference pages
  • Rewrite the ─── title ─── static hacks in feat: ship dashboard presets (home_splash / home_daily / home_github / project_github_activity) #77 presets to border = "top" + title

Out of scope

Activity

  1. added
    render
    feat
    on Apr 22, 2026
  2. changed the title [-]feat(render): polish renderer options for 0.x presets[/-] [+]feat(render): text_divider renderer + option polish for 0.x presets[/+] on Apr 22, 2026
  3. changed the title [-]feat(render): text_divider renderer + option polish for 0.x presets[/-] [+]feat(render): layout border-sides + renderer option polish for 0.x presets[/+] on Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featrender

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions