Skip to content

feature: opt-in trailingTextStyle and trailingAlign on list items - #66

Open
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:feat/list-item-trailing-style-and-align
Open

feature: opt-in trailingTextStyle and trailingAlign on list items#66
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:feat/list-item-trailing-style-and-align

Conversation

@SRWieZ

@SRWieZ SRWieZ commented Aug 23, 2026

Copy link
Copy Markdown
Member

What's wrong

A native:list-item with trailingText reads differently on the two platforms, and there's no prop or class to change it:

  1. Size. Material 3's ListItem styles the trailing slot as labelSmall (11sp), so a "Resume" label or a score looks like a footnote next to the 16sp headline. iOS draws it at 17pt.
  2. Position. With both an overline and supporting text, Material treats the row as three-line and pins the leading and trailing slots to the top. iOS centres them.

What this does

Two props on native:list-item. Unset keeps each platform's default, so nothing changes for existing screens. Set, both platforms draw the same thing:

  • trailingTextStyle="headline" — trailing text at headline size (the iOS look). label — a small caption (the Material look).
  • trailingAlign="center" — leading and trailing slots vertically centred (the iOS look; on Android the row then uses two-line spacing). top — top-aligned (the Material look).

Fluent builders ->trailingTextStyle() / ->trailingAlign() validate the values. Tests in tests/ListItemTrailingTest.php. Docs (edge-components/list-item) need two lines for the new props — happy to PR that too.

Screenshots (same Blade)

Android — default vs trailingTextStyle="headline" trailingAlign="center":

iOS — trailingAlign="top" trailingTextStyle="label" vs default (unchanged):

Two platform defaults make a `native:list-item` read differently on
Android than on iOS, and nothing in the element could change them:

- `trailingText` is drawn in M3's labelSmall (11sp) trailing slot on
  Android, so a "Resume" label or a score looks like a footnote next to
  the headline; iOS draws it at 17pt.
- A row with both an overline and supporting text is "three-line" to
  M3, which pins the leading and trailing slots to the top; iOS centres
  them.

Both become explicit, per row. Unset keeps each platform's default, so
existing screens are unchanged; set, both platforms draw the same thing:

- `trailingTextStyle="headline"` sizes the trailing text like the
  headline (bodyLarge on Android); `label` draws a small caption (13pt
  on iOS).
- `trailingAlign="center"` centres the leading and trailing slots. On
  Android the overline is rendered inside the headline slot (with the
  same labelSmall / onSurfaceVariant styling) so M3 treats the row as
  two-line, which also gives it two-line spacing. `top` top-aligns the
  HStack on iOS.

Fluent builders `->trailingTextStyle()` / `->trailingAlign()` validate
the values. Covered by tests/ListItemTrailingTest.php.
@SRWieZ SRWieZ changed the title Add opt-in trailingTextStyle and trailingAlign to list items feature: opt-in trailingTextStyle and trailingAlign on list items Aug 24, 2026
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