Docs Components Primitives

Text

React example follows below.
ts
const textFixture = {
id: "text",
items: [
{ copy: "Apps, APIs and deploys that stay understandable.", variant: "body" },
{ copy: "Secondary supporting copy.", variant: "muted" },
{ copy: "Small print for captions.", variant: "small" },
{ copy: "build · 2026.06.21 · a1b2c3d", variant: "mono" },
],
} satisfies {
id: string;
items: ReadonlyArray<{ copy: string; variant: "body" | "muted" | "small" | "mono" }>;
};
import { Text } from "@grassroot/ui-react";
export default function TextDemo() {
return (
<div>
{textFixture.items.map((item) => (
<Text key={item.variant} variant={item.variant}>
{item.copy}
</Text>
))}
</div>
);
}
ts
<script setup lang="ts">
const textFixture = {
id: "text",
items: [
{ copy: "Apps, APIs and deploys that stay understandable.", variant: "body" },
{ copy: "Secondary supporting copy.", variant: "muted" },
{ copy: "Small print for captions.", variant: "small" },
{ copy: "build · 2026.06.21 · a1b2c3d", variant: "mono" },
],
} satisfies {
id: string;
items: ReadonlyArray<{ copy: string; variant: "body" | "muted" | "small" | "mono" }>;
};
import { Text } from "@grassroot/ui-vue";
</script>
<template>
<div>
<Text v-for="item in textFixture.items" :key="item.variant" :variant="item.variant">{{
item.copy
}}</Text>
</div>
</template>
ts
import { Component } from "@angular/core";
const textFixture = {
id: "text",
items: [
{ copy: "Apps, APIs and deploys that stay understandable.", variant: "body" },
{ copy: "Secondary supporting copy.", variant: "muted" },
{ copy: "Small print for captions.", variant: "small" },
{ copy: "build · 2026.06.21 · a1b2c3d", variant: "mono" },
],
} satisfies {
id: string;
items: ReadonlyArray<{ copy: string; variant: "body" | "muted" | "small" | "mono" }>;
};
import { GrassrootText } from "@grassroot/ui-angular";
@Component({
selector: "app-text-demo",
standalone: true,
imports: [GrassrootText],
template: `
<div>
@for (item of fixture.items; track item.variant) {
<grassroot-text [variant]="item.variant">{{ item.copy }}</grassroot-text>
}
</div>
`,
})
export class TextDemoComponent {
protected readonly fixture = textFixture;
}
export default TextDemoComponent;
ts
<script lang="ts">
const textFixture = {
id: "text",
items: [
{ copy: "Apps, APIs and deploys that stay understandable.", variant: "body" },
{ copy: "Secondary supporting copy.", variant: "muted" },
{ copy: "Small print for captions.", variant: "small" },
{ copy: "build · 2026.06.21 · a1b2c3d", variant: "mono" },
],
} satisfies {
id: string;
items: ReadonlyArray<{ copy: string; variant: "body" | "muted" | "small" | "mono" }>;
};
import { Text } from "@grassroot/ui-svelte";
</script>
<div>
{#each textFixture.items as item (item.variant)}
<Text variant={item.variant}>{item.copy}</Text>
{/each}
</div>
ts
/** @jsxImportSource solid-js */
import { Text } from "@grassroot/ui-solid";
const textFixture = {
id: "text",
items: [
{ copy: "Apps, APIs and deploys that stay understandable.", variant: "body" },
{ copy: "Secondary supporting copy.", variant: "muted" },
{ copy: "Small print for captions.", variant: "small" },
{ copy: "build · 2026.06.21 · a1b2c3d", variant: "mono" },
],
} satisfies {
id: string;
items: ReadonlyArray<{ copy: string; variant: "body" | "muted" | "small" | "mono" }>;
};
export default function TextDemo() {
return (
<div>
{textFixture.items.map((item) => (
<Text variant={item.variant}>{item.copy}</Text>
))}
</div>
);
}

Installation

API Reference

Import

import { Text } from "@grassroot/ui-react";

Props

Prop
Type
Default
Requirement
Description
variant
"muted" | "body" | "small" | "mono" | undefined
"body"
optional
as
React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined
"p"
optional
Override the rendered element.
Prop
variant
Type
"muted" | "body" | "small" | "mono" | undefined
Default
"body"
Requirement
optional
Description
Prop
as
Type
React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined
Default
"p"
Requirement
optional
Description
Override the rendered element.

Native attributes

Standard DOM and ARIA attributes not listed above spread onto the root element.

Import

import { Text } from "@grassroot/ui-vue";

Props

Prop
Type
Default
Requirement
variant
"body" | "muted" | "small" | "mono" | undefined
"body"
optional
as
string | undefined
"p"
optional
Prop
variant
Type
"body" | "muted" | "small" | "mono" | undefined
Default
"body"
Requirement
optional
Prop
as
Type
string | undefined
Default
"p"
Requirement
optional

Content regions

  • default

Import

import { Component } from "@angular/core";
import { GrassrootText } from "@grassroot/ui-angular";

Props

Prop
Type
Default
Requirement
variant
TextVariant
"body"
optional
as
"p" | "span" | "div"
"p"
optional
Prop
variant
Type
TextVariant
Default
"body"
Requirement
optional
Prop
as
Type
"p" | "span" | "div"
Default
"p"
Requirement
optional

Content regions

  • default

Import

import { Text } from "@grassroot/ui-svelte";

Props

Prop
Type
Default
Requirement
variant
TextVariant
"body"
optional
as
string
"p"
optional
Prop
variant
Type
TextVariant
Default
"body"
Requirement
optional
Prop
as
Type
string
Default
"p"
Requirement
optional

Content regions

  • children

Import

import { Text } from "@grassroot/ui-solid";

Props

Prop
Type
Default
Requirement
variant
TextVariant
optional
as
string
optional
Prop
variant
Type
TextVariant
Default
Requirement
optional
Prop
as
Type
string
Default
Requirement
optional

Content regions

  • children

Native attributes

Standard DOM and ARIA attributes not listed above spread onto the root element.