Fix the placehoder in Draft.js

You have two options:

  1. Import Draft.css:
jsx
import 'draft-js/dist/Draft.css';
  1. Add the following css code:
css
.DraftEditor-root {
    position: relative;
}
.public-DraftEditorPlaceholder-root{
    position: relative;
}
.public-DraftEditorPlaceholder-inner{
    color: #aaaaaa;
    position: absolute;
}
.DraftEditor-editorContainer {
    background-color: rgba(255,255,255,0);
    border-left: .1px solid transparent;
    position: relative;
    z-index: 1;
}

Both options drive to the same results.

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.