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

New Input variant: with icon #645

Open
JoseWhite opened this issue Jul 15, 2024 · 0 comments
Open

New Input variant: with icon #645

JoseWhite opened this issue Jul 15, 2024 · 0 comments

Comments

@JoseWhite
Copy link

Feature Description

This new variant of the input would allow using an icon inside the text field as well as tapping into it's click events.

Suggested Solution

function InteractiveIconInput({
  className,
  onIconClick,
  Icon,
  name,
  ...rest
}) {
  return (
    <>
      <Input
        className={classnames(
          'interactive-icon-input',
          className
        )}
        {...rest}
      >
        <Icon className="interactive-icon" onClick={onIconClick} />
      </Input>
    </>
  )
}

Alternatives Considered / Existing Workarounds

Extending the functionality of the regular Input on a per project basis.

Additional Context

Sample use case, Artlook-client project: In this project, the regular input was extended with functionality similar to the described above. The Icon in this case is a calculator and the callback from that icon click is used to display a modal specifically related to the input.

I understand that it is likely that not every project manages their Icon with an Icon component but I still think this could provide a starting point and support for other types of interfaces for icons be added later.

image

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

No branches or pull requests

1 participant