Foundations

Typography

@xui/text

Typographic styling for a heading element.

Install

pnpm add @xui/text

Add the barrel to a standalone component's imports:

import { XuiTextImports } from '@xui/text';

@Component({
  imports: [XuiTextImports],
  // …
})

Examples

Default

Loading preview…

Headings

Loading preview…

Colors

Loading preview…

Ellipsize

Loading preview…

Html elements

Loading preview…

API

XuiHeading

directiveh1[xuiHeading],h2[xuiHeading],h3[xuiHeading],h4[xuiHeading],h5[xuiHeading],h6[xuiHeading]

Typographic styling for a heading element.

Variants

AxisOptionsDefaultlevel1234561

Inputs

NameTypeDefaultclassClassValueThe user-defined classes. Merged last so they win over the variant classes.''levelXuiHeadingLevel | nullOverrides the visual size. Defaults to the host element's own level.null

XuiStyledElement

directive

Typographic styling for the plain HTML elements prose is made of — blockquote, code, pre, and ordered and unordered lists.

Inputs

NameTypeDefaultclassClassValueThe user-defined classes. Merged last so they win over the base classes.''

XuiBlockquote

directiveblockquote[xuiBlockquote]

Styles a native <blockquote> as quoted prose.

XuiCode

directivecode[xuiCode]

Styles a native inline <code>.

XuiCodeBlock

directivepre[xuiCodeBlock]

Styles a native <pre> as a code block.

XuiList

directiveol[xuiList],ul[xuiList]

Styles a native <ol> or <ul>, including nested ones.

XuiText

directive[xuiText]

Body text with optional truncation.

Variants

AxisOptionsDefaultcolordefaultmutedsubtleprimarysuccesserrorwarninginfosizexssmmdbaselgweightnormalmediumsemiboldboldellipsizetruefalsefalse

Inputs

NameTypeDefaultclassClassValueThe user-defined classes. Merged last so they win over the variant classes.''colorXuiTextVariants['color']Semantic text colour, from foreground down to subtle plus the intent colours.this.config.colorsizeXuiTextVariants['size']Font size, from the theme's type scale.this.config.sizeweightXuiTextVariants['weight']Font weight.this.config.weightellipsizebooleanTruncate with an ellipsis instead of wrapping.falsetitlestring | nullAn explicit title, which always wins over the generated overflow title.null

Methods

remeasure(): voidRe-check whether the content overflows. Called automatically when the element resizes. Call it yourself after changing the text inside a box whose size did not change — measuring on every render instead would mean a scrollWidth read per instance per change detection cycle, which is exactly the reflow cost that makes long lists slow.

Source

libs/ui/text/xui

xUI 2.0.0 — Apache 2.0 licensed. Built with Angular and Tailwind CSS.