HomeSandboxShowcaseAppDocBlog
    • EnglishEnglish
      EN
    • русскийRussian
      RU
    • 日本語Japanese
      JA
    • françaisFrench
      FR
    • 한국어Korean
      KO
    • 中文Chinese
      ZH
    • españolSpanish
      ES
    • DeutschGerman
      DE
    • العربيةArabic
      AR
    • italianoItalian
      IT
    • British EnglishBritish English
      EN-GB
    • portuguêsPortuguese
      PT
    • हिन्दीHindi
      HI
    • TürkçeTurkish
      TR
    • polskiPolish
      PL
    • IndonesiaIndonesian
      ID
    • Tiếng ViệtVietnamese
      VI
    • українськаUkrainian
      UK
    /
    Filter docs by framework
    Alt+←
    Why Intlayer ?
    Get Started
    Concept
    • How Intlayer Works
    • Configuration
    • TestFillBuildWatchExtractLoginPushPullConfigurationListVersionEditorLiveDebugDoc ReviewDoc TranslateSDK
    • Visual Editor
    • CMS
    • CI/CD Integration
    • TranslationPluralEnumerationConditionGenderInsertionFileNestingMarkdownHTMLFunction Fetching
    • Per Locale File
    • Compiler
    • Auto Fill
    • Testing
    • Bundle Optimization
    Environment
    • Next.js 14 and App Router
      Next.js 15
      Next.js no locale path
      Next.js and Page Router
      Compiler
    • Tanstack Start Solid
    • Astro and React
      Astro and Svelte
      Astro and Vue
      Astro and Solid
      Astro and Preact
      Astro and Lit
      Astro and Vanilla JS
    • React Router v7
      React Router v7 (fs-routes)
      Compiler
    • Nuxt and Vue
    • Vite and Solid
    • SvelteKit
    • Vite and Preact
    • Vite and Vanilla JS
    • Vite and Lit
    • Angular 19 (Webpack)
      Analog
    • React CRA
    • React Native and Expo
    • Express.js
      NestJS
      Fastify
      Hono
      Adonis
    • Lynx and React
    Plugins
    • JSON
    • gettext (.po)
    VS Code Extension
    Agent
    • MCP Server
    • Agent skills
    Releases
    • v8
    • v7
    • v6
    Benchmark
    • Next.js
    • TanStack
    • Vue
    • Solid
    • Svelte
    Blog
    Ask a question
    1. Documentation
    2. Concept
    3. Content Declaration
    4. HTML
    \n\n \n ```\n\n Use `.use()` for overrides:\n ```vue\n \n ```\n\n \n \n Svelte renders HTML nodes as strings. Use `{@html}` to render it.\n\n ```svelte\n \n\n {@html $content.myHtmlContent}\n ```\n\n \n \n Preact supports HTML nodes directly in the JSX.\n\n ```tsx fileName=\"App.tsx\"\n import { useIntlayer } from \"preact-intlayer\";\n\n const AppContent = () => {\n const { myHtmlContent } = useIntlayer(\"app\");\n return
    {myHtmlContent}
    ;\n };\n ```\n\n
    \n \n Solid supports HTML nodes directly in the JSX.\n\n ```tsx fileName=\"App.tsx\"\n import { useIntlayer } from \"solid-intlayer\";\n\n const AppContent = () => {\n const { myHtmlContent } = useIntlayer(\"app\");\n return
    {myHtmlContent}
    ;\n };\n ```\n\n
    \n \n Angular uses the `[innerHTML]` directive to render HTML content.\n\n ```typescript fileName=\"app.component.ts\"\n import { Component } from \"@angular/core\";\n import { useIntlayer } from \"angular-intlayer\";\n\n @Component({\n selector: \"app-root\",\n template: `
    `,\n })\n export class AppComponent {\n content = useIntlayer(\"app\");\n }\n ```\n\n Use the `.use()` method to provide custom components or override tags:\n\n ```typescript\n content().myHtmlContent.use({\n p: { class: \"prose\" },\n CustomLink: { href: \"/details\" },\n })\n ```\n\n
    \n\n\n## Global Configuration with `HTMLProvider`\n\nYou can configure HTML rendering globally for your entire application. This is ideal for defining custom components that should be available in all HTML content.\n\n\n \n \n ```tsx fileName=\"AppProvider.tsx\"\n import { HTMLProvider } from \"react-intlayer/html\";\n\n export const AppProvider = ({ children }) => (\n

    ,\n CustomLink: ({ children }) => {children},\n }}\n >\n {children}\n \n );\n ```\n\n You can also use your own HTML renderer:\n\n ```tsx fileName=\"AppProvider.tsx\"\n import { HTMLProvider } from \"react-intlayer/html\";\n\n export const AppProvider = ({ children }) => (\n {\n const { renderHTML } = await import('react-intlayer/html');\n return renderHTML(html);\n }}\n >\n {children}\n \n );\n ```\n\n > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.\n\n \n \n\n ```typescript fileName=\"main.ts\"\n import { createApp, h } from \"vue\";\n import { intlayer } from \"vue-intlayer\";\n import { intlayerHTML } from \"vue-intlayer/html\";\n import App from \"./App.vue\";\n\n const app = createApp(App);\n\n app.use(intlayer);\n app.use(intlayerHTML, {\n components: {\n p: (props, { slots }) => h(\"p\", { class: \"prose\", ...props }, slots.default?.()),\n CustomLink: (props, { slots }) => h(\"a\", { href: \"/details\", ...props }, slots.default?.()),\n },\n });\n\n app.mount(\"#app\");\n ```\n\n You can also use your own HTML renderer:\n\n ```typescript fileName=\"main.ts\"\n import { createApp, h } from \"vue\";\n import { intlayer } from \"vue-intlayer\";\n import { intlayerHTML } from \"vue-intlayer/html\";\n import App from \"./App.vue\";\n\n const app = createApp(App);\n\n app.use(intlayer);\n app.use(intlayerHTML, {\n renderHTML: async (html) => {\n const { renderHTML } = await import('vue-intlayer/html');\n return renderHTML(html);\n },\n });\n\n app.mount(\"#app\");\n ```\n\n > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.\n\n \n \n \n ```svelte fileName=\"App.svelte\"\n \n\n \n \n \n ```\n\n You can also use your own HTML renderer:\n\n ```svelte fileName=\"App.svelte\"\n \n\n {\n const { renderHTML } = await import('svelte-intlayer/html');\n return renderHTML(html);\n }}\n >\n \n \n ```\n\n > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.\n\n \n \n \n ```tsx fileName=\"AppProvider.tsx\"\n import { HTMLProvider } from \"preact-intlayer/html\";\n\n export const AppProvider = ({ children }) => (\n

    ,\n }}\n >\n {children}\n \n );\n ```\n\n You can also use your own HTML renderer:\n\n ```tsx fileName=\"AppProvider.tsx\"\n import { HTMLProvider } from \"preact-intlayer/html\";\n\n export const AppProvider = ({ children }) => (\n {\n const { renderHTML } = await import('preact-intlayer/html');\n return renderHTML(html);\n }}\n >\n {children}\n \n );\n ```\n\n > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.\n\n \n \n \n ```tsx fileName=\"AppProvider.tsx\"\n import { HTMLProvider } from \"solid-intlayer/html\";\n\n export const AppProvider = (props) => (\n

    ,\n }}\n >\n {props.children}\n \n );\n ```\n\n You can also use your own HTML renderer:\n\n ```tsx fileName=\"AppProvider.tsx\"\n import { HTMLProvider } from \"solid-intlayer/html\";\n\n export const AppProvider = (props) => (\n {\n const { renderHTML } = await import('solid-intlayer/html');\n return renderHTML(html);\n }}\n >\n {props.children}\n \n );\n ```\n\n > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.\n\n \n \n\n ```typescript fileName=\"app.config.ts\"\n import { createIntlayerHTMLProvider } from \"angular-intlayer/html\";\n\n export const appConfig: ApplicationConfig = {\n providers: [\n createIntlayerHTMLProvider({\n components: {\n p: { class: \"prose\" },\n CustomLink: { href: \"/details\" },\n },\n }),\n ],\n };\n ```\n\n You can also use your own HTML renderer:\n\n ```typescript fileName=\"app.config.ts\"\n import { createIntlayerHTMLProvider } from \"angular-intlayer/html\";\n\n export const appConfig: ApplicationConfig = {\n providers: [\n createIntlayerHTMLProvider({\n renderMarkdown: async (html) => {\n const { renderMarkdown } = await import('angular-intlayer/html');\n return renderMarkdown(html);\n },\n }),\n ],\n };\n ```\n\n > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.\n\n \n\n\n---\n\n### Manual Rendering & Advanced Tools\n\nIf you need to render raw HTML strings or have more control over the component mapping, use the following tools.\n\n\n \n #### `` Component\n Render an HTML string with specific components.\n\n ```tsx\n import { HTMLRenderer } from \"react-intlayer/html\";\n\n \n {\"

    Hello World

    \"}\n \n ```\n\n #### `useHTMLRenderer()` Hook\n\n Get a pre-configured renderer function.\n\n ```tsx\n import { useHTMLRenderer } from \"react-intlayer/html\";\n\n const renderHTML = useHTMLRenderer({\n components: { strong: (props) => }\n });\n\n return renderHTML(\"

    Hello World

    \");\n ```\n\n #### `renderHTML()` Utility\n\n Standalone utility for rendering outside of components.\n\n ```tsx\n import { renderHTML } from \"react-intlayer/html\";\n\n const jsx = renderHTML(\"

    Hello

    \", { components: { p: 'div' } });\n ```\n\n
    \n \n \n #### `` Component\n \n ```vue\n \n\n \n ```\n\n \n \n \n #### `` Component\n \n ```svelte\n \n\n Hello World

    \" />\n ```\n\n #### `useHTMLRenderer()` Hook\n\n ```svelte\n \n\n {@html render(\"

    Hello World

    \")}\n ```\n\n #### `renderHTML()` Utility\n\n ```svelte\n \n\n {@html renderHTML(\"

    Hello World

    \")}\n ```\n\n
    \n \n \n #### `` Component\n \n ```tsx\n import { HTMLRenderer } from \"preact-intlayer/html\";\n\n \n {\"

    Hello World

    \"}\n
    \n ```\n\n #### `useHTMLRenderer()` Hook\n\n ```tsx\n import { useHTMLRenderer } from \"preact-intlayer/html\";\n\n const render = useHTMLRenderer();\n\n return
    {render(\"

    Hello World

    \")}
    ;\n ```\n\n #### `renderHTML()` Utility\n\n ```tsx\n import { renderHTML } from \"preact-intlayer/html\";\n\n return
    {renderHTML(\"

    Hello World

    \")}
    ;\n ```\n\n
    \n \n \n #### `` Component\n \n ```tsx\n import { HTMLRenderer } from \"solid-intlayer/html\";\n\n \n {\"

    Hello World

    \"}\n
    \n ```\n\n #### `useHTMLRenderer()` Hook\n\n ```tsx\n import { useHTMLRenderer } from \"solid-intlayer/html\";\n\n const render = useHTMLRenderer();\n\n return
    {render(\"

    Hello World

    \")}
    ;\n ```\n\n #### `renderHTML()` Utility\n\n ```tsx\n import { renderHTML } from \"solid-intlayer/html\";\n\n return
    {renderHTML(\"

    Hello World

    \")}
    ;\n ```\n\n
    \n \n #### `IntlayerHTMLService` Service\n Render an HTML string using the service.\n\n ```typescript\n import { IntlayerHTMLService } from \"angular-intlayer/html\";\n\n export class MyComponent {\n constructor(private markdownService: IntlayerHTMLService) {}\n\n renderHTML(html: string) {\n return this.markdownService.renderMarkdown(html);\n }\n }\n ```\n\n \n
    \n\n---\n\n## Options Reference\n\nThese options can be passed to `HTMLProvider`, `HTMLRenderer`, `useHTMLRenderer`, and `renderHTML`.\n\n| Option | Type | Default | Description |\n| :----------- | :-------------------- | :------ | :--------------------------------------------------------------------------------------------------------- |\n| `components` | `Record` | `{}` | A map of HTML tags or custom component names to components. |\n| `renderHTML` | `Function` | `null` | A custom rendering function to completely replace the default HTML parser (Only for Vue/Svelte providers). |\n\n> Note: For React and Preact, standard HTML tags are automatically provided. You only need to pass the `components` prop if you want to override them or add custom components.\n","about":"Learn how to declare and use HTML content with custom components in Intlayer. Follow this documentation to embed rich HTML-like content with dynamic component replacement in your internationalized project.","url":"https://intlayer.org/doc/concept/content/html","datePublished":"20-01-2026","dateModified":"24-03-2026","keywords":"HTML, Custom Components, Rich Content, Intlayer, Next.js, JavaScript, React, Vue, Svelte","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"Developers, Content Managers"}}
    Creation:2026-01-20Last update:2026-03-24
    Reference this doc to your favorite AI assistant
    ChatGPT
    Claude
    DeepSeek
    Google AI mode
    Gemini
    Perplexity
    Mistral
    Grok

    Ask your question and get a summary of the document by referencing this page and the AI provider of your choice

    Version History

    1. "Add `intlayerHTML` plugin object; use `app.use(intlayerHTML)` instead of `app.use(installIntlayerHTML)`"
      v8.5.03/24/2026
    2. "move import from `{{framework}}-intlayer` to `{{framework}}-intlayer/html`"
      v8.5.03/24/2026
    3. "Add HTMLRenderer / useHTMLRenderer / renderHTML utility"
      v8.0.01/22/2026
    4. "Add HTML parsing support"
      v8.0.01/20/2026
    Edit this doc

    If you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.

    GitHub link to the documentation
    Copy

    Copy doc Markdown to clipboard

    HTML Content / HTML in Intlayer

    Intlayer supports HTML content, allowing you to embed rich, structured content within your dictionaries. This content can be rendered with standard HTML tags or replaced with custom components at runtime.

    Declaring HTML Content

    You can declare HTML content using the html function or simply as a string.

    Use the html function to explicitly declare HTML content. This ensures standard tags are mapped correctly even if automatic detection is disabled.

    htmlDictionary.content.ts
    Copy code

    Copy the code to the clipboard

    import { html, type Dictionary } from "intlayer";const htmlDictionary = {  key: "app",  contentAutoTransformation: true, // can be set in config file  content: {    myHtmlContent:  html("<p>Hello <strong>World</strong></p>"),  },} satisfies Dictionary;export default htmlDictionary;

    If the string contains common HTML tags (e.g., <p>, <div>, <strong>, etc.), Intlayer will automatically transform it.

    htmlDictionary.content.ts
    Copy code

    Copy the code to the clipboard

    export default {  key: "app",  contentAutoTransformation: true, // can be set in config file  content: {    myHtmlContent: "<p>Hello <strong>World</strong></p>",  },};

    Import HTML content from files. Note that currently file() function returns a string, which will be auto-detected as HTML if it contains tags.

    htmlDictionary.content.ts
    Copy code

    Copy the code to the clipboard

    import { html, file, t } from "intlayer";export default {  key: "app",  content: {    content: t({      en: html(file("./content.en.html")),      fr: html(file("./content.fr.html")),    }),  },};

    The html() Node

    The html() function is a new feature in Intlayer v8 that allows you to explicitly define HTML content in your dictionaries. While Intlayer can often auto-detect HTML content, using the html() function provides several advantages:

    • Type Safety: The html() function allows you to define the expected props for custom components, providing better autocompletion and type checking in your editor.
    • Explicit Declaration: It ensures that a string is always treated as HTML, even if it doesn't contain standard HTML tags that would trigger auto-detection.
    • Custom Component Definition: You can pass a second argument to html() to define the custom components and their expected prop types.
    typescript
    Copy code

    Copy the code to the clipboard

    import { html } from "intlayer";const myContent = html(  "<MyCustomComponent title='Hello'>World</MyCustomComponent>",  {    MyCustomComponent: {      title: "string",      children: "node",    },  });

    When using the .use() method on an HTML node, the components you provide will be checked against the definition provided in the html() function (if available).


    Rendering HTML

    Rendering can be handled automatically by Intlayer's content system or manually using specialized tools.

    Automatic Rendering (using useIntlayer)

    When you access content via useIntlayer, HTML nodes are already prepared for rendering.

    HTML nodes can be rendered directly as JSX. Standard tags work automatically.

    App.tsx
    Copy code

    Copy the code to the clipboard

    import { useIntlayer } from "react-intlayer";const AppContent = () => {  const { myHtmlContent } = useIntlayer("app");  return <div>{myHtmlContent}</div>;};

    Use the .use() method to provide custom components or override tags:

    tsx
    Copy code

    Copy the code to the clipboard

    {myHtmlContent.use({  p: (props) => <p className="prose" {...props} />,  CustomLink: ({ children }) => <a href="/details">{children}</a>,})}

    In Vue, HTML content can be rendered using the component built-in.

    App.vue
    Copy code

    Copy the code to the clipboard

    <script setup>import { useIntlayer } from "vue-intlayer";const { myHtmlContent } = useIntlayer("app");</script><template>  <component :is="myHtmlContent" /></template>

    Use .use() for overrides:

    vue
    Copy code

    Copy the code to the clipboard

    <component :is="myHtmlContent.use({ h1: 'h2' })" />

    Svelte renders HTML nodes as strings. Use {@html} to render it.

    svelte
    Copy code

    Copy the code to the clipboard

    <script lang="ts">import { useIntlayer } from "svelte-intlayer";const content = useIntlayer("app");</script>{@html $content.myHtmlContent}

    Preact supports HTML nodes directly in the JSX.

    App.tsx
    Copy code

    Copy the code to the clipboard

    import { useIntlayer } from "preact-intlayer";const AppContent = () => {  const { myHtmlContent } = useIntlayer("app");  return <div>{myHtmlContent}</div>;};

    Solid supports HTML nodes directly in the JSX.

    App.tsx
    Copy code

    Copy the code to the clipboard

    import { useIntlayer } from "solid-intlayer";const AppContent = () => {  const { myHtmlContent } = useIntlayer("app");  return <div>{myHtmlContent}</div>;};

    Angular uses the [innerHTML] directive to render HTML content.

    app.component.ts
    Copy code

    Copy the code to the clipboard

    import { Component } from "@angular/core";import { useIntlayer } from "angular-intlayer";@Component({  selector: "app-root",  template: `<div [innerHTML]="content().myHtmlContent"></div>`,})export class AppComponent {  content = useIntlayer("app");}

    Use the .use() method to provide custom components or override tags:

    typescript
    Copy code

    Copy the code to the clipboard

    content().myHtmlContent.use({  p: { class: "prose" },  CustomLink: { href: "/details" },})

    Global Configuration with HTMLProvider

    You can configure HTML rendering globally for your entire application. This is ideal for defining custom components that should be available in all HTML content.

    AppProvider.tsx
    Copy code

    Copy the code to the clipboard

    import { HTMLProvider } from "react-intlayer/html";export const AppProvider = ({ children }) => (  <HTMLProvider    components={{      p: (props) => <p className="prose" {...props} />,      CustomLink: ({ children }) => <a href="/details">{children}</a>,    }}  >    {children}  </HTMLProvider>);

    You can also use your own HTML renderer:

    AppProvider.tsx
    Copy code

    Copy the code to the clipboard

    import { HTMLProvider } from "react-intlayer/html";export const AppProvider = ({ children }) => (  <HTMLProvider    renderHTML={async (html) => {      const { renderHTML } = await import('react-intlayer/html');      return renderHTML(html);    }}  >    {children}  </HTMLProvider>);
    Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.
    main.ts
    Copy code

    Copy the code to the clipboard

    import { createApp, h } from "vue";import { intlayer } from "vue-intlayer";import { intlayerHTML } from "vue-intlayer/html";import App from "./App.vue";const app = createApp(App);app.use(intlayer);app.use(intlayerHTML, {  components: {    p: (props, { slots }) => h("p", { class: "prose", ...props }, slots.default?.()),    CustomLink: (props, { slots }) => h("a", { href: "/details", ...props }, slots.default?.()),  },});app.mount("#app");

    You can also use your own HTML renderer:

    main.ts
    Copy code

    Copy the code to the clipboard

    import { createApp, h } from "vue";import { intlayer } from "vue-intlayer";import { intlayerHTML } from "vue-intlayer/html";import App from "./App.vue";const app = createApp(App);app.use(intlayer);app.use(intlayerHTML, {  renderHTML: async (html) => {    const { renderHTML } = await import('vue-intlayer/html');    return renderHTML(html);  },});app.mount("#app");
    Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.
    App.svelte
    Copy code

    Copy the code to the clipboard

     <script lang="ts">   import { HTMLProvider } from "svelte-intlayer/html";   import MyCustomP from "./MyCustomP.svelte"; </script> <HTMLProvider   components={{     p: MyCustomP,   }} >   <slot /> </HTMLProvider> 

    You can also use your own HTML renderer:

    App.svelte
    Copy code

    Copy the code to the clipboard

     <script lang="ts">   import { HTMLProvider } from "svelte-intlayer/html"; </script> <HTMLProvider   renderHTML={async (html) => {     const { renderHTML } = await import('svelte-intlayer/html');     return renderHTML(html);   }} >   <slot /> </HTMLProvider> 
    > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.
    AppProvider.tsx
    Copy code

    Copy the code to the clipboard

     import { HTMLProvider } from "preact-intlayer/html"; export const AppProvider = ({ children }) => (   <HTMLProvider     components={{       p: (props) => <p className="prose" {...props} />,     }}   >     {children}   </HTMLProvider> ); 

    You can also use your own HTML renderer:

    AppProvider.tsx
    Copy code

    Copy the code to the clipboard

     import { HTMLProvider } from "preact-intlayer/html"; export const AppProvider = ({ children }) => (   <HTMLProvider     renderHTML={async (html) => {       const { renderHTML } = await import('preact-intlayer/html');       return renderHTML(html);     }}   >     {children}   </HTMLProvider> ); 
    > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.
    AppProvider.tsx
    Copy code

    Copy the code to the clipboard

     import { HTMLProvider } from "solid-intlayer/html"; export const AppProvider = (props) => (   <HTMLProvider     components={{       p: (props) => <p className="prose" {...props} />,     }}   >     {props.children}   </HTMLProvider> ); 

    You can also use your own HTML renderer:

    AppProvider.tsx
    Copy code

    Copy the code to the clipboard

     import { HTMLProvider } from "solid-intlayer/html"; export const AppProvider = (props) => (   <HTMLProvider     renderHTML={async (html) => {       const { renderHTML } = await import('solid-intlayer/html');       return renderHTML(html);     }}   >     {props.children}   </HTMLProvider> ); 
    > Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.
    app.config.ts
    Copy code

    Copy the code to the clipboard

    import { createIntlayerHTMLProvider } from "angular-intlayer/html";export const appConfig: ApplicationConfig = {  providers: [    createIntlayerHTMLProvider({      components: {        p: { class: "prose" },        CustomLink: { href: "/details" },      },    }),  ],};

    You can also use your own HTML renderer:

    app.config.ts
    Copy code

    Copy the code to the clipboard

    import { createIntlayerHTMLProvider } from "angular-intlayer/html";export const appConfig: ApplicationConfig = {  providers: [    createIntlayerHTMLProvider({      renderMarkdown: async (html) => {        const { renderMarkdown } = await import('angular-intlayer/html');        return renderMarkdown(html);      },    }),  ],};
    Importing your HTML renderer dynamically is a good way to reduce the bundle size of your application.

    Manual Rendering & Advanced Tools

    If you need to render raw HTML strings or have more control over the component mapping, use the following tools.

    <HTMLRenderer /> Component

    Render an HTML string with specific components.

    tsx
    Copy code

    Copy the code to the clipboard

    import { HTMLRenderer } from "react-intlayer/html";<HTMLRenderer components={{ p: MyCustomP }}>  {"<p>Hello World</p>"}</HTMLRenderer>

    useHTMLRenderer() Hook

    Get a pre-configured renderer function.

    tsx
    Copy code

    Copy the code to the clipboard

    import { useHTMLRenderer } from "react-intlayer/html";const renderHTML = useHTMLRenderer({  components: { strong: (props) => <strong {...props} className="text-red-500" /> }});return renderHTML("<p>Hello <strong>World</strong></p>");

    renderHTML() Utility

    Standalone utility for rendering outside of components.

    tsx
    Copy code

    Copy the code to the clipboard

    import { renderHTML } from "react-intlayer/html";const jsx = renderHTML("<p>Hello</p>", { components: { p: 'div' } });
    ####

    <HTMLRenderer /> Component

    vue
    Copy code

    Copy the code to the clipboard

     <script setup> import { HTMLRenderer } from "vue-intlayer/html"; </script> <template>   <HTMLRenderer content="<p>Hello World</p>" /> </template> 

    <HTMLRenderer /> Component

    svelte
    Copy code

    Copy the code to the clipboard

    <script lang="ts">import { HTMLRenderer } from "svelte-intlayer/html";</script><HTMLRenderer value="<p>Hello World</p>" />

    useHTMLRenderer() Hook

    svelte
    Copy code

    Copy the code to the clipboard

    <script lang="ts">import { useHTMLRenderer } from "svelte-intlayer/html";const render = useHTMLRenderer();</script>{@html render("<p>Hello World</p>")}

    renderHTML() Utility

    svelte
    Copy code

    Copy the code to the clipboard

    <script lang="ts">import { renderHTML } from "svelte-intlayer/html";</script>{@html renderHTML("<p>Hello World</p>")}
    ####

    <HTMLRenderer /> Component

    tsx
    Copy code

    Copy the code to the clipboard

     import { HTMLRenderer } from "preact-intlayer/html"; <HTMLRenderer>   {"<p>Hello World</p>"} </HTMLRenderer> 
    ####

    useHTMLRenderer() Hook

    tsx
    Copy code

    Copy the code to the clipboard

     import { useHTMLRenderer } from "preact-intlayer/html"; const render = useHTMLRenderer(); return <div>{render("<p>Hello World</p>")}</div>; 
    ####

    renderHTML() Utility

    tsx
    Copy code

    Copy the code to the clipboard

     import { renderHTML } from "preact-intlayer/html"; return <div>{renderHTML("<p>Hello World</p>")}</div>; 
    ####

    <HTMLRenderer /> Component

    tsx
    Copy code

    Copy the code to the clipboard

     import { HTMLRenderer } from "solid-intlayer/html"; <HTMLRenderer>   {"<p>Hello World</p>"} </HTMLRenderer> 
    ####

    useHTMLRenderer() Hook

    tsx
    Copy code

    Copy the code to the clipboard

     import { useHTMLRenderer } from "solid-intlayer/html"; const render = useHTMLRenderer(); return <div>{render("<p>Hello World</p>")}</div>; 
    ####

    renderHTML() Utility

    tsx
    Copy code

    Copy the code to the clipboard

     import { renderHTML } from "solid-intlayer/html"; return <div>{renderHTML("<p>Hello World</p>")}</div>; 

    IntlayerHTMLService Service

    Render an HTML string using the service.

    typescript
    Copy code

    Copy the code to the clipboard

    import { IntlayerHTMLService } from "angular-intlayer/html";export class MyComponent {  constructor(private markdownService: IntlayerHTMLService) {}  renderHTML(html: string) {    return this.markdownService.renderMarkdown(html);  }}

    Options Reference

    These options can be passed to HTMLProvider, HTMLRenderer, useHTMLRenderer, and renderHTML.

    Show all table content

    Open the table in a modal to view all data content clearly

    Option Type Default Description
    components Record<string, any> {} A map of HTML tags or custom component names to components.
    renderHTML Function null A custom rendering function to completely replace the default HTML parser (Only for Vue/Svelte providers).
    Note: For React and Preact, standard HTML tags are automatically provided. You only need to pass the components prop if you want to override them or add custom components.
    Markdown
    Function Fetching
    Alt+→

    In this page

      Discussions are anonymous and regularly reviewed to address common issues. Feel free to share feature ideas, feedback on the documentation, or anything related to Intlayer, we use this input to shape our roadmap and improve the product.

      import { html, type Dictionary } from "intlayer";const htmlDictionary = {  key: "app",  contentAutoTransformation: true, // can be set in config file  content: {    myHtmlContent:  html("<p>Hello <strong>World</strong></p>"),  },} satisfies Dictionary;export default htmlDictionary;
      export default {  key: "app",  contentAutoTransformation: true, // can be set in config file  content: {    myHtmlContent: "<p>Hello <strong>World</strong></p>",  },};
      import { html, file, t } from "intlayer";export default {  key: "app",  content: {    content: t({      en: html(file("./content.en.html")),      fr: html(file("./content.fr.html")),    }),  },};
      import { html } from "intlayer";const myContent = html(  "<MyCustomComponent title='Hello'>World</MyCustomComponent>",  {    MyCustomComponent: {      title: "string",      children: "node",    },  });
      import { useIntlayer } from "react-intlayer";const AppContent = () => {  const { myHtmlContent } = useIntlayer("app");  return <div>{myHtmlContent}</div>;};
      {myHtmlContent.use({  p: (props) => <p className="prose" {...props} />,  CustomLink: ({ children }) => <a href="/details">{children}</a>,})}
      <script setup>import { useIntlayer } from "vue-intlayer";const { myHtmlContent } = useIntlayer("app");</script><template>  <component :is="myHtmlContent" /></template>
      <component :is="myHtmlContent.use({ h1: 'h2' })" />
      <script lang="ts">import { useIntlayer } from "svelte-intlayer";const content = useIntlayer("app");</script>{@html $content.myHtmlContent}
      import { useIntlayer } from "preact-intlayer";const AppContent = () => {  const { myHtmlContent } = useIntlayer("app");  return <div>{myHtmlContent}</div>;};
      import { useIntlayer } from "solid-intlayer";const AppContent = () => {  const { myHtmlContent } = useIntlayer("app");  return <div>{myHtmlContent}</div>;};
      import { Component } from "@angular/core";import { useIntlayer } from "angular-intlayer";@Component({  selector: "app-root",  template: `<div [innerHTML]="content().myHtmlContent"></div>`,})export class AppComponent {  content = useIntlayer("app");}
      content().myHtmlContent.use({  p: { class: "prose" },  CustomLink: { href: "/details" },})
      import { HTMLProvider } from "react-intlayer/html";export const AppProvider = ({ children }) => (  <HTMLProvider    components={{      p: (props) => <p className="prose" {...props} />,      CustomLink: ({ children }) => <a href="/details">{children}</a>,    }}  >    {children}  </HTMLProvider>);
      import { HTMLProvider } from "react-intlayer/html";export const AppProvider = ({ children }) => (  <HTMLProvider    renderHTML={async (html) => {      const { renderHTML } = await import('react-intlayer/html');      return renderHTML(html);    }}  >    {children}  </HTMLProvider>);
      import { createApp, h } from "vue";import { intlayer } from "vue-intlayer";import { intlayerHTML } from "vue-intlayer/html";import App from "./App.vue";const app = createApp(App);app.use(intlayer);app.use(intlayerHTML, {  components: {    p: (props, { slots }) => h("p", { class: "prose", ...props }, slots.default?.()),    CustomLink: (props, { slots }) => h("a", { href: "/details", ...props }, slots.default?.()),  },});app.mount("#app");
      import { createApp, h } from "vue";import { intlayer } from "vue-intlayer";import { intlayerHTML } from "vue-intlayer/html";import App from "./App.vue";const app = createApp(App);app.use(intlayer);app.use(intlayerHTML, {  renderHTML: async (html) => {    const { renderHTML } = await import('vue-intlayer/html');    return renderHTML(html);  },});app.mount("#app");
       <script lang="ts">   import { HTMLProvider } from "svelte-intlayer/html";   import MyCustomP from "./MyCustomP.svelte"; </script> <HTMLProvider   components={{     p: MyCustomP,   }} >   <slot /> </HTMLProvider> 
       <script lang="ts">   import { HTMLProvider } from "svelte-intlayer/html"; </script> <HTMLProvider   renderHTML={async (html) => {     const { renderHTML } = await import('svelte-intlayer/html');     return renderHTML(html);   }} >   <slot /> </HTMLProvider> 
       import { HTMLProvider } from "preact-intlayer/html"; export const AppProvider = ({ children }) => (   <HTMLProvider     components={{       p: (props) => <p className="prose" {...props} />,     }}   >     {children}   </HTMLProvider> ); 
       import { HTMLProvider } from "preact-intlayer/html"; export const AppProvider = ({ children }) => (   <HTMLProvider     renderHTML={async (html) => {       const { renderHTML } = await import('preact-intlayer/html');       return renderHTML(html);     }}   >     {children}   </HTMLProvider> ); 
       import { HTMLProvider } from "solid-intlayer/html"; export const AppProvider = (props) => (   <HTMLProvider     components={{       p: (props) => <p className="prose" {...props} />,     }}   >     {props.children}   </HTMLProvider> ); 
       import { HTMLProvider } from "solid-intlayer/html"; export const AppProvider = (props) => (   <HTMLProvider     renderHTML={async (html) => {       const { renderHTML } = await import('solid-intlayer/html');       return renderHTML(html);     }}   >     {props.children}   </HTMLProvider> ); 
      import { createIntlayerHTMLProvider } from "angular-intlayer/html";export const appConfig: ApplicationConfig = {  providers: [    createIntlayerHTMLProvider({      components: {        p: { class: "prose" },        CustomLink: { href: "/details" },      },    }),  ],};
      import { createIntlayerHTMLProvider } from "angular-intlayer/html";export const appConfig: ApplicationConfig = {  providers: [    createIntlayerHTMLProvider({      renderMarkdown: async (html) => {        const { renderMarkdown } = await import('angular-intlayer/html');        return renderMarkdown(html);      },    }),  ],};
      import { HTMLRenderer } from "react-intlayer/html";<HTMLRenderer components={{ p: MyCustomP }}>  {"<p>Hello World</p>"}</HTMLRenderer>
      import { useHTMLRenderer } from "react-intlayer/html";const renderHTML = useHTMLRenderer({  components: { strong: (props) => <strong {...props} className="text-red-500" /> }});return renderHTML("<p>Hello <strong>World</strong></p>");
      import { renderHTML } from "react-intlayer/html";const jsx = renderHTML("<p>Hello</p>", { components: { p: 'div' } });
       <script setup> import { HTMLRenderer } from "vue-intlayer/html"; </script> <template>   <HTMLRenderer content="<p>Hello World</p>" /> </template> 
      <script lang="ts">import { HTMLRenderer } from "svelte-intlayer/html";</script><HTMLRenderer value="<p>Hello World</p>" />
      <script lang="ts">import { useHTMLRenderer } from "svelte-intlayer/html";const render = useHTMLRenderer();</script>{@html render("<p>Hello World</p>")}
      <script lang="ts">import { renderHTML } from "svelte-intlayer/html";</script>{@html renderHTML("<p>Hello World</p>")}
       import { HTMLRenderer } from "preact-intlayer/html"; <HTMLRenderer>   {"<p>Hello World</p>"} </HTMLRenderer> 
       import { useHTMLRenderer } from "preact-intlayer/html"; const render = useHTMLRenderer(); return <div>{render("<p>Hello World</p>")}</div>; 
       import { renderHTML } from "preact-intlayer/html"; return <div>{renderHTML("<p>Hello World</p>")}</div>; 
       import { HTMLRenderer } from "solid-intlayer/html"; <HTMLRenderer>   {"<p>Hello World</p>"} </HTMLRenderer> 
       import { useHTMLRenderer } from "solid-intlayer/html"; const render = useHTMLRenderer(); return <div>{render("<p>Hello World</p>")}</div>; 
       import { renderHTML } from "solid-intlayer/html"; return <div>{renderHTML("<p>Hello World</p>")}</div>; 
      import { IntlayerHTMLService } from "angular-intlayer/html";export class MyComponent {  constructor(private markdownService: IntlayerHTMLService) {}  renderHTML(html: string) {    return this.markdownService.renderMarkdown(html);  }}