Skip to content
Latestv1.0.60

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 Levels

Text Types

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

Text Types

Text Decorations

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

Text Decorations

Text Sizes

Use the size prop to set the font size for YhTypographyText.

Text Sizes

Paragraph

YhTypographyParagraph supports semantic color and alignment options.

Paragraph

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

Link

Ellipsis

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

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.

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.