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

IMPORTANT MISSING FEATURE: Prop to limit the character length - maxLength and minLength attributes #626

Closed
invincibleinventor opened this issue Mar 25, 2024 · 2 comments

Comments

@invincibleinventor
Copy link

How do I limit the amount of characters (I do not mind if it includes the characters involved in the markdown syntax such as asteriks). Something similar to the maxLength attribute in a textarea maybe? Such a feature would be very relavant in places where one cannot afford to have an infinite amount of text written. Please let me know how could I add such a limit to my MDEditor component or if possible, a prop for controlling minLength and maxLength in the MD textarea. Thanks!

@jaywcjlove
Copy link
Member

@invincibleinventor The textareaProps props can be set

import React from "react";
import MDEditor from '@uiw/react-md-editor';

<MDEditor
  value={....}
  textareaProps={{
    placeholder: 'Please enter Markdown text',
    maxLength: 10
  }}
/>

@invincibleinventor
Copy link
Author

Works perfectly! Thanks a lot. Closing this issue...

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

2 participants