Skip to content

Add optional-parameter overloads for common layout and text widgets #9

Closed

Description

@albertwoo

Context

A dashboard is mostly layout, and the struct-initializer API makes every container two or three lines. My 50-line header is almost entirely new Box { ... }:

using (ui.Row(new Box { Align = Align.Center, Gap = 12 }))
using (ui.Column(new Box { Pad = 18, Gap = 12, Height = Size.Fill }))

Proposal

Optional-parameter overloads for the hot fields, keeping the struct API for the long tail:

ui.Row(gap: 12, align: Align.Center)
ui.Column(pad: 18, gap: 12, height: Size.Fill)
ui.Text("Live", size: 12, color: Color.TextSecondary)
ui.Badge("Updating", Tone.Danger)
ui.Card(pad: 16, gap: 12, dir: Dir.Column)

Same treatment for the Size/Variant/Width trio on Segmented and Button.

Why

It is an authoring cost, but it also makes skill/docs examples shorter and harder to get wrong — the current snippets carry enough braces that a missing using is easy to miss (which is exactly what CUI002 then has to catch).

Activity

  1. albertwoo commented on Nov 11, 2026

    @albertwoo
    ContributorAuthor

    Fixed and merged in PR #14.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions