\n\n \n ```\n\n \n \n ```svelte fileName=\"ProductCopy.svelte\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n \n\n {#if $content}\n

{$content.description}

\n {/if}\n ```\n\n
\n \n ```tsx fileName=\"ProductCopy.tsx\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n import { useIntlayer } from \"preact-intlayer\";\n\n export const ProductCopy = ({\n productId,\n userId,\n }: {\n productId: string;\n userId: string;\n }) => {\n const content = useIntlayer(\"product-copy\", { id: productId, userId });\n // TypeScript enforces that both `id` and `userId` are provided.\n\n if (!content) return null;\n\n return

{content.description}

;\n };\n ```\n\n
\n \n ```tsx fileName=\"ProductCopy.tsx\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n import { useIntlayer } from \"solid-intlayer\";\n\n export const ProductCopy = (props: {\n productId: string;\n userId: string;\n }) => {\n const content = useIntlayer(\"product-copy\", { id: props.productId, userId: props.userId });\n // TypeScript enforces that both `id` and `userId` are provided.\n\n return (\n <>\n {content() &&

{content().description}

}\n \n );\n };\n ```\n\n
\n \n ```typescript fileName=\"product-copy.component.ts\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n import { Component, Input, OnInit } from \"@angular/core\";\n import { useIntlayer } from \"angular-intlayer\";\n\n @Component({\n selector: \"app-product-copy\",\n template: `\n @if (content()) {\n

{{ content().description }}

\n }\n `,\n })\n export class ProductCopyComponent implements OnInit {\n @Input() productId!: string;\n @Input() userId!: string;\n\n content: any;\n\n ngOnInit() {\n this.content = useIntlayer(\"product-copy\", { id: this.productId, userId: this.userId });\n }\n }\n ```\n\n
\n \n ```javascript fileName=\"product-copy.js\"\n import { useIntlayer } from \"vanilla-intlayer\";\n\n const content = useIntlayer(\"product-copy\", {\n id: \"prod_abcd\",\n userId: \"user_123\"\n });\n\n if (content) {\n document.body.innerHTML = `

${content.description}

`;\n }\n ```\n\n
\n\n\n### With explicit locale\n\n```tsx\nconst content = useIntlayer(\"product-copy\", {\n id: \"prod_abc\",\n userId: \"user_123\",\n locale: \"fr\",\n});\n```\n\n### Missing meta field — compile-time error\n\n```ts\n// Type error: `userId` is missing\nconst content = useIntlayer(\"product-copy\", { id: \"prod_abc\" });\n```\n\n## Loading mode\n\nDynamic records are typically loaded lazily. Set `importMode` on the dictionary to control this:\n\n```ts contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\nconst dictionary = {\n key: \"product-copy\",\n importMode: \"fetch\", // or \"dynamic\"\n meta: { id: \"prod_abc\", userId: \"user_123\" },\n content: { … },\n} satisfies Dictionary;\n\nexport default dictionary;\n```\n\nSee [bundle optimization](/doc/concept/bundle-optimization) for details on `static`, `dynamic`, and `fetch` modes.\n\n## Typical use-cases\n\n- Per-product marketing copy managed in a CMS\n- User-specific or account-specific content\n- Any content keyed by an opaque runtime ID\n","description":"Use the meta field in Intlayer content files to declare CMS-managed records fetched at runtime by an opaque ID, enabling strongly-typed dynamic content without build-time enumeration.","url":"https://intlayer.org/doc/concept/dynamic-records","datePublished":"2026-06-12","dateModified":"2026-06-12","version":"9.0.0","keywords":"Dynamic Records, Dynamic Content, CMS, Runtime Content, Intlayer, Internationalization","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"Developers, Content Managers"}}
    Author:
    Creation:2026-06-12Last update:2026-06-12

    Dynamic Records

    A dynamic record is a content file whose identity is not a sequential index or a named variant, but an arbitrary set of key-value pairs declared in a meta field. Intlayer uses those fields as the selector at runtime, making it possible to address CMS records, user-specific copy, or any content whose keys are not known at build time.

    Declaring dynamic records

    product-copy.abc.content.ts
    import { t, type Dictionary } from "intlayer";
    
    const dictionary = {
      key: "product-copy",
      meta: {
        id: "prod_abc",
        userId: "user_123",
      },
      content: {
        name: t({ en: "Widget Pro", fr: "Widget Pro" }),
        description: t({ en: "The best widget.", fr: "Le meilleur widget." }),
      },
    } satisfies Dictionary;
    
    export default dictionary;
    product-copy.abcd.content.ts
    import { t, type Dictionary } from "intlayer";
    
    const dictionary = {
      key: "product-copy",
      meta: {
        id: "prod_abcd",
        userId: "user_123",
      },
      content: {
        name: t({ en: "Widget Lite", fr: "Widget Lite" }),
        description: t({ en: "A lighter option.", fr: "Une option plus légère." }),
      },
    } satisfies Dictionary;
    
    export default dictionary;

    Consuming dynamic records

    All meta fields are required in the selector. Omitting any field returns null and is a TypeScript error.

    ProductCopy.tsx
    import { useIntlayer } from "react-intlayer";
    
    export const ProductCopy = ({
      productId,
      userId,
    }: {
      productId: string;
      userId: string;
    }) => {
      const content = useIntlayer("product-copy", { id: productId, userId });
      // TypeScript enforces that both `id` and `userId` are provided.
    
      if (!content) return null;
    
      return <p>{content.description}</p>;
    };

    With explicit locale

    tsx
    const content = useIntlayer("product-copy", {  id: "prod_abc",  userId: "user_123",  locale: "fr",});

    Missing meta field — compile-time error

    ts
    // Type error: `userId` is missingconst content = useIntlayer("product-copy", { id: "prod_abc" });

    Loading mode

    Dynamic records are typically loaded lazily. Set importMode on the dictionary to control this:

    ts
    const dictionary = {
      key: "product-copy",
      importMode: "fetch", // or "dynamic"
      meta: { id: "prod_abc", userId: "user_123" },
      content: { … },
    } satisfies Dictionary;
    
    export default dictionary;

    See bundle optimization for details on static, dynamic, and fetch modes.

    Typical use-cases

    • Per-product marketing copy managed in a CMS
    • User-specific or account-specific content
    • Any content keyed by an opaque runtime ID