Shapes: <line>, <rectangle>

<line>

A straight line between two points, (x, y) and (x2, y2).

<line y="65" x2="700" y2="65" width="7" />
pydantic model todays_paper_web.widgets.core.line.LineParams[source]

Bases: ViewParams

field align: str | None = None

Horizontal alignment (left/center/right), if given.

field color: Color [Optional]

Line color.

field valign: str | None = None

Vertical alignment (top/middle/center/bottom), if given.

field width: int = 1

Stroke thickness in pixels.

field x: int | None = None

Horizontal position, if given.

field x2: int | None = None

The line’s end x coordinate; defaults to x (a zero-length line).

field y: int | None = None

Vertical position, if given.

field y2: int | None = None

The line’s end y coordinate; defaults to y.

x/y (shown above via ViewParams, which every widget’s Params inherits — see Python API reference) do double duty here specifically: they’re both the line’s own start coordinate and (like on any other widget) the position its parent container places it at, since the rendered image is cropped tightly to the line’s bounding box starting at that same point — so a diagonal line’s x/y behaves consistently whether you think of it as “where the line starts” or “where the box places this element”.

<rectangle>

An outlined or filled rectangle, with optional rounded corners.

<rectangle x="0" y="0" width="{{ width }}" height="70" fill="true" color="#5c5c5c" />
pydantic model todays_paper_web.widgets.core.rectangle.RectangleParams[source]

Bases: ViewParams

field align: str | None = None

Horizontal alignment (left/center/right), if given.

field color: Color [Optional]

Fill color (if fill is set) or outline color otherwise.

field corners: str = 'all'

Which corners radius rounds: all, none, top, bottom, left, right, or a comma-separated list of tl/tr/br/bl.

field fill: bool = False

Fill the rectangle with color instead of just outlining it.

field height: int = 1

Rectangle height in pixels.

field radius: int = 0

Corner radius in pixels; 0 draws sharp corners.

field valign: str | None = None

Vertical alignment (top/middle/center/bottom), if given.

field width: int = 1

Rectangle width in pixels.

field x: int | None = None

Horizontal position, if given.

field y: int | None = None

Vertical position, if given.

color accepts a CSS color name or a #hex code; radius/corners behave as on any rounded shape — radius="0" (the default) draws sharp corners, and corners picks which ones a positive radius rounds (all, none, top, bottom, left, right, or a comma-separated list of tl/tr/br/bl, e.g. corners="tl,tr" to round only the top).

Every widget in this reference validates its own attributes (see Python API reference); <line> and <rectangle> specifically are worth calling out because an unrecognized color or fill value raises a render error rather than silently falling back to a default.