react-native-ui-kitten icon indicating copy to clipboard operation
react-native-ui-kitten copied to clipboard

Collapsible Accordion

Open Gustl22 opened this issue 4 years ago • 14 comments

🚀 Feature Proposal

Customizable Component for collapse contents within an accordion.

Motivation & Example

I want to provide a list of exercises, the user can select. But I want to keep it all on the same page, to let the user browse faster the items. The items should then be expandable and collapsible (different defaults each item, customizable content or icon for header and body).

See bootstrap.

Please correct me, if this feature is already implemented somehow.

Gustl22 avatar Apr 21 '20 07:04 Gustl22

Can the grouped menu work for you?

artyorsh avatar Apr 21 '20 07:04 artyorsh

Haven't tried yet, if this supports custom items instead of MenuItem. Anyway I noticed that I need a custom Header, too, which is not the case in MenuGroup. So it may be better to make my own component.

Can be closed or keep open, if want to implement such feature. Thanks for the response :)

Gustl22 avatar Apr 21 '20 11:04 Gustl22

@Gustl22 yup, there are too many options on how it should look. Especially when looking at the one you shared. But let's keep it open to see the interest and prioritize some time.

artyorsh avatar Apr 21 '20 11:04 artyorsh

I think a good approach would be to make a collapsible Card component (with animation), so that the header is always shown and the content is hided completely in collapsed state.

BTW: Used LayoutAnimation before collapse state change and adapted heights of Card and Header.

Here a demo of my implementation: Card-Accordion

Gustl22 avatar Apr 21 '20 22:04 Gustl22

I can't find group menu for version 4.4 (Don't want to upgrade to 5 since it's still alpha)

yogevlahyani avatar Apr 25 '20 14:04 yogevlahyani

@yogevlahyani v4 docs is here. See the version switcher at the top of the page.

artyorsh avatar Apr 25 '20 17:04 artyorsh

@artyorsh Yes I know, MenuGroup isn't in the docs or in v4 in general

yogevlahyani avatar Apr 25 '20 17:04 yogevlahyani

@yogevlahyani Yup, because there was no special component for that. This was achieved in a different and less customizable (that's why it was completely reimplemented) way. For v4, see sub-menu example in the old docs

artyorsh avatar Apr 25 '20 17:04 artyorsh

@artyorsh Thanks! :)

yogevlahyani avatar Apr 25 '20 17:04 yogevlahyani

Trying to do something similar here. I have a large form that I want to break up into chunks with an accordion-style layout. I tried to accomplish this using MenuGroups, but I can't find a way to customize MenuItem. Is this possible, or have people found a better solution for accordions?

dlwiest avatar Oct 29 '20 19:10 dlwiest

Trying to do something similar here. I have a large form that I want to break up into chunks with an accordion-style layout. I tried to accomplish this using MenuGroups, but I can't find a way to customize MenuItem. Is this possible, or have people found a better solution for accordions?

I tried adding a View component to the MenuItem description prop but it causes layout issues (e.g. any Text component inside that View will overflow). Probably because the description prop is expecting Text.

johnkmzhou avatar Mar 20 '21 07:03 johnkmzhou

Any updates on this? I think a collapse/toggle component would be helpful

GuilhermeAmado avatar May 05 '21 23:05 GuilhermeAmado

I would also like this. MenuGroup is for selectable items. An accordion is just for hiding some details, but not for selecting. It is super common for accordions to appear in UIs. It's such an essential UI component.

ffMathy avatar Jun 04 '22 08:06 ffMathy

Was it decided to not introduce this new component?

angelxmoreno avatar Apr 02 '24 03:04 angelxmoreno