Skip to content

type: rect

This page renders docs/engine/rect.md.Generated here: the sidebar and the demo below.

View source

A rectangle: a pure decoration box painted by the unified Style — the same backgroundColor / borderWidth / borderColor / borderStyle / opacity keys every other item uses, including named styles via styleNames. rect has no content, so padding and all text-level style keys are ignored (inert keys on the inline style warn shape_style_ignored); it needs explicit w/h.

Nothing draws unless a style layer authors it: a bare rect is invisible (there is no implicit default stroke). Author borderWidth for an outline, backgroundColor for a fill.

Syntax

yaml
- type: rect
  box: { x: 0, y: 0, w: 200, h: 40 }   # w/h required (rect_missing_size)
  styleNames: [panel]                   # named styles, like any item
  style:
    borderWidth: { bottom: 2 }   # scalar or per-side map, pt; unset = none
    borderColor: "#333333"       # scalar or per-side; unset side = black
    borderStyle: double          # solid (default) | double | dashed | dotted
    borderRadius: 6              # rounds the corners (uniform borders only)
    backgroundColor: "#f7f7f7"   # fill, default none
    opacity: 0.5                 # 0..=1 paint alpha, default 1 (opaque)

Keys

KeyTypeDefaultDescription
boxmaprequiredPosition and size (box.md); margins work, padding is ignored.
styleNameslistNamed styles from the styles: registry, layered below the inline style.
style.*Style decoration subsetbackgroundColor, borderWidth, borderColor, borderStyle, borderRadius, opacity. A side draws iff its computed width > 0. Text keys are inert and warn shape_style_ignored.

The retired shape-style spelling fillColor is a located parse error — use backgroundColor. Engines without the style.shapes.unified capability key expect the old fillColor wire instead.

Limitations

  • box.w/box.h are required (rect_missing_size).
  • A rect has no content, so text and box style keys are inert on it (shape_style_ignored).
  • borderRadius is a single value for all four corners — there are no per-corner radii — and it is refused on a per-side or double border (border_radius_ignored, invalid_border_radius).

Diagnostics

CodeMeaning
rect_missing_sizebox.w/box.h absent
shape_style_ignoredtext/box keys on the inline style that have no effect on a rect
invalid_opacityout-of-range opacity; drawn opaque
invalid_border_widthnon-finite or absurd width; no border

Capability keys: rect, style.shapes.unified.

See also

  • line.md — a stroked segment (keeps its own width/color style)
  • style.md — the shared decoration vocabulary
  • form_marks.mdellipse/checkbox (same Style, 1pt frame default)