CopilotMarkdown

Render Markdown text with React Native styling tuned for chat. Renders streaming content as it arrives.

Overview

CopilotMarkdown renders a Markdown string with sensible React Native styling, built on react-native-streamdown. It renders incomplete (streaming) Markdown incrementally as content arrives, which makes it ideal for assistant messages. Requires the react-native-streamdown peer dependency. AssistantMessage renders its content with this component.

Import

import { CopilotMarkdown, defaultMarkdownStyles } from "@copilotkit/react-native/components";

Props

Prop

Type

defaultMarkdownStyles

The default style map. The component merges style over these defaults one element at a time. To change one property of an element, spread the default for that element:

import { CopilotMarkdown, defaultMarkdownStyles } from "@copilotkit/react-native/components";

const styles = {
  h1: { ...defaultMarkdownStyles.h1, fontSize: 28, fontWeight: "800" },
};

<CopilotMarkdown content={"# Hello\nThis is **bold**."} style={styles} />;

Usage

import { CopilotMarkdown } from "@copilotkit/react-native/components";

<CopilotMarkdown content="**Hello** from CopilotKit!" />;

How is this guide?