Skip to content

Add defaultOpen prop to Collapse for initial open state control. #474

New issue

Have a question about this project? 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
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AdeboyeDN
Copy link

Changes:

  • Added defaultOpen prop to CollapseProps type with default value of false
  • Added new DefaultOpen story to demonstrate the functionality
  • Added tests to verify defaultOpen behavior and its interaction with the open prop

This PR adds the suggested behaviour of collapse, as proposed by @itaiperi, and it closes the issue #471

Example usage:

<Collapse defaultOpen>
  <Collapse.Title>I start open</Collapse.Title>
  <Collapse.Content>Visible by default</Collapse.Content>
</Collapse>

Copy link

netlify bot commented Apr 20, 2025

👷 Deploy Preview for react-daisyui processing.

Name Link
🔨 Latest commit 4b815c6
🔍 Latest deploy log https://app.netlify.com/sites/react-daisyui/deploys/6805052e558d5e0008dfa6b6

1 similar comment
Copy link

netlify bot commented Apr 20, 2025

👷 Deploy Preview for react-daisyui processing.

Name Link
🔨 Latest commit 4b815c6
🔍 Latest deploy log https://app.netlify.com/sites/react-daisyui/deploys/6805052e558d5e0008dfa6b6

Copy link

netlify bot commented Apr 20, 2025

Deploy Preview for react-daisyui ready!

Name Link
🔨 Latest commit 4b815c6
🔍 Latest deploy log https://app.netlify.com/sites/react-daisyui/deploys/6805052e558d5e0008dfa6b6
😎 Deploy Preview https://deploy-preview-474--react-daisyui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AdeboyeDN
Copy link
Author

@benjitrosch Want to take a look?

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

Successfully merging this pull request may close these issues.

1 participant