Skip to content

New Component: MudToggleGroup#7309

Merged
henon merged 11 commits intoMudBlazor:devfrom
mckaragoz:Toggle
Dec 22, 2023
Merged

New Component: MudToggleGroup#7309
henon merged 11 commits intoMudBlazor:devfrom
mckaragoz:Toggle

Conversation

@mckaragoz
Copy link
Member

@mckaragoz mckaragoz commented Aug 6, 2023

Description

A general usage for all toggle situations. Support generic types. Uses MudToggleGroup as main component and MudToggleItem for items. Primarily designed to use with texts or icons but also supports renderfragments for complex situations. Supports multiple values. Written from scratch that doesn't have any BL0007 warnings.

Basic functions: Tickmark, icons, vertical, rounded, dense etc.

20230806_204325.mp4

Selection modes

20230806_204358.mp4

Color and styles

20230806_204440.mp4

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library PR: needs review labels Aug 6, 2023
@codecov
Copy link

codecov bot commented Aug 6, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (1c4bcb7) 90.69% compared to head (1f8889a) 86.22%.
Report is 111 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #7309      +/-   ##
==========================================
- Coverage   90.69%   86.22%   -4.48%     
==========================================
  Files         426      431       +5     
  Lines       15095    15358     +263     
  Branches        0     3352    +3352     
==========================================
- Hits        13691    13242     -449     
- Misses       1404     1427      +23     
- Partials        0      689     +689     
Files Coverage Δ
...c/MudBlazor/Components/Toggle/MudToggleGroup.razor 100.00% <100.00%> (ø)
...MudBlazor/Components/Toggle/MudToggleItem.razor.cs 96.87% <96.87%> (ø)
...rc/MudBlazor/Components/Toggle/MudToggleItem.razor 50.00% <50.00%> (ø)
...udBlazor/Components/Toggle/MudToggleGroup.razor.cs 93.75% <93.75%> (ø)

... and 220 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@henon
Copy link
Contributor

henon commented Aug 9, 2023

I haven't looked at the code yet but I think the buttons should not vary in size depending on being clicked or unclicked. I think the chip doesn't do it either. I guess you'll have to reserve the space for the check mark and make the text non-wrapping.

image

@JonBunator @Mr-Technician Would love a second opinion on the visuals and behavior.

@mckaragoz
Copy link
Member Author

I haven't looked at the code yet but I think the buttons should not vary in size depending on being clicked or unclicked. I think the chip doesn't do it either. I guess you'll have to reserve the space for the check mark and make the text non-wrapping.

This one is absolutely one of the issues. Material says all items should have same width and width should not change when item selected and tickmark appeared. I also tried to add hardcoded pixels for reserving space, but this time it breaks the mobile visual.

@henon
Copy link
Contributor

henon commented Aug 10, 2023

Maybe you look how MudChip solves this problem?

@henon henon added the needs: changes A maintainer has asked for further modifications to be made to this pull request label Aug 10, 2023
@ScarletKuro
Copy link
Member

ScarletKuro commented Aug 10, 2023

The visual are good to me, the behavior looks ok as well.
I only have some code / style advices, and if @mckaragoz doesn't mind, I can push them into this branch directly

@mckaragoz
Copy link
Member Author

mckaragoz commented Aug 11, 2023

I only have some code / style advices, and if @mckaragoz doesn't mind, I can push them into this branch directly

Ofc, i also ask you about the nullable content. Is it better to change the component to nullable ones right?

@henon probably chip doesn't help us, because chips doesn't have to have equal width. (And we can wrap multiline chips, but for segmented buttons material says don't wrap them) With current design, using no-tickmark is completely safe, there is no visual change on selection changes. If user want to use tickmark, they need to set container width that required for the toggle group.

@henon
Copy link
Contributor

henon commented Aug 11, 2023

@henon probably chip doesn't help us, because chips doesn't have to have equal width. With current design, using no-tickmark is completely safe, there is no visual change on selection changes. If user want to use tickmark, they need to set container width that required for the toggle group.

What about setting the CSS to not wrap the text and ellipsis if too long? Then instead of changing the width / height the text would be cut off. I can't imagine that anyone would want the height to change.

@mckaragoz
Copy link
Member Author

What about setting the CSS to not wrap the text and ellipsis if too long? Then instead of changing the width / height the text would be cut off. I can't imagine that anyone would want the height to change.

If there is no "preserve space for tickmark but also ensure it doesn't overflow on mobile" solution, probably ellipsis is the best option.

@ScarletKuro
Copy link
Member

ScarletKuro commented Aug 11, 2023

@mckaragoz also when I type in doc "toggle" and select it from the menu, it redirects me to /components/toggle and says the page is not found, because the page is located here: @page "/components/togglegroup".

@ScarletKuro
Copy link
Member

adding @Mr-Technician to the review #7309 (comment)

@ScarletKuro
Copy link
Member

ScarletKuro commented Aug 23, 2023

I also wonder if we should add [CascadingTypeParameters] here. I still want to add it to MudSelect to see if some issues will be gone, just kinda busy recently.

@henon
Copy link
Contributor

henon commented Aug 24, 2023

I think the buttons should not vary in size depending on being clicked or unclicked. I think the chip doesn't do it either. I guess you'll have to reserve the space for the check mark and make the text non-wrapping.

image

@mckaragoz Is this fixed? Can you replace the videos with updated versions please?

@fondraco
Copy link
Contributor

Why not base this on MudButtonGroup? The functionality is great, but this introduces new visuals that do not comply with the Material documentation. @mckaragoz

@Int32Overflow
Copy link
Contributor

What is the current state?

@mckaragoz
Copy link
Member Author

What is the current state?

Henon wants a minor change, probably will ready with next release.

@mckaragoz mckaragoz added the new component Proposal or addition of a new component (apply this instead of enhancement) label Oct 8, 2023
@mckaragoz
Copy link
Member Author

Why not base this on MudButtonGroup? The functionality is great, but this introduces new visuals that do not comply with the Material documentation. @mckaragoz

Actually i don't like MudButtonGroup for core library. It not look a specific component, more like a template with group of buttons.

@mckaragoz
Copy link
Member Author

@henon, i rewrote the component a bit, used CSS grid this time. This is the result:

20231022_205835.mp4

I think its ready to merge.

@henon
Copy link
Contributor

henon commented Oct 22, 2023

Why not base this on MudButtonGroup?

@fondraco This is a good question. The MudButtonGroup uses MudButton
image

whereas this group uses MudToggleItem components which can have a value attached to them which would not make sense for a button.

image

Also this component is generic whereas the MudButtonGroup is not, so it would have been a breaking change to modify it to extend it with the functionality.

The functionality is great, but this introduces new visuals that do not comply with the Material documentation.

@fondraco How would you suggest to improve the visuals?

@henon henon removed needs: changes A maintainer has asked for further modifications to be made to this pull request PR: needs review labels Dec 22, 2023
@henon henon merged commit 35ecbbf into MudBlazor:dev Dec 22, 2023
@henon
Copy link
Contributor

henon commented Dec 22, 2023

Thanks for all the effort @mckaragoz !

henon added a commit that referenced this pull request Dec 23, 2023
@henon
Copy link
Contributor

henon commented Dec 24, 2023

This PR was merged too soon and since reverted. It has been continued in PR #7948 where we streamlined the API and improved the documentation.

@henon henon mentioned this pull request Dec 30, 2023
10 tasks
danielchalmers added a commit to danielchalmers/JournalApp that referenced this pull request Mar 5, 2024
danielchalmers added a commit to danielchalmers/JournalApp that referenced this pull request Mar 7, 2024
biegehydra pushed a commit to biegehydra/MudBlazor that referenced this pull request Apr 26, 2024
* New Component MudToggleGroup
---------

Co-authored-by: Artyom M <[email protected]>
biegehydra pushed a commit to biegehydra/MudBlazor that referenced this pull request Apr 26, 2024
@henon henon added legendary Marks contributions that are highly valuable, innovative, or significantly impactful to the project and removed legendary Marks contributions that are highly valuable, innovative, or significantly impactful to the project labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library new component Proposal or addition of a new component (apply this instead of enhancement)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants