Skip to content

feat: add typed leading and trailing slots to List.Item - #5042

Draft
adam-sajko wants to merge 6 commits into
callstack:mainfrom
adam-sajko:feat/list-typed-slots
Draft

feat: add typed leading and trailing slots to List.Item#5042
adam-sajko wants to merge 6 commits into
callstack:mainfrom
adam-sajko:feat/list-typed-slots

Conversation

@adam-sajko

@adam-sajko adam-sajko commented Aug 7, 2026

Copy link
Copy Markdown

Motivation

#4930 wants explicit slots instead of layout tied to render props. Right now left and right hand the caller a style object and a color and trust them to apply both, so List.Item does not really own its own layout.

leading and trailing take a node and win over left and right when both are passed. List.Item wraps the node itself and puts the color on a small context, so List.Icon picks it up without the caller doing anything. That is the new ListItemContext and the one line in ListIcon.

Related issue

Related to #4930 and #4976

Draft, stacked on #5041 and #5057. Only the typed slots commit is this PR's change, the rest is the stack until those merge. GitHub will show those commits until they land.

#5018 touches the same file but the overlap is one line. It adds shouldIndent = leftIndent && !left && !right, which wants && !leading && !trailing once the slots exist. Whichever lands second picks that up in the rebase.

Two things I would like your call on:

  1. This is additive on purpose, so nothing in refactor: replace React.Children usage to more composition-friendly alternatives (#4989) #5018 has to change. Since v6 alpha allows breaking changes without deprecation aliases, should the final version just drop left and right?
  2. Is leading and trailing the naming you want, or leadingAccessory and trailingAccessory, or one slots object?

Test plan

Unit tests for the new slots side by side with the old left and right, both paths still work.

@adam-sajko
adam-sajko force-pushed the feat/list-typed-slots branch from 734616a to 96e1127 Compare August 19, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants