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
| Prop | Type / variants | Purpose | Default |
|---|---|---|---|
size | 10 | 12 | 14 | 16 | 20 | 24 | 3210 · 12 · 14 · 16 · 20 · 24 · 32 | Font size in pixels. The former s, m and l are 12, 16 and 20. | 16 |
medium | boolean | Medium font weight. | false |
as | ElementTypespan · p · div | HTML text element. | span |
children | string | Component content. | — |
className | string | Class of the root element. | — |
Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.