Skip to main content

TextBlock

A rectangle with an HTML label (with a fallback to SVG label for IE).

SVG selectors​

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer of all nodes
bodySVGRectElementRectangular body of the shape
labelHTMLDivElementText inside the body
const textBlock = new shapes.standard.TextBlock();
textBlock.resize(100, 100);
textBlock.position(250, 610);
textBlock.attr('root/title', 'shapes.standard.TextBlock');
textBlock.attr('body/fill', 'lightgray');
textBlock.attr('label/text', 'Hyper Text Markup Language');
// Styling of the label via `style` presentation attribute (i.e. CSS).
textBlock.attr('label/style/color', 'red');

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub