Skip to content

feat: support responsive Grid layout (conditional minWidth) #12

@cassdeckard

Description

@cassdeckard

Summary

Support responsive Grid layout where the same primitive can be placed in different grid positions depending on screen size, by adding the same item multiple times with different minWidth/minHeight thresholds. tview supports this via multiple AddItem calls; tviewyaml currently adds each grid item once.

Background

Discovered while planning a tview presentation demo implementation via tviewyaml. The Grid slide adds menu/main/sidebar with minWidth: 0 for narrow screens (hidden) and minWidth: 100 for wide screens (visible), achieving responsive layout.

Demo Usage

Demo adds same primitives multiple times with different minWidth (0 vs 100) for narrow/wide; tviewyaml adds each item once.

Proposed Approach

  • Extend GridItem to support multiple placements: placements: [{ row, column, rowSpan, colSpan, minHeight, minWidth, focus }, ...]
  • Or add responsiveItems that duplicate a primitive with different min dimensions
  • In populateGridItems, call AddItem for each placement

Relevant Files

  • config/types.go – extend GridItem or add responsive structure
  • builder/builder.gopopulateGridItems
  • docs/tview-coverage.md – document once implemented

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions