Text
Usage
Text is the base typography component for body copy, labels, headings, and supporting descriptions. Use it when you need consistent typography across content and interface text, and when the semantic HTML element and the visual text style should be chosen separately.
import { MtText } from "@shopware-ag/meteor-component-library";
Examples
Sizes
API reference
Props
| Prop | Type | Default |
|---|---|---|
size | "m" | "l" | "s" | "2xs" | "xs" | "xl" | "2xl" | "3xl" | "s" |
weight | "bold" | "regular" | "semibold" | "medium" | "regular" |
color | string | "color-text-primary-default" |
as | string | Component | "p" |
Slots
| Slot | Bindings |
|---|---|
default | {} |
Best practices
Do
- Choose the
asprop based on the semantic meaning of the content. - Choose
sizeandweightbased on visual hierarchy. - Keep color choices aligned with the text token system.
Don't
- Do not use Text only for spacing or layout.
- Do not use heading-sized text when the content is not actually a heading in the page structure.
- Do not override the semantics of important content without a clear reason.
Behavior
- Text renders as a semantic element through the
asprop and defaults to a paragraph. size,weight, andcolorcontrol the visual style while the content stays in the default slot.- Larger sizes use the heading font tokens, while smaller sizes use the body font tokens.
Accessibility
- Use the
asprop to preserve the correct document structure, especially for headings. - Do not rely on visual styling alone to communicate hierarchy if semantic headings are required.
- Keep color choices readable against the background and aligned with contrast requirements.