10000 Can it be used with a loading spinner · Issue #914 · szhsin/react-accordion · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Can it be used with a loading spinner #914

New issue

Have a question about this projec 9E99 t? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
castortech opened this issue May 4, 2025 · 1 comment
Open

Can it be used with a loading spinner #914

castortech opened this issue May 4, 2025 · 1 comment

Comments

@castortech
Copy link

I have been using shadCN accordion but it lacks the ability to hook into the accordion being opened to show a loading spinner to the user and our accordion is use to load large amount of data.

Is this possible with react-accordion ? From what I can gather it might be a lot easier.

Thanks
Alain

@szhsin
Copy link
Owner
szhsin commented May 5, 2025

You can listen to the onStateChange event on the Accordion component. The same event is also available through the useAccordionProvider hook if you're using a ControlledAccordion.

Since onStateChange is an event, you can use it to trigger side effects such as fetching data asynchronously.

Here is the doc link for onStateChange.
And here is a sandbox example that listens to the event on the third item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0