Built-in Special Elements
Not Components
<component> and <slot> are component-like features and part of the template syntax. They are not true components and are compiled away during template compilation. As such, they are conventionally written with lowercase in templates.
<component> 
A "meta component" for rendering dynamic components or elements.
- Props - interface DynamicComponentProps { is: string | Component }
- Details - The actual component to render is determined by the - isprop.- When - isis a string, it could be either an HTML tag name or a component's registered name.
- Alternatively, - iscan also be directly bound to the definition of a component.
 
- Example - Rendering components by registered name (Options API): - <script> import Foo from './Foo.kdu' import Bar from './Bar.kdu' export default { components: { Foo, Bar }, data() { return { view: 'Foo' } } } </script> <template> <component :is="view" /> </template>- Rendering components by definition (Composition API with - <script setup>):- <script setup> import Foo from './Foo.kdu' import Bar from './Bar.kdu' </script> <template> <component :is="Math.random() > 0.5 ? Foo : Bar" /> </template>- Rendering HTML elements: - <component :is="href ? 'a' : 'span'"></component>- The built-in components can all be passed to - is, but you must register them if you want to pass them by name. For example:- <script> import { Transition, TransitionGroup } from 'kdu' export default { components: { Transition, TransitionGroup } } </script> <template> <component :is="isGroup ? 'TransitionGroup' : 'Transition'"> ... </component> </template>- Registration is not required if you pass the component itself to - israther than its name, e.g. in- <script setup>.- If - k-modelis used on a- <component>tag, the template compiler will expand it to a- modelValueprop and- update:modelValueevent listener, much like it would for any other component. However, this won't be compatible with native HTML elements, such as- <input>or- <select>. As a result, using- k-modelwith a dynamically created native element won't work:- <script setup> import { ref } from 'kdu' const tag = ref('input') const username = ref('') </script> <template> <!-- This won't work as 'input' is a native HTML element --> <component :is="tag" k-model="username" /> </template>- In practice, this edge case isn't common as native form fields are typically wrapped in components in real applications. If you do need to use a native element directly then you can split the - k-modelinto an attribute and event manually.
- See also: Dynamic Components 
<slot> 
Denotes slot content outlets in templates.
- Props - interface SlotProps { /** * Any props passed to <slot> to passed as arguments * for scoped slots */ [key: string]: any /** * Reserved for specifying slot name. */ name?: string }
- Details - The - <slot>element can use the- nameattribute to specify a slot name. When no- nameis specified, it will render the default slot. Additional attributes passed to the slot element will be passed as slot props to the scoped slot defined in the parent.- The element itself will be replaced by its matched slot content. - <slot>elements in Kdu templates are compiled into JavaScript, so they are not to be confused with native- <slot>elements.
- See also: Component - Slots