docs/components/display/Text

Text

Polymorphic text with size, weight, and color tokens.

import { Text } from '@ybouhjira/hyperkit';

#Playground

Edit the code — the preview recompiles and re-renders as you type.

Live playground
Loading preview…

#Props

PropTypeDefaultDescription
sizeFontSizeTokenFont size token. Maps to theme typography scale.
weightFontWeightToken | numberFont weight token or numeric value (100-900).
colorTextColorTokenText color token. Maps to theme color variables.
align'left' | 'center' | 'right'Text alignment.
truncatebooleanfalseTruncate text with ellipsis on overflow.
lineClampnumberLimit text to specified number of lines with ellipsis. Overrides truncate.
gradientstringCSS gradient value for gradient text effect. Overrides color.
letterSpacingstringCSS letter-spacing property.
lineHeightstring | numberLine height. Accepts CSS value or unitless number.
maxWstring | numberMaximum width. Accepts CSS value or number (converts to px).
whiteSpace'normal' | 'nowrap' | 'pre' | 'pre-wrap'White space handling.
italicbooleanfalseRender text in italic.
font'body' | 'mono''body'Font family token. 'body' uses the UI font (--sk-font-ui), 'mono' uses the monospace font (--sk-font-code) — ideal for timestamps, IDs, shortcuts, and data.
as'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'label' | 'div''span'HTML element to render as.
mbSpaceTokenMargin bottom spacing token.
mtSpaceTokenMargin top spacing token.
classstringAdditional CSS class.
styleJSX.CSSPropertiesInline styles. Merged with computed styles.
childrenJSX.ElementText content.
onClickJSX.EventHandlerUnion<HTMLElement, MouseEvent>Click event handler.
titlestringHTML title attribute for tooltip.