Having trouble getting help?
Contact Support
Contact Support
Customize font family drop down in React Document editor component
29 Mar 20251 minute to read
Document editor provides an options to customize the font family drop down list values using fontfamilies
in Document editor settings. Fonts which are added in fontFamilies of documentEditorSettings
will be displayed on font drop down list of text properties pane and font dialog.
Similarly, you can use documentEditorSettings
property for DocumentEditor also.
The following example code illustrates how to change the font families in Document editor container.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import {
DocumentEditorContainerComponent,
Toolbar,
} from '@syncfusion/ej2-react-documenteditor';
DocumentEditorContainerComponent.Inject(Toolbar);
function App() {
// Add required font families to list it in font drop down
let fontFamilies = {
fontFamilies: ['Algerian', 'Arial', 'Calibri', 'Cambria'],
};
return (
<DocumentEditorContainerComponent
id="container"
height={'590px'}
serviceUrl="https://ej2services.syncfusion.com/production/web-services/api/documenteditor/"
enableToolbar={true}
documentEditorSettings={fontFamilies}
/>
);
}
export default App;
ReactDOM.render(<App />, document.getElementById('sample'));
Output will be like below: