import{_ase,casa,oass,Nasn}from"./chunks/framework.0799945b.js";consth=JSON.parse('{"title":"Coercable Components","description":"","frontmatter":{},"headers":[],"relativePath":"guide/important-concepts/coercable.md","lastUpdated":1682267650000}'),o={name:"guide/important-concepts/coercable.md"},t=n(`<h1 id="coercable-components" tabindex="-1">Coercable Components <a class="header-anchor" href="#coercable-components" aria-label="Permalink to "Coercable Components""></a></h1><p>Most times a feature has some sort of dynamic display, it'll allow you to pass a "Coercable Component", or rather, something that can be coerced into a Vue component. This page goes over the different types of values you can use</p><h2 id="template-strings" tabindex="-1">Template Strings <a class="header-anchor" href="#template-strings" aria-label="Permalink to "Template Strings""></a></h2><p>If you provide a string, it will be wrapped in a component using it as the template. This is the simplest method, although not suitable for complex displays, and realistically cannot use Vue components as none are registered globally (by default). Recommended for static or simple dynamic displays, such as displays on features.</p><p>Template strings need to be wrapped in some HTML element. By default, they'll be wrapped in a <code><span></code> element, although certain features may wrap things in div or header elements instead, as appropriate.</p><h2 id="render-functions-jsx" tabindex="-1">Render Functions (JSX) <a class="header-anchor" href="#render-functions-jsx" aria-label="Permalink to "Render Functions (JSX)""></a></h2><p>You can provide a render function and it will be wrapped in a component as well. The intended use for this is to write JSX inside a function, which will get automatically converted into a render function. You can read more about that process on the Vue docs on <a href="https://vuejs.org/guide/extras/render-function.html#render-functions-jsx" target="_blank" rel="noreferrer">Render Functions & JSX</a>. Note that JSX must be returned in a function - it does not work "standalone". The CoercableComponent type will enforce this for you.</p><p>JSX can use imported components, making this suited for writing the display properties on things like Tabs or Layers. There are also built-in functions to <code>render</code> features (either as their own or in a layout via <code>renderRow</code> and <code>renderCol</code>), so you don't need to import the Vue component for every feature you plan on using.</p><p>Typically a feature will accept a <code>Computable<CoercableComponent></code>, which means functions would (normally) be wrapped in a computed (see <a href="./reactivity#computable">Computable</a> for more details). This would break render functions, so when passing a render function as a CoercableComponent it must be specially marked that it shouldn't be cached. You can use the built-in <code>jsx</code> function to mark a function for you.</p><h4 id="example" tabindex="-1">Example <a class="header-anchor" href="#example" aria-label="Permalink to "Example""></a></h4><div class="language-ts"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">{</span></span>