material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[ChipGroup] Allow the option to set max rows of chips to display for a chip group

Open bennycao opened this issue 5 years ago • 10 comments

Partially solves https://github.com/material-components/material-components-android/issues/953

Add ChipGroup option to set maxRowCount. If set, will display chips up to maxRowCount.

Screen Shot 2020-02-29 at 6 27 43 pm

Add ChipGroup option overflowChipEnabled and overflowChipTextResource. If enabled with maxRowCount will display a chip using overflowChipTextResource (can be a PluralRes or StringRes) to set the text to display when reflow exceeds maxRowCount.

Screen Shot 2020-02-29 at 6 28 03 pm

Added a new catalog for chipgroup showing example of usage.

The use case for enabling overflowChipEnabled or even setting maxRowCount works well for display of read only (no interactions) chips. The implementation of this could include binding a onClick event on the overflow chip to navigate to an edit/selection type page of chips

  • [x] Identify the component the PR relates to in brackets in the title. [Buttons] Updated documentation
  • [x] Link to GitHub issues it solves. Partially solves https://github.com/material-components/material-components-android/issues/953
  • [x] Sign the CLA bot. You can do this once the pull request is opened.

bennycao avatar Feb 29 '20 07:02 bennycao

It's great to see that you have a chip showing how many more chips are available, however, I think it would make sense if it was on the 2nd row instead of an additional row.

wcshi avatar Mar 03 '20 18:03 wcshi

It's great to see that you have a chip showing how many more chips are available, however, I think it would make sense if it was on the 2nd row instead of an additional row.

I think having it on the 2nd or new row can depend on the design requirements. This possibly could be a choice as opposed to a rule ?

bennycao avatar Mar 03 '20 21:03 bennycao

Could you please add an overflowChipSingularResource as well?

wcshi avatar Mar 05 '20 16:03 wcshi

Could you please add an overflowChipSingularResource as well?

👍 . Is this so we can have view text that just displays more... or the like ?

bennycao avatar Mar 05 '20 22:03 bennycao

Could you please add an overflowChipSingularResource as well?

@wcshi updated so that the attribute overflowChipPluralResource is now overflowChipTextResource and can accept a PluralRes or StringRes

bennycao avatar Mar 06 '20 11:03 bennycao

This is not a comprehensive set of comments, there are still problems, we are considering opening up the api so this could be an extension instead.

This is a starting point on what direction we want to take it.

As i see it, i don't see a usecase where we would want to limit the display rows and have any chips selectable when you don't show all the chips available. Hence ideally the only reason you would have a max row count is in a read only state. And the implementer can choose to decide how they want to proceed to a editable/selectable like display. This can be a new screen or the re-render of the chipgroup without a max row defined.

Will take your lead on this on how to proceed on this feature. Happy to help where i can.

bennycao avatar Mar 07 '20 12:03 bennycao

Any chance this will be resolved and merged soon? Super excited for the option to set a max number of rows and have the ChipGroup know how to scroll from there. I'd like to display a bunch of actionable chips that a user can click, but want more than just one row of chips. I'd rather have a scrollable grid with a customizable number of rows of chips.

madCode avatar Sep 30 '20 04:09 madCode

any progress on that?

ahulyk avatar Apr 26 '21 12:04 ahulyk

any progress on that?

luangs7 avatar Aug 04 '22 16:08 luangs7

Hi all, sorry for such a delay on my side on responding to the interest of this feature. As it seems, there doesn't seem to be an appetite from their end to have this feature as a feature on the materials component. This has been open for a long time and not sure if google are willing to revisit. There is also what looks like similar issue/request https://github.com/material-components/material-components-android/issues/696 which has a long timeline.

bennycao avatar Aug 11 '22 22:08 bennycao

I'm sad that Google does not merge this pr. Many times setting the max line is very useful. You did a good job! 👍

michaellee123 avatar Jun 02 '23 08:06 michaellee123