Skip to content

Show a subtitle under a menu row's label - #228

Draft
simonhamp wants to merge 2 commits into
feat/menu-item-imagesfrom
feat/menu-item-subtitle
Draft

simonhamp wants to merge 2 commits into
feat/menu-item-imagesfrom
feat/menu-item-subtitle

Conversation

@simonhamp

@simonhamp simonhamp commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Menu rows (:menu, :context-menu, :trailing-menu) can now show a subtitle: a second, smaller line under the label. The devnull app wants it for its Post as menu, where "Simon (@simon-hamp)" wraps onto two lines. With this the row reads "Simon" with "@simon-hamp" underneath.

This is stacked on #224 (menu row pictures and ticks), because it touches the same row renderers. Merge that first, or retarget this to main once it's in.

NavAction lives in core and has no subtitle(), and core's elements aren't macroable, so there's a small helper here instead, Native\Mobile\UI\MenuItem:

MenuItem::subtitle(
    NavAction::make('me')->label('Simon')->icon(...)->toElement(),
    '@simon-hamp',
)

It only sets the subtitle prop, so ->setProp('subtitle', ...) works too, the same way image_shape and checked do. The class also lets an app check class_exists(MenuItem::class) and fall back to one combined label on an older mobile-ui. A ->subtitle() on NavAction in core would be the nicer API later.

iOS. NativeUIMenuItem puts a second Text after the label in the row's title. A SwiftUI Menu draws that as the row's subtitle (it's UIAction.subtitle underneath), for plain, icon, picture and checked rows alike. VoiceOver reads the label and then the subtitle.

Android. renderAttachedMenuItem puts the label and subtitle in a Column, the subtitle in bodyMedium and onSurfaceVariant. TalkBack reads both as part of the row. Rows without a subtitle are drawn as before.

What to check: iOS picks the menu's width, so a long subtitle may still truncate. I haven't run this on a device yet.

Checks: Pest 537 passed (new MenuItemSubtitleTest). swiftc -typecheck -wmo over mobile-air's NativeRender plus resources/ios gives the same 152 errors as #224's head, and a canary in the new code was caught. Kotlin: compiling ContainerRenderers.kt in tests/android (core's other files missing) gives the same 24 errors as #224's head, none in the new lines.

🤖 Generated with Claude Code

simonhamp and others added 2 commits November 21, 2026 12:37
A :menu, :context-menu or :trailing-menu row can now carry a subtitle,
a second, smaller line under its label, such as an account's handle
under its name. It goes on the element with setProp, like image_shape
and checked:

    NavAction::make('me')->label('Simon')->icon(...)
        ->toElement()->setProp('subtitle', '@simon-hamp')

iOS: the row's title is a second Text after the label, which a SwiftUI
Menu draws as the row's subtitle (UIAction.subtitle underneath).
VoiceOver reads both.

Android: renderAttachedMenuItem puts the subtitle under the label in a
Column, in bodyMedium and onSurfaceVariant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NavAction is in core and has no subtitle method yet, so this gives
apps a typed way to set the prop, and a class they can check for to
tell whether the installed mobile-ui draws subtitles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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