Skip to content

Text ​

Brief Introduction ​

The Text component is used to display text content, supporting multiple styles and sizes. You can use <MYText></MYText> or <MYText /> to implement a text component.

Using Colors ​

type ​

Use type in MYText to define text colors. These colors are basic color definitions provided by mengyue-components. For example, use type to achieve the color definitions below. If type is not specified, the default text color is black:

Code Demo
Default text
Primary text
Success text
Warning text
Danger text
Info text
展开代码

Custom Color ​

If the default colors do not meet your needs, you can customize the text color using the color prop.

Code Demo
Custom red textCustom pink text
展开代码

Sizes ​

size ​

Use the size prop to adjust the text size.

Code Demo
Small textMedium textLarge text
展开代码

Custom Size ​

You can also customize the text size:

Code Demo
Custom text 20pxCustom text: 20Custom text 5remCustom text 5em
展开代码

Combined Usage ​

Finally, here is a combination of multiple APIs:

Code Demo
Combined usage: medium size and blue color
展开代码

API Reference ​

Props ​

PropDescriptionTypeOptionsDefault
typeText typestringprimary/success/warning/danger/info—
sizeText sizestringsmall/medium/large/number/custom valuemedium
TecolorText colorstringHex or named color—
tagRendered HTML tagstringAny HTML tagspan

Type Definitions ​

typescript
interface TextProps {
  type?: string;
  size?: string | number;
  Tecolor?: string;
  tag?: string;
}

Released under the MIT License.