Draftjs styling in React

Robin picture Robin · Jul 10, 2016 · Viewed 10.2k times · Source

I want to use draft.js in my project. It has its own css which I also need to import. In the documentation it is said:

This CSS should be included when rendering the editor, as these styles set defaults for text alignment, spacing, and other important features.

  1. How do I include the Draft.css while rendering the component? Do I include it in my main index.html?
  2. Also how to give an id to the editor so that I can style it (eg. border, padding, min-height, etc)

Answer

Sergey picture Sergey · Aug 18, 2016

Depending on your setup, you should be able to include or import the Draft.css in the index.js file.

...
import 'draft-js/dist/Draft.css';
...