Text

Text with prop-controlled size and weight.

Polymorphic as changes the HTML tag; medium increases font weight. size is the font size in pixels: 10, 12, 14, 16 (default), 20, 24, or 32. The former s, m, and l map to 12, 16, and 20.

Live example

Label

Example controls

Usage

import { Text } from '@prosazhin/pbcomponents';

<Text
  as='span'
  size={16}
>
  Label
</Text>;

Component API

PropType / variantsPurposeDefault
size10 | 12 | 14 | 16 | 20 | 24 | 3210 · 12 · 14 · 16 · 20 · 24 · 32Font size in pixels. The former s, m and l are 12, 16 and 20.16
mediumbooleanMedium font weight.false
asElementTypespan · p · divHTML text element.span
childrenstringComponent content.—
classNamestringClass of the root element.—

Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.