Interface TextStyleProps

interface TextStyleProps {
    align?: TextAlign;
    backgroundColor?: string | {
        image: string | ImageLike;
    };
    borderColor?: string;
    borderDash?: false | number[];
    borderDashOffset?: number;
    borderRadius?: number | number[];
    borderWidth?: number;
    ellipsis?: string;
    fill?: string;
    fillOpacity?: number;
    font?: string;
    fontFamily?: string;
    fontSize?: string | number;
    fontStyle?: FontStyle;
    fontWeight?: FontWeight;
    height?: number;
    lineDash?: false | number[];
    lineDashOffset?: number;
    lineHeight?: number;
    lineOverflow?: "truncate";
    lineWidth?: number;
    margin?: number;
    opacity?: number;
    overflow?: "none" | "break" | "breakAll" | "truncate";
    padding?: number | number[];
    placeholder?: string;
    rich?: Dictionary<TextStylePropsPart>;
    shadowBlur?: number;
    shadowColor?: string;
    shadowOffsetX?: number;
    shadowOffsetY?: number;
    stroke?: string;
    strokeNoScale?: boolean;
    strokeOpacity?: number;
    tag?: string;
    text?: string;
    textFont?: string;
    textShadowBlur?: number;
    textShadowColor?: string;
    textShadowOffsetX?: number;
    textShadowOffsetY?: number;
    truncateMinChar?: number;
    verticalAlign?: TextVerticalAlign;
    width?: number;
    x?: number;
    y?: number;
}

Hierarchy (view full)

Properties

align?: TextAlign
backgroundColor?: string | {
    image: string | ImageLike;
}

Type declaration

  • image: string | ImageLike
borderColor?: string
borderDash?: false | number[]
borderDashOffset?: number
borderRadius?: number | number[]
borderWidth?: number
ellipsis?: string

Epllipsis used if text is truncated

fill?: string
fillOpacity?: number
font?: string

If fontSize or fontFamily exists, font will be reset by fontSize, fontStyle, fontWeight, fontFamily. So do not visit it directly in upper application (like ), but use contain/text#makeFont instead.

fontFamily?: string

It helps merging respectively, rather than parsing an entire font string.

fontSize?: string | number

It helps merging respectively, rather than parsing an entire font string. Should be 12 but not '12px'.

fontStyle?: FontStyle

It helps merging respectively, rather than parsing an entire font string.

fontWeight?: FontWeight

It helps merging respectively, rather than parsing an entire font string.

height?: number

Height of text block. Not include padding Used for background, truncate

lineDash?: false | number[]
lineDashOffset?: number
lineHeight?: number

Line height. Default to be text height of '国'

lineOverflow?: "truncate"

Strategy when text lines exceeds textHeight. Do nothing if not set

lineWidth?: number

textStroke may be set as some color as a default value in upper applicaion, where the default value of lineWidth should be 0 to make sure that user can choose to do not use text stroke.

margin?: number

Margin of label. Used when layouting the label.

opacity?: number
overflow?: "none" | "break" | "breakAll" | "truncate"

Strategy when calculated text width exceeds textWidth. break: break by word break: will break inside the word truncate: truncate the text and show ellipsis Do nothing if not set

padding?: number | number[]

Can be 2 or [2, 4] or [2, 3, 4, 5]

placeholder?: string

Placeholder used if text is truncated to empty

rich?: Dictionary<TextStylePropsPart>

Text styles for rich text.

shadowBlur?: number

Shadow blur for background box.

shadowColor?: string

Shadow color for background box.

shadowOffsetX?: number

Shadow offset x for background box.

shadowOffsetY?: number

Shadow offset y for background box.

stroke?: string
strokeNoScale?: boolean
strokeOpacity?: number
tag?: string

Reserved for special functinality, like 'hr'.

text?: string
textFont?: string

The same as font. Use font please.

Deprecated

textShadowBlur?: number
textShadowColor?: string
textShadowOffsetX?: number
textShadowOffsetY?: number
truncateMinChar?: number

Min characters for truncating

verticalAlign?: TextVerticalAlign
width?: number

Only support number in the top block.

x?: number
y?: number