Skip to content

Adding keyEvent simulation to buttons. #146

Open
@IhsenBen

Description

I was wondering if you could expose pressed: boolean props to allow simulating pressing buttons with other events, something like this

const AwesomeButton = ({
  // ... existing props
  pressed = false,
}: ButtonType) => {
  // ... existing code

  useEffect(() => {
    if (pressed) {
      pressIn({} as React.MouseEvent);
    } else {
      pressOut({} as React.MouseEvent);
    }
  }, [pressed]);

  // ... existing code
}

I know that the active props already exits, but still, it doesn't fire the pressIn and pressOut functions, if you are ok with this, , I can work on the pull request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions