Skip to content

Typography

Used to display titles, paragraphs, text, links, and other typographic content.

Heading Levels

Use the level prop to define the heading level, supporting h1 - h6.

Heading h1

Heading h2

Heading h3

Heading h4

Heading h5
Heading h6
Heading Levels

Text Types

Use the type prop to define the semantic color of the text.

Default TextPrimarySuccessWarningDangerInfoSecondary
Text Types

Text Decorations

Control text styles through props like bold, italic, underline, delete, mark, code, and keyboard.

Bold TextItalic TextUnderline TextStrikethrough TextMarked TextCode StyleKeyboard Style
Text Decorations

Text Sizes

Use the size prop to set the font size.

Small TextDefault TextLarge Text
Text Sizes

Paragraph

The Paragraph component supports type semantic colors and align alignment.

YH-UI is a modern UI component library for Vue 3, providing rich components and utilities. With Composition API and strong TypeScript support, it offers an ultimate development experience.

This paragraph uses the secondary color type, suitable for auxiliary descriptions.

Paragraph

The Link component supports props like href, target, type, underline, and disabled.

Ellipsis

Titles and paragraphs support the ellipsis prop. Set to boolean for Titles (single-line) and numbers for Paragraphs (multi-line).

This is a very long title. It will be truncated with an ellipsis when the container width is insufficient.

This is a multi-line paragraph. By setting ellipsis to a number, you can control the number of lines displayed. When the content exceeds the specified lines, it will automatically show an ellipsis. This is very useful in list pages and card components to effectively control the display area.

Ellipsis

Use in Nuxt

Typography fully supports Nuxt 3/4 SSR rendering. Components are auto-imported in Nuxt projects, no manual registration needed. The following example demonstrates async loading state with useAsyncData.

Welcome to YH-UI

A modern Vue 3 component library with full Nuxt SSR support.

YH-UI provides rich components to help quickly build modern web applications.

Learn More
Use in Nuxt

SSR Notes:

  • ✅ All Props and styles fully supported
  • ✅ Semantic tags (h1-h6, p, span, a) render perfectly
  • ✅ Slot content fully rendered
  • ✅ Ellipsis styles correctly output
  • ✅ Text decoration, type colors, and other states work normally

SSR Safety

All Typography sub-components have passed complete SSR tests, ensuring that server-side and client-side rendering are completely consistent with no Hydration errors.

API

Typography.Title Props

PropDescriptionTypeDefault
levelHeading level1 | 2 | 3 | 4 | 5 | 61
typeText type'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'
boldBoldbooleantrue
deleteStrikethroughbooleanfalse
underlineUnderlinebooleanfalse
italicItalicbooleanfalse
markHighlight markbooleanfalse
codeCode stylebooleanfalse
ellipsisEllipsisbooleanfalse
tagCustom tag namestring
themeOverridesTheme overridesComponentThemeVars

Typography.Text Props

PropDescriptionTypeDefault
typeText type'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'
sizeFont size'small' | 'default' | 'large'
boldBoldbooleanfalse
deleteStrikethroughbooleanfalse
underlineUnderlinebooleanfalse
italicItalicbooleanfalse
markMarkbooleanfalse
codeCode stylebooleanfalse
keyboardKeyboard stylebooleanfalse
ellipsisEllipsisbooleanfalse
tagCustom tag namestring'span'
themeOverridesTheme overridesComponentThemeVars

Typography.Paragraph Props

PropDescriptionTypeDefault
typeText type'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'
alignAlignment'left' | 'center' | 'right' | 'justify'
spacingParagraph spacing'compact' | 'default' | 'loose''default'
boldBoldbooleanfalse
deleteStrikethroughbooleanfalse
italicItalicbooleanfalse
markMarkbooleanfalse
ellipsisEllipsis (boolean=single, number=multi)boolean | numberfalse
themeOverridesTheme overridesComponentThemeVars
PropDescriptionTypeDefault
hrefLink URLstring
targetTarget'_blank' | '_self' | '_parent' | '_top''_self'
typeLink type'primary' | 'success' | 'warning' | 'danger' | 'info'
underlineUnderlinebooleanfalse
disabledDisabledbooleanfalse
themeOverridesTheme overridesComponentThemeVars

Slots

All Typography sub-components support the default slot.

Theme Variables

Typography supports customizing local styles by overriding the following CSS variables:

Variable NameDescriptionDefault
--yh-typography-title-colorTitle colorvar(--yh-text-color-primary, #303133)
--yh-typography-title-weightTitle font weight600
--yh-typography-h1-sizeh1 size32px
--yh-typography-h2-sizeh2 size28px
--yh-typography-h3-sizeh3 size24px
--yh-typography-h4-sizeh4 size20px
--yh-typography-h5-sizeh5 size16px
--yh-typography-h6-sizeh6 size14px
--yh-typography-text-colorText colorvar(--yh-text-color-regular, #606266)
--yh-typography-text-sizeText size14px
--yh-typography-line-heightLine height1.5
--yh-typography-paragraph-line-heightParagraph line height1.8
--yh-typography-link-colorLink colorvar(--yh-color-primary, #409eff)
--yh-typography-link-hover-colorLink hover colorvar(--yh-color-primary-light-3, #79bbff)
--yh-typography-mark-bgMark background color#ffe58f
--yh-font-family-monospaceMonospace font'SFMono-Regular', Consolas, monospace

Released under the MIT License.