structured-render - v2.17.1
    Preparing search index...

    Function createStructuredRender

    • Binds Structured Render to the given icons object (the same object you would pass to the icons render option). Returns:

      • Shapes for every data type that can contain an icon. Unlike the standalone shapes (like structuredRenderDataShape), these reject unknown icon keys at runtime and type iconKey as the icons object's keys.
      • VirStructuredRender: VirStructuredRender with icons already set. Its assign omits the icons option and requires data to only use the icons object's keys. It can't be constructed with new.

      Type Parameters

      • const IconKey extends string

      Parameters

      • icons: Readonly<Record<IconKey, ViraIconSvg>>

      Returns {
          card: UnsafeShape<StructuredRenderCard<IconKey>>;
          collapsible: UnsafeShape<
              SharedSectionTypes<"collapsible"> & {
                  content: (
                      | StructuredRenderIcon<IconKey>
                      | RenderDataMarkdown
                      | StructuredRenderCodeBlock
                      | StructuredRenderEmpty
                      | StructuredRenderInlineCode
                      | StructuredRenderTag
                      | StructuredRenderProcessing
                      | StructuredRenderList<IconKey>
                      | StructuredRenderTable<IconKey>
                      | StructuredRenderText<IconKey>
                  )[];
                  header: Primitive;
              },
          >;
          data: UnsafeShape<StructuredRenderData<IconKey>>;
          icon: UnsafeShape<StructuredRenderIcon<IconKey>>;
          list: UnsafeShape<
              SharedSectionTypes<"list"> & {
                  items: StructuredRenderListItem<IconKey>[];
              },
          >;
          listItem: UnsafeShape<StructuredRenderListItem<IconKey>>;
          section: Shape<
              TUnion<
                  (
                      | TUnsafe<StructuredRenderIcon<IconKey>>
                      | TUnsafe<SharedSectionTypes<"markdown"> & { markdown: string }>
                      | TUnsafe<
                          SharedSectionTypes<"codeBlock"> & {
                              code: string;
                              syntax?: string | null;
                          },
                      >
                      | TUnsafe<StructuredRenderEmpty>
                      | TUnsafe<SharedSectionTypes<"inlineCode"> & { code: string }>
                      | TUnsafe<
                          SharedSectionTypes<"tag"> & {
                              color?:
                                  | { custom: { backgroundColor?: ...; foregroundColor?: ... } }
                                  | { variant: ViraColorVariant }
                                  | null;
                              text: Primitive;
                              useBigTag?: boolean | null;
                          },
                      >
                      | TUnsafe<StructuredRenderSource>
                      | TUnsafe<StructuredRenderProcessing>
                      | TUnsafe<
                          SharedSectionTypes<"copyCard"> & {
                              disableCopy?: boolean | null;
                              header?: Primitive;
                              text: Primitive;
                          },
                      >
                      | TUnsafe<
                          SharedSectionTypes<"collapsible"> & {
                              content: (
                                  | StructuredRenderIcon<(...)>
                                  | RenderDataMarkdown
                                  | StructuredRenderCodeBlock
                                  | StructuredRenderEmpty
                                  | StructuredRenderInlineCode
                                  | StructuredRenderTag
                                  | StructuredRenderProcessing
                                  | StructuredRenderList<(...)>
                                  | StructuredRenderTable<(...)>
                                  | StructuredRenderText<(...)>
                              )[];
                              header: Primitive;
                          },
                      >
                      | TUnsafe<
                          SharedSectionTypes<"title"> & {
                              icon?: StructuredRenderIcon<IconKey> | null;
                              text?: Primitive;
                          },
                      >
                      | TUnsafe<
                          SharedSectionTypes<"list"> & {
                              items: StructuredRenderListItem<IconKey>[];
                          },
                      >
                      | TUnsafe<
                          SharedSectionTypes<"table"> & {
                              direction: StructuredRenderCellDirection;
                              entries: {
                                  data: Record<(...), (...)>;
                                  sources?: (...) | (...) | (...);
                              }[];
                              footerRows?: { alignment?: ...; cells: ... }[]
                              | null;
                              headers: {
                                  disableSort?: (...) | (...) | (...) | (...);
                                  hidden?: (...) | (...) | (...) | (...);
                                  key: string;
                                  sortKey?: (...) | (...) | (...);
                                  text?: (...) | (...) | (...);
                              }[];
                              style?: StructuredRenderTextStyle
                              | null;
                          },
                      >
                      | TUnsafe<
                          SharedSectionTypes<"text"> & {
                              icon?: StructuredRenderIcon<IconKey> | null;
                              style?: StructuredRenderTextStyle | null;
                              text?: Primitive;
                          },
                      >
                  )[],
              >,
          >;
          table: UnsafeShape<
              SharedSectionTypes<"table"> & {
                  direction: StructuredRenderCellDirection;
                  entries: {
                      data: Record<
                          string,
                          | StructuredRenderShapesAllowedInTable<(...)>
                          | null
                          | undefined
                          | ((...) | (...) | (...))[],
                      >;
                      sources?: (StructuredRenderSource | null | undefined)[] | null;
                  }[];
                  footerRows?: | {
                      alignment?: StructuredRenderTableFooterAlignment
                      | null;
                      cells:
                          | StructuredRenderShapesAllowedInTable<IconKey>
                          | (StructuredRenderShapesAllowedInTable<IconKey> | null | undefined)[]
                          | null
                          | undefined;
                  }[]
                  | null;
                  headers: {
                      disableSort?: boolean
                      | null;
                      hidden?: boolean | null;
                      key: string;
                      sortKey?: string | null;
                      text?: StructuredRenderText<IconKey> | null;
                  }[];
                  style?: StructuredRenderTextStyle
                  | null;
              },
          >;
          text: UnsafeShape<
              SharedSectionTypes<"text"> & {
                  icon?: StructuredRenderIcon<IconKey> | null;
                  style?: StructuredRenderTextStyle | null;
                  text?: Primitive;
              },
          >;
          title: UnsafeShape<
              SharedSectionTypes<"title"> & {
                  icon?: StructuredRenderIcon<IconKey> | null;
                  text?: Primitive;
              },
          >;
          VirStructuredRender: Omit<
              DeclarativeElementDefinition<
                  "vir-structured-render",
                  { data: Readonly<RenderInput>; options: VirStructuredRenderOptions },
                  {
                      currentlyExpanded: Record<string, boolean>;
                      lastStyleString: string;
                      tableSortStates: Record<
                          string,
                          | Readonly<{ columnKey: string; direction: TableSortDirection }>
                          | undefined,
                      >;
                  },
                  {},
                  "vir-structured-render-phone-size"
                  | "vir-structured-render-tablet-size",

                      | "vir-structured-render-h1-font-size"
                      | "vir-structured-render-h2-font-size"
                      | "vir-structured-render-h3-font-size"
                      | "vir-structured-render-small-font-size",
                  readonly [],
                  readonly [],
              >,
              "assign",
          > & {
              assign(
                  inputs: BoundVirStructuredRenderInputs<IconKey>,
              ): MinimalDefinitionWithInputs<"vir-structured-render">;
          };
      }