Skip to content

Text ​

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.

Color Usage ​

type ​

Using type in MYText allows you to define text colors. These are the basic color definitions provided by mengyue-components. For example, use type to define the following colors. 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 don't meet your needs, you can also customize the color using the textColor property.

Code Demo
Custom Red TextCustom Pink Text
展开代码

Sizing ​

size ​

Use the size property to adjust the text size.

Code Demo
small Textmedium Textlarge Text
展开代码

Custom Size ​

Custom text sizes are also supported:

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

Combined Usage ​

Finally, combine multiple APIs:

Code Demo
Combined usage with medium and blue
展开代码

API Reference ​

Props ​

ParameterDescriptionTypeOptionsDefault
typeText typestringprimary/success/warning/danger/info—
sizeText sizestringsmall/medium/large/number/custommedium
textColorText colorstringSupports hex colors or color names—
tagRender tagstringAll HTML tagsspan

Type Definitions ​

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

Released under the MIT License.