Repository navigation
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
mainonce it's in.NavActionlives in core and has nosubtitle(), and core's elements aren't macroable, so there's a small helper here instead,Native\Mobile\UI\MenuItem:It only sets the
subtitleprop, so->setProp('subtitle', ...)works too, the same wayimage_shapeandcheckeddo. The class also lets an app checkclass_exists(MenuItem::class)and fall back to one combined label on an older mobile-ui. A->subtitle()onNavActionin core would be the nicer API later.iOS.
NativeUIMenuItemputs a secondTextafter the label in the row's title. A SwiftUIMenudraws that as the row's subtitle (it'sUIAction.subtitleunderneath), for plain, icon, picture and checked rows alike. VoiceOver reads the label and then the subtitle.Android.
renderAttachedMenuItemputs the label and subtitle in aColumn, the subtitle inbodyMediumandonSurfaceVariant. 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 -wmoover mobile-air's NativeRender plusresources/iosgives the same 152 errors as #224's head, and a canary in the new code was caught. Kotlin: compilingContainerRenderers.ktintests/android(core's other files missing) gives the same 24 errors as #224's head, none in the new lines.🤖 Generated with Claude Code