Skip to content

Fix #1: Add support for spacer items in flex layouts#18

Merged
cassdeckard merged 2 commits intomainfrom
fix/issue-1-flex-spacers
Feb 15, 2026
Merged

Fix #1: Add support for spacer items in flex layouts#18
cassdeckard merged 2 commits intomainfrom
fix/issue-1-flex-spacers

Conversation

@cassdeckard
Copy link
Owner

Summary

Implements fix for #1: adds support for spacer items in flex containers so layouts can "float" primitives (e.g. a form) to the right by consuming remaining space on the left.

Changes

  • Config: Added spacer: true field to FlexItem in config/types.go
  • Builder: Updated buildFlex and populateFlexItems in builder/builder.go to treat primitive: null or spacer: true as spacers—call flex.AddItem(nil, item.FixedSize, item.Proportion, item.Focus) instead of skipping
  • Demos:
    • nested-pages-example.yaml: Added spacer between textView and form to float form right (fixedSize 55)
    • flex.yaml: Added spacer for acceptance test (Flex page is reliably navigable)
  • Tests:
    • Unit: TestBuildFlex_SpacerItems, TestBuildFlex_SpacerFlag in builder/builder_test.go
    • Acceptance: TestAcceptance_SpacerLayout navigates to Flex page and asserts snapshot

Usage

items:
  - primitive:
      type: textView
      text: "Left"
    fixedSize: 10
    focus: false
  - primitive: null   # spacer - consumes remaining width
    proportion: 1
    focus: false
  - primitive:
      type: form
      formItems: [...]
    fixedSize: 55
    focus: true

Alternative: spacer: true on a flex item.

Testing

  • go test ./... (library tests pass)
  • cd example && go test -run TestAcceptance_SpacerLayout -v ./... (acceptance test passes)
  • cd example && go test -run TestAcceptance_Layout -v ./... (layout tests pass)

- Support primitive: null and spacer: true in flex items
- Update buildFlex and populateFlexItems to add nil spacer via AddItem(nil, ...)
- Add Spacer field to FlexItem in config/types.go
- Update nested-pages-example.yaml: spacer floats form right, fixedSize 55
- Add spacer demo to flex.yaml for acceptance test
- Add unit tests (TestBuildFlex_SpacerItems, TestBuildFlex_SpacerFlag)
- Add acceptance test TestAcceptance_SpacerLayout

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link

github-actions bot commented Feb 15, 2026

Test Results

243 tests  +2   243 ✅ +2   0s ⏱️ ±0s
  5 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 9df3038. ± Comparison against base commit 284b19f.

♻️ This comment has been updated with latest results.

@cassdeckard cassdeckard merged commit 95f7c9d into main Feb 15, 2026
2 checks passed
@cassdeckard cassdeckard deleted the fix/issue-1-flex-spacers branch February 15, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant