Skip to content
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

onClick event for Simple Panel with header ? #466

Closed
ku-s-h opened this issue Mar 31, 2015 · 4 comments
Closed

onClick event for Simple Panel with header ? #466

ku-s-h opened this issue Mar 31, 2015 · 4 comments
Labels
docs Documentation related question

Comments

@ku-s-h
Copy link

ku-s-h commented Mar 31, 2015

Is it any way to fire an event when a simple Panel is clicked by the user ?

@mtscout6
Copy link
Member

mtscout6 commented Apr 6, 2015

The Panel component takes an onSelect prop which is invoked when it is clicked. We need better docs on this still but you can check out the click handler at https://github.com/react-bootstrap/react-bootstrap/blob/v0.20.1/src/Panel.js#L25-L37. The docs update is part of #419.

@mtscout6
Copy link
Member

mtscout6 commented Apr 6, 2015

Does this help you accomplish what you needed?

@ku-s-h
Copy link
Author

ku-s-h commented Apr 6, 2015

From what I gather from the code, the handleSelect() function is used only if the panel is declared as collapsable. What I actually want to do is to render a component when my Panel with heading is clicked. I was thinking of editing the /src/Panel.js file to add an onClick handler on the Panel's wrapper div and rebuilding the module.

@dozoisch dozoisch added this to the 1.0.0 Release milestone May 3, 2015
@AlexKVal
Copy link
Member

You already can do what you need because of that https://github.com/AlexKVal/react-bootstrap/blob/ccc50e01917ba75e5a983ba068c1db4b790bb85d/src/Panel.js#L58

Just try to copy / past this code into code-editor under a show code button
http://react-bootstrap.github.io/components.html#panels:

const panelInstance = (
  <Panel onClick={()=>alert('It works')}>
    Basic panel example
  </Panel>
);

React.render(panelInstance, mountNode);

🍒

Does it help you ?

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

No branches or pull requests

4 participants