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

How do I add icon at the beginning of the component? #200

Open
aayushdutt opened this issue Jun 23, 2020 · 3 comments
Open

How do I add icon at the beginning of the component? #200

aayushdutt opened this issue Jun 23, 2020 · 3 comments

Comments

@aayushdutt
Copy link

Example:
image

@afvr94
Copy link

afvr94 commented Jul 10, 2020

Hello @aayushdutt, were you able to add the icon?

@aayushdutt
Copy link
Author

@afvr94 Nope. I still need help regarding this.

@empyreanmw
Copy link

empyreanmw commented Dec 21, 2020

You should use renderInput prop, so something like this

const defaultRenderInput = (props) => {
    let { onChange, value, addTag, ...other } = props;
    return (
      <span>
        <Box
          position="relative"
          top="3px"
          as={AiOutlineSearch}
          color="#f8b700"
        ></Box>
        <input type="text" onChange={onChange} value={value} {...other} />
      </span>
    );
  };

Box component in this case is acting as an icon that will appear in front of the input field.

<TagsInput
        renderInput={defaultRenderInput}
        onChange={(e) => handleTags(e)}
        value={tags}
      />

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

No branches or pull requests

3 participants