Text

A flexible text element for body content with configurable size, weight, and text overflow handling.

Anatomy

<script>
  import { Text } from "@saas-ui/svelte/typography/text";
</script>

<!-- Basic text -->
<Text>This is body text.</Text>

<!-- With size -->
<Text size="lg">Larger text</Text>

<!-- With truncation -->
<Text truncate>Very long text that will be truncated...</Text>

<!-- With line clamp -->
<Text lineClamp="2">
  Long text that spans multiple lines will be clamped to 2 lines...
</Text>

Examples

Basic Accessibility

Basic text with default styling for body content and paragraphs.

Line Clamp Accessibility

Use the lineClamp prop to limit text to a specific number of lines with an ellipsis.

Sizes Accessibility

Use the size prop to change the size of the text. Available sizes: xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl, 7xl.

Truncation Accessibility

Use the truncate prop to truncate text after a single line with an ellipsis.

Weights Accessibility

Use the weight prop to change the font weight. Available weights: light, normal, medium, semibold, bold.

Props

Prop Type Default Description
as text p -
size xs | sm | md | lg | xl | 2xl | 3xl | 4xl | 5xl | 6xl | 7xl md The size of the component.
weight light | normal | medium | semibold | bold normal -
truncate boolean - -
lineClamp 1 | 2 | 3 | 4 | 5 | 6 | none - -
fontWeight any - -
textStyle any - -
children any - The content to be rendered inside the component.
class text - Additional CSS classes to apply.