Primitive
Headless Primitive; covers Reka UI Primitive, Radix Slot, shadcn/ui Slot.
| Package | @vizejs/ui/primitive |
| Maturity | stable |
| Own the source | vize lib pull primitive |
| Requires | — |
| Aliases | as child, polymorphic primitive, slot forwarding primitive |
| Covers | Reka UI Primitive, Radix Slot, shadcn/ui Slot |
Usage
import { Primitive } from "@vizejs/ui/primitive";
Or copy the source into your project with vize lib pull primitive (see Source Distribution).
API
Primitive
Source: src/families/foundations/primitive/primitive-element.vue
Props
| Prop | Type | Default | Description |
|---|---|---|---|
as |
PrimitiveAs |
"div" |
Native element, custom element, or component to render. |
Exposed
| Member | Type | Description |
|---|---|---|
element |
Readonly<ShallowRef<HTMLElement | null>> |
Template ref to the rendered root element. |
Behavior
Normative state × input → outcome table for primitive-element.vue (@vizejs/ui/primitive).
Every row is proven by the named mounted-DOM test in src/families/foundations/primitive/primitive.test.ts.
| # | State | Input | Outcome | Proven by |
|---|---|---|---|---|
| P1 | as="section" |
render | renders <section data-vize-ui="primitive"> with slot text |
renders the requested element with slotted content |
| P2 | default | render | renders <div>; exposed element is the rendered node |
defaults to a div and exposes the rendered element |
| P3 | as = component |
render | every named slot is forwarded to the target component | forwards every named slot to a component target |