Skip to content

🙏 Provide renderInput callback for using component library #622

Closed
@Hideman85

Description

@Hideman85

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>
  );
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions