Skip to content

← All components

Foundation and layout

Text

Body, muted, lead, small, and caption text styles.

Live example

Readable body text for long-form content.

Supporting metadata stays quiet.

Usage

Each example includes the complete adapter-specific parameter reference. Copy it as a starting point, then remove options your use case does not need.

React

tsx
import { Text } from "@cofob/design-system-react";

/**
 * Complete Text parameter reference.
 * @param as
 *   type: element name (adapter-specific union)
 *   default: component default
 *   example: "article"
 * @param size
 *   type: "sm" | "md" | "lg" (plus heading sizes)
 *   default: "md"
 *   example: "md"
 * @param tone
 *   type: "neutral" | "accent" | "info" | "success" | "warning" | "danger"
 *   default: "neutral"
 *   example: "success"
 * @param children
 *   type: ReactNode | Svelte Snippet | child HTML
 *   default: —
 *   example: children / snippet / child HTML
 */
export function TextExample() {
  return (
    <Text>Content</Text>
  );
}

Svelte

svelte
<script lang="ts">
  import { Text } from "@cofob/design-system-svelte";

  // Complete Text parameter reference.
  // as
  //   type: element name (adapter-specific union)
  //   default: component default
  //   example: "article"
  // size
  //   type: "sm" | "md" | "lg" (plus heading sizes)
  //   default: "md"
  //   example: "md"
  // tone
  //   type: "neutral" | "accent" | "info" | "success" | "warning" | "danger"
  //   default: "neutral"
  //   example: "success"
  // children
  //   type: ReactNode | Svelte Snippet | child HTML
  //   default: —
  //   example: children / snippet / child HTML
</script>

<Text>Content</Text>

HTML

html
<!--
  Complete Text parameter reference.
  as
    type: element name (adapter-specific union)
    default: component default
    example: "article"
  size
    type: "sm" | "md" | "lg" (plus heading sizes)
    default: "md"
    example: "md"
  tone
    type: "neutral" | "accent" | "info" | "success" | "warning" | "danger"
    default: "neutral"
    example: "success"
  children
    type: ReactNode | Svelte Snippet | child HTML
    default: —
    example: children / snippet / child HTML
-->
<p class="cf-text" data-tone="muted">Metadata</p>

Parameters

Adapter differences are explicit. Native element attributes are forwarded in React and Svelte and can be written directly in HTML.

ParameterTypeDefaultAdaptersExampleDescription
aselement name (adapter-specific union)component defaultReact · Svelte · HTML"article"Chooses the rendered semantic element.
size"sm" | "md" | "lg" (plus heading sizes)"md"React · Svelte · HTML"md"Applies a design-system size token.
tone"neutral" | "accent" | "info" | "success" | "warning" | "danger""neutral"React · Svelte · HTML"success"Applies semantic color intent without hard-coded colors.
childrenReactNode | Svelte Snippet | child HTMLReact · Svelte · HTMLchildren / snippet / child HTMLIdiomatic adapter composition content.