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 to 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 such as 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 for YhTypographyText.

Small TextDefault TextLarge Text
Text Sizes

Paragraph

YhTypographyParagraph supports semantic color and alignment options.

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

YhTypographyLink supports href, target, type, underline, and disabled.

Ellipsis

Titles and paragraphs support the ellipsis prop. Use a boolean for titles and a line count for paragraphs.

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 components work in Nuxt 3/4 after registering @yh-ui/nuxt. The example below shows a simple client-side loading-state switch.

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:

  • Semantic tags such as headings, paragraphs, spans, and links render consistently during SSR.
  • Decoration, color, and ellipsis styles remain stable after hydration.
  • Slot content is rendered without client/server mismatch.

API

Props

Typography Title

PropDescriptionTypeDefault
levelHeading level1 | 2 | 3 | 4 | 5 | 61
typeText type'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'undefined
boldBoldbooleantrue
deleteStrikethroughbooleanfalse
underlineUnderlinebooleanfalse
italicItalicbooleanfalse
markHighlight markbooleanfalse
codeCode stylebooleanfalse
ellipsisEllipsisbooleanfalse
tagCustom tag namestringundefined
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined

Typography Text

PropDescriptionTypeDefault
typeText type'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'undefined
sizeFont size'small' | 'default' | 'large'undefined
boldBoldbooleanfalse
deleteStrikethroughbooleanfalse
underlineUnderlinebooleanfalse
italicItalicbooleanfalse
markMarkbooleanfalse
codeCode stylebooleanfalse
keyboardKeyboard stylebooleanfalse
ellipsisEllipsisbooleanfalse
tagCustom tag namestring'span'
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined

Typography Paragraph

PropDescriptionTypeDefault
typeText type'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'undefined
boldBoldbooleanfalse
deleteStrikethroughbooleanfalse
italicItalicbooleanfalse
markMarkbooleanfalse
alignAlignment'left' | 'center' | 'right' | 'justify'undefined
ellipsisEllipsisboolean | numberfalse
spacingParagraph spacing'compact' | 'default' | 'loose''default'
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined
PropDescriptionTypeDefault
hrefLink URLstringundefined
targetTarget'_blank' | '_self' | '_parent' | '_top''_self'
typeLink type'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'undefined
underlineUnderlinebooleanfalse
disabledDisabledbooleanfalse
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined

Events

NameDescriptionParameters
clickEmitted by Typography.Link when the link is clicked while not disabled(event: MouseEvent)

Slots

All typography sub-components support the default slot.

Expose

This component does not expose public instance methods or properties.

Theme 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

Code and keyboard styles additionally consume the global monospace token --yh-font-family-monospace.

Type Exports

NameDescription
YhTypographyTitlePropsTypography.Title props type
YhTypographyTextPropsTypography.Text props type
YhTypographyParagraphPropsTypography.Paragraph props type
YhTypographyLinkPropsTypography.Link props type
YhTypographySlotsShared typography slots type
YhTypographyTitleLevelTitle level union
YhTypographyTypeTypography type union
YhTypographyTitleInstanceTypography.Title instance type
YhTypographyTextInstanceTypography.Text instance type
YhTypographyParagraphInstanceTypography.Paragraph instance type
YhTypographyLinkInstanceTypography.Link instance type

Released under the MIT License.