RichLabel
Draws one label of inline content anchored at a point on an SVG surface.
@internote/canvas-sdk/reactimport { RichLabel } from '@internote/canvas-sdk/react';The label renders as HTML inside a foreignObject, so it carries everything a label's inline content can hold: bold, maths, symbols, live values. The box is deliberately roomy and transparent and takes no pointer; the flex alignment inside it puts the text exactly where align and baseline say. Nothing is clipped to it, so a label never loses a descender. A label with nothing to draw renders nothing.
#Props
Also takes className. Any other prop is passed to the rendered element.
alignWhere the anchor sits along the label's width.
startmiddleendDefault
'middle'baselineWhere the anchor sits against the label's height.
abovebelowcentreDefault
'above'colourThe text colour as CSS. The label inherits the mark's when given.
stringcontentThe label's inline content, as an attribute value carries it, or a plain string.
unknownmaxWidthA width the words must fit inside, wrapping onto further lines rather than running past it. Without it a label is one line however long it is, which is right for nearly all of them.
numberrotateDegrees to turn the words about the anchor, for a name up the side of an axis.
numbersizeThe font size in pixels, already scaled by the canvas unit, as
labelPx gives it.numberxThe anchor's x, in the SVG's pixels.
numberyThe anchor's y, in the SVG's pixels.
number#Example
<RichLabel content={attrs.label} x={px} y={py - unit * 0.5} size={labelPx(attrs['text-size'], u)} colour={colourCss(attrs.colour)} align="middle" baseline="above" />Declared in packages/canvas-sdk/src/react/surface-label.tsx:84.