@prismicio/react
Version:
React components and hooks to fetch and present Prismic content
36 lines (35 loc) • 1.13 kB
TypeScript
import { FC } from "react";
import { RichTextField } from "@prismicio/client";
/** Props for `<PrismicText>`. */
export type PrismicTextProps = {
/** The Prismic Rich Text field to render. */
field: RichTextField | null | undefined;
/**
* The string rendered when the field is empty. If a fallback is not given,
* `null` will be rendered.
*/
fallback?: string;
/** The separator used between blocks. Defaults to `\n`. */
separator?: string;
};
/**
* React component that renders content from a Prismic Rich Text field as plain
* text.
*
* @remarks
* This component returns a React fragment with no wrapping element around the
* content. If you need a wrapper, add a component around `<PrismicText>`.
*
* @example Rendering a Rich Text field as plain text.
*
* ```jsx
* <PrismicText field={document.data.content} />;
* ```
*
* @param props - Props for the component.
*
* @returns The Rich Text field's content as plain text.
*
* @see Learn about Rich Text fields {@link https://io/docs/core-concepts/rich-text-title}
*/
export declare const PrismicText: FC<PrismicTextProps>;