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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃檹 Provide renderInput callback for using component library #622

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

馃檹 Provide renderInput callback for using component library #622

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

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
@mnickolay mnickolay linked a pull request Oct 3, 2022 that will close this issue
JakeHedman added a commit to JakeHedman/react-mentions-continued that referenced this issue Feb 7, 2023
@taifen taifen linked a pull request Apr 2, 2024 that will close this issue
@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