Text

A polymorphic text component that renders as different HTML elements with predefined styles.



Installation

npx shadcn-svelte@latest add https://retroui-svelte.netlify.app/r/text.json


Usage

		<script lang="ts">
  import { Text } from "$lib/components/ui/text/index.js";
</script>
 
<Text>This is default paragraph text</Text>
<Text as="h1">This is a heading</Text>
<Text as="a" href="#">This is a link</Text>
	

API

Props

  • as?: "p" | "li" | "a" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" - The HTML element to render as. Defaults to "p".
  • class?: string - Additional CSS classes.
  • Other standard HTML attributes for the rendered element.

Examples

Paragraph