Skip to content

RichText

RichText Component for displaying text with custom formats

Usage

import {RichText} from 'deft-react';
function App() {
const richTextRef = useRef();
useEffect(() => {
richTextRef.current.addLine([
{
type: "text",
text: "R",
color: "#F00",
weight: 'bold',
},
{
type: "text",
text: "ich",
weight: 'bold',
},
{
type: "text",
text: "T",
color: "#F00",
style: 'italic',
},
{
type: "text",
text: "ext",
style: 'italic',
}
]);
}, []);
return <RichText ref={richTextRef} />
}

Properties

Methods

MethodDescriptionReturn Type
addLineAppend a line-
insertLineInsert a line at specified position-
deleteLineDelete specified line-
updateLineUpdate specified line-
clearClear all text-
measureLineMeasure dimensions of specified text-