Hi
If I might ask, does this have to be a Code Component? Can it just be a Canvas App Component? In which case it would be super easy.
1. Create the Component
2. Add an Event
3. In the Button , call the event, passing it data or whatever you want
4. Click to your UI (screen)
5. Find the Component and select it
6. Click the Drop down in the top left for its Properties, you will see the Event
7. Do whatever you want on the App Side and you simply access the data based on the Parameter Name you passed
Will this work?