feat: add LineBreakMode to NiceButton with orientation-aware wrapping#32
Merged
Conversation
added 9 commits
June 10, 2026 17:15
There was a problem hiding this comment.
Pull request overview
Adds configurable, orientation-aware text wrapping to NiceButton by introducing a nullable LineBreakMode API and updating the button’s grid layout + measurement strategy so WordWrap can actually take effect under constrained widths.
Changes:
- Introduces nullable
LineBreakMode(null= auto-resolve based onOrientation) and computesEffectiveLineBreakMode. - Updates
RebuildContent()to set grid column sizing (StarvsAuto) and_contentHost.HorizontalOptions(FillvsCenter) based on whether text wrapping is active. - Updates
NiceButtonLayoutManager.Measure()to use a two-pass measurement strategy when wrapping is enabled.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new LineBreakMode property in the public API table. |
| NiceEntry/NiceButtonLayoutManager.cs | Adds two-pass measurement to support wrapping while preserving “hug content” sizing when possible. |
| NiceEntry/NiceButton.cs | Adds LineBreakMode BindableProperty + effective mode logic; rebuilds layout to enable wrapping. |
| docs/superpowers/specs/2026-06-10-nicebutton-linebreak-design.md | Design spec describing the API + layout/measurement approach. |
| docs/superpowers/plans/2026-06-10-nicebutton-linebreak-mode.md | Implementation plan and validation checklist for the change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nord-
commented
Jun 11, 2026
nord-
commented
Jun 11, 2026
nord-
commented
Jun 11, 2026
nord-
commented
Jun 11, 2026
nord-
commented
Jun 11, 2026
nord-
commented
Jun 11, 2026
added 2 commits
June 11, 2026 10:01
Address PR #32 review: revert the content grid to Auto columns with a centered host so a stretched button keeps icon and text together, and have NiceButtonLayoutManager cap the text label MaximumWidthRequest at the leftover width so WordWrap/TailTruncation still engage. Also derive HasTextContent from Text, give LineBreakMode a lightweight changed handler, invalidate measure when content is cleared, and drop the dead using and vestigial textColumnWidth local.
IsButtonEnabled and NiceButtonTapped moved to ButtonsViewModel; the MainPage copies were no longer referenced by any XAML.
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.
Closes #31
Changes
LineBreakModeBindableProperty (null= auto:WordWrapfor Vertical,TailTruncationfor Horizontal)OrientationRebuildContent()uses a Star text column +Fillwhenever text is present, so a width-constrained button actually limits the label — it then wraps (WordWrap) or ellipsizes (TailTruncation). An Auto column would measure the label at infinite width, so truncation never engaged and icons were pushed out of view.NiceButtonLayoutManager.Measureuses a two-pass strategy for any text content (gated onHasTextContent): natural measure first (Star acts as Auto at infinity → button hugs short text), bounded re-measure only when content overflowsVerification
Manual smoke test on Android emulator: all 10 scenarios pass — hug (S1/S6), ellipsis (S2/S4), wrap without edge clipping (S3/S5), icon + ellipsis (S7/S8), icon + wrap (S9/S10). No regressions on full-width buttons.