Skip to content

Add optional card list slots and tablet columns - #2905

Merged
Henrik Sym (henrik-sky) merged 15 commits into
mainfrom
codex/card-list-slots-tablet
Dec 3, 2026
Merged

Henrik Sym (henrik-sky) merged 15 commits into
mainfrom
codex/card-list-slots-tablet

Conversation

@melwaraki

@melwaraki Marwan Elwaraki (melwaraki) commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Card lists can now retain their header controls and expansion state while a filtered list is empty, and opt into two equal-width columns when wide.

Adds independently optional controlsContent / emptyContent slots, useTwoColumnsWhenWide = false and contentPadding (defaults to none). On Android, "wide" means the current window is wider than 769 dp (the Backpack tablet breakpoint, via isTablet()), measured on the whole window, including live resize/fold changes. This matches iOS's useTwoColumnsWhenWide.

  • Both the lazy and column (isInScrollableContainer = true) variants use a single layout for one and two columns (LazyVerticalGrid and a small internal Layout respectively), so each card's state is kept when the column count changes.
  • The section header, slots and accessories stay full width, and indices always refer to cards, not rows.
  • controlsContent extends through the horizontal contentPadding, so a chip rail can scroll to the list's edges; callers supply the inset inside the controls (e.g. the chip group's contentPadding). This matches the iOS controls slot.
  • The original rememberSaveable expansion owner and count calculation are preserved. ExpandableColumn and ExpandableLazyColumn are now private; they were previously public, but nothing outside the component uses them.

This is the Android Backpack part of Recent Searches v2 (TASK-004). TASK-003 count hardening is explicitly excluded. The app will cap its selected list, pass its actual size, leave expandedCount unset, and omit the accessory when all cards fit. App dependency updates follow a Backpack release separately.

Validation:

  • Parameterized component/snapshot tests for both variants: crossing the 769 dp breakpoint, default/false opt-in, odd/single cards, independent slots, expansion across empty/resize transitions, card state across column changes, controls extending through contentPadding, and 200% text scaling.

  • Screenshot test for an edge-to-edge scrolling chip rail.

  • Interactive chip/empty-state demo and API/README documentation.

  • Read the contributing guidelines

  • Component README

  • Tests added

  • Full Android checks and generated screenshots reviewed

@melwaraki Marwan Elwaraki (melwaraki) added the minor A new & backwards compatible feature/component label Nov 25, 2026
@Caoilinn
Caoilinn (Caoilinn) marked this pull request as ready for review November 26, 2026 16:37
Copilot AI lite review requested due to automatic review settings November 26, 2026 16:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
2 files not reviewed
  • .idea/GitLink.xml: Generated file
  • .idea/deviceManager.xml: Generated file
What changed in this PR

Adds optional full-width slots for stack card lists and an opt-in two-column tablet layout, while preserving expansion state across empty/filtered transitions.

Changes:

  • Add optional controlsContent and emptyContent slots to BpkStackCardList, shown full-width (including when list is empty).
  • Add useTwoColumnsOnTablet opt-in that renders cards in two equal columns on tablet-width windows for both lazy and embedded modes.
  • Add/extend Robolectric snapshot + adaptive behavior tests and update demo + documentation.
File Description
docs/​compose/​CardList/​README.md Documents new slots and tablet column behavior and adds screenshots/example usage.
backpack-compose/​src/​main/​kotlin/​net/​skyscanner/​backpack/​compose/​cardlist/​stack/​internal/​BpkStackCardListImpl.kt Implements optional slots, empty behavior, and 2-column rendering for both Column/LazyColumn paths.
backpack-compose/​src/​main/​kotlin/​net/​skyscanner/​backpack/​compose/​cardlist/​stack/​BpkStackCardList.kt Exposes new public API parameters and documents behavior.
app/​src/​test/​java/​net/​skyscanner/​backpack/​compose/​cardlist/​stack/​BpkStackCardListTest.kt Adds snapshot coverage for new slots and tablet two-column mode.
app/​src/​test/​java/​net/​skyscanner/​backpack/​compose/​cardlist/​stack/​BpkStackCardListAdaptiveTest.kt Adds parameterized adaptive tests for width threshold, empty/resize transitions, and typography scaling.
app/​src/​main/​res/​values/​strings.xml Adds demo/test strings for chips and empty state CTA.
app/​src/​main/​java/​net/​skyscanner/​backpack/​demo/​compose/​CardListStory.kt Adds an interactive demo story showcasing chips + empty state + adaptive columns.

Review effort: Lite

Copilot AI lite review requested due to automatic review settings November 26, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
2 files not reviewed
  • .idea/GitLink.xml: Generated file
  • .idea/deviceManager.xml: Generated file

Review effort: Lite

Comment thread .idea/deviceManager.xml Resolved
Comment thread .idea/GitLink.xml Resolved
…s and add contentPadding

Co-authored-by: OpenCode <noreply@opencode.ai>
Copilot AI lite review requested due to automatic review settings December 2, 2026 13:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues

Review effort: Lite

Comment on lines +40 to +56
/**
* A stack of cards with optional full-width content below its section header and when empty.
*
* @param useTwoColumnsWhenWide When true, uses two equal-width columns when wide. On Android, "wide"
* means the current window is wider than the Backpack tablet breakpoint (769 dp). This is measured on
* the whole window, not on the space available to the list. Defaults to false. Counts refer to cards,
* not rows; odd counts are not rounded.
* @param contentPadding Padding around the list's content. Defaults to none. Its horizontal part is
* not applied to [controlsContent], so scrolling controls such as a chip rail can scroll to the
* list's edges. Use this instead of padding [modifier] when [controlsContent] scrolls horizontally.
* @param controlsContent Optional content below the section header, including when there are no cards.
* Null adds no spacing. It extends through the horizontal [contentPadding], so supply your own inset,
* e.g. `BpkSingleSelectChipGroup(contentPadding = PaddingValues(horizontal = BpkSpacing.Base))`.
* The caller owns any state inside this slot, such as chip selection.
* @param emptyContent Optional content shown instead of cards/accessories when [totalCount] is zero.
* Null preserves the existing empty appearance. Expansion state survives an empty list.
*/
Copilot AI lite review requested due to automatic review settings December 2, 2026 14:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
1 resolved since last review

Review effort: Lite

Copilot AI lite review requested due to automatic review settings December 2, 2026 14:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue

Review effort: Lite

Copilot AI lite review requested due to automatic review settings December 2, 2026 15:03
accessibilityHeaderTagEnabled: Boolean? = true,
isInScrollableContainer: Boolean = false,
content: @Composable ((Int) -> Unit),
useTwoColumnsWhenWide: Boolean = false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we retain an overload with the original parameter order? Adding defaulted parameters before content breaks callers that passed the content lambda as the ninth positional argument:

BpkStackCardList(
    "Destinations", 1, Modifier, null, null, null, true, true,
    { index -> BpkText("Card $index") },
)

I ran this as a compile fixture with :app:compileOssDebugUnitTestKotlin on this head. It fails with Boolean was expected and No value passed for parameter 'content'. This call matches the previous public signature.

The existing Recent Searches consumer uses named arguments and a trailing lambda; its local snapshot build and all 143 module tests passed. This is a public source-compatibility concern rather than a demonstrated app failure. Keeping the original overload delegating to the extended implementation, plus this compile fixture, would preserve that call form.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I did think of this earlier but the only caller of BpkStackCardList currently in the codebase is RecentSearch, and it passes through everything as a named parameter so it won't break. Rather than having two APIs, and needing to support both, I thought that only having the one would be simpler. Is backpack still public? Because if so and some codebases are using it then 100% we need to not introduce a breaking contract change, but otherwise what is the general approach here; do we ideally want to have two contracts or decommission one eventually (from what I can tell as far as the Skyscanner android codebase goes we can do that now)?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue

Review effort: Lite

Copilot AI lite review requested due to automatic review settings December 2, 2026 15:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue

Review effort: Lite

@henrik-sky
Henrik Sym (henrik-sky) merged commit 1c1d153 into main Dec 3, 2026
19 of 20 checks passed
@henrik-sky
Henrik Sym (henrik-sky) deleted the codex/card-list-slots-tablet branch December 3, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor A new & backwards compatible feature/component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants