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

🙏 Provide renderInput callback for using component library #622

Closed
Hideman85 opened this issue Sep 30, 2022 · 1 comment · Fixed by #739 · May be fixed by #623
Closed

🙏 Provide renderInput callback for using component library #622

Hideman85 opened this issue Sep 30, 2022 · 1 comment · Fixed by #739 · May be fixed by #623

Comments

@Hideman85
Copy link

It would be an amazing user experience if we could use our component library to render the input 🙏

import TextField from '@mui/material/TextField';

const renderInput = (props) => <TextField {...props} label='Comment...' />;

export const MentionsTextfield: FC<MentionsTextfieldProps> = ({ options, value, onChange, disabled }) => {
  const inputRef = useRef<HTMLElement>(null);

  useEffect(() => {
    inputRef.current?.focus();
  }, []);

  return (
    <MentionsInput
      ref={inputRef}
      style={defaultStyleMentions}
      singleLine={false}
      disabled={disabled}
      value={value}
      onChange={onChange}
      renderInput={renderInput}
    >
      <Mention appendSpaceOnAdd displayTransform={(_, display) => `@${display} `} trigger='@' markup={MENTION_MARKUP} data={options} />
    </MentionsInput>
  );
};
mnickolay added a commit to FishandRichardsonPC/react-mentions that referenced this issue Oct 3, 2022
JakeHedman added a commit to JakeHedman/react-mentions-continued that referenced this issue Feb 7, 2023
@gioragutt
Copy link

There's an open PR by @taifen that solves this, let's bump it up 👍🏻

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