Skip to content

Global Components ​

The following Vue components are globally registered and available without importing them.

Each runtime (edit and display) registers its own set of global components. In the CEK, these are mock implementations for local development (e.g. TailorEmbeddedContainer renders example elements, TailorAssetInput uploads to the local dev server). In production, the host application (Tailor CMS for authoring, the LMS for display) registers its own implementations that connect to the real storage, element registry, and other platform services. The API (props and events) is the same across environments.

Edit Runtime ​

Registered by the CEK edit runtime and Tailor CMS. Available in Edit, TopToolbar, and SideToolbar components.

TailorFileInput ​

File picker with a dialog for uploading (drag & drop), choosing from the asset library, and optionally importing from a URL. Auto-detects the asset type from the accepted extensions to resolve the icon, label, and dropzone title. Handles the upload via $storageService.

It has two modes:

  • field (default): a form control. Empty, it is a click-to-add text field; filled, it is a compact file card with preview, replace, and remove. Use it in side toolbars and forms.
  • dropzone: a media composer for the element body. Empty, it renders a placeholder-style zone with Upload, Library and, when enabled, From URL, plus drag & drop with inline progress. Filled, it renders your media from the default slot and, while show-actions is true, a sticky row beneath it with the file name, Replace and Remove.
vue
<template>
  <TailorFileInput
    :allowed-extensions="['.png', '.jpg', '.jpeg']"
    :file-key="element.data.assets?.url || element.data.url"
    :public-url="element.data.url"
    :readonly="isReadonly"
    :show-actions="isFocused"
    mode="dropzone"
    allow-url-source
    @delete="onDelete"
    @input="save"
    @upload="save"
  >
    <VImg :alt="element.data.alt" :src="element.data.url ?? ''" />
  </TailorFileInput>
</template>

<script setup lang="ts">
import type { Element, ElementData } from 'tce-manifest';

const props = defineProps<{
  element: Element;
  isFocused: boolean;
  isReadonly: boolean;
}>();
const emit = defineEmits<{ save: [data: ElementData] }>();

// `@input` also fires with `null` on remove; `@delete` covers that case
const save = (payload: Record<string, any> | null) => {
  if (!payload) return;
  const { url, publicUrl } = payload;
  emit('save', { ...props.element.data, url: publicUrl ?? url, assets: { url } });
};

const onDelete = () => {
  emit('save', { ...props.element.data, url: null, assets: {} });
};
</script>

Keep the editor honest: render what learners will see in the default slot, and leave editing chrome (replace, remove, file facts) to the row the component adds.

Info

The kit has no asset library, so its runtime offers Upload and From URL only; the Library source appears in Tailor.

Props ​

PropTypeDefaultDescription
mode'field' | 'dropzone''field'Form control, or in-card media composer (see above)
file-keystring''Storage key, storage:// URI, or external http(s) URL of the current file
file-namestring''Display name; falls back to parsing from fileKey
show-actionsbooleantrueDropzone mode: show the file row below the media; bind to the element's focus state
allow-url-sourcebooleanfalseShow the URL tab in the picker dialog and the From URL button in the dropzone
allowed-extensionsstring[][]Accepted extensions with dot prefix (e.g. ['.jpg', '.png']); drives type detection, the native picker filter, and library filtering
show-previewbooleanfalseImage thumbnail + overlay on the file card; auto-enabled for image extensions
public-urlstring | nullnullPre-resolved public URL; skips the async fetch when present
readonlybooleanfalseDisables all interactions
labelstring''Override the auto-inferred label (derived from extensions)
placeholderstring''Field mode: text field placeholder; also the base of the dialog heading
iconstring''Override the auto-inferred icon (derived from extensions)
titlestring''Dropzone mode: override the heading inferred from the asset type (e.g. Add a PDF instead of Add a document)
variantVTextField['variant']'outlined'Vuetify variant for the text field (field mode)
densityVTextField['density']'default'Vuetify density for the text field (field mode)
darkbooleanfalseDark theme variant for the file card (field mode)

Slots (dropzone mode) ​

SlotPropsDescription
default{ url, fileName, isLoading }The media to render once a file is set
actions{ replace, remove }Replaces the Replace / Remove buttons in the file row

Events ​

EventPayloadDescription
@upload{ key, name, url, publicUrl }File uploaded via drag & drop or the file picker
@input{ key, name, url, publicUrl } | { url, publicUrl, name } | nullAsset picked from the library, URL imported, or null on remove. For a URL import, name is the entered title, or the last segment of the URL
@delete—File removed by the user

Values inferred from allowed-extensions ​

TypeIconLabelDropzone title
Imagemdi-image-outlineImageAdd an image
Videomdi-video-outlineVideoAdd a video
Audiomdi-volume-mediumAudioAdd audio
Documentmdi-file-document-outlineDocumentAdd a document
Fallbackmdi-file-outlineFileAdd a file

The type is inferred only when every accepted extension belongs to one group; mixed or empty lists fall back to File. label and icon override the inferred values.

TailorAssetPicker ​

The picker dialog on its own, without a current value: Upload, Library and, when enabled, URL. Use it for one-off actions such as inserting an image into text; use TailorFileInput when the element holds a single file. TailorFileInput opens this same dialog.

vue
<template>
  <VBtn text="Insert image" @click="isPickerOpen = true" />
  <TailorAssetPicker
    v-model="isPickerOpen"
    :allowed-extensions="['.png', '.jpg', '.jpeg']"
    heading="Insert image"
    allow-url-source
    @select="insert"
    @upload="insert"
  />
</template>

Listen to both events when the source doesn't matter. The dialog closes itself after a successful upload or pick, and stays open with the error if an upload fails. See Assets inside HTML for storing what it returns.

Info

The kit has no asset library, so its runtime offers Upload and URL only; the Library tab appears in Tailor.

Props ​

PropTypeDefaultDescription
model-valueboolean—Open state (v-model)
allowed-extensionsstring[][]Accepted extensions with dot prefix; filters the native picker and the library
allow-url-sourcebooleanfalseShow the URL tab
headingstringinferred labelDialog title; defaults to the type label inferred from the extensions (e.g. Image)
iconstringinferred iconHeader icon
initial-tab'upload' | 'library' | 'url''upload'Tab shown when the dialog opens ('library' is Tailor only)

Events ​

EventPayloadDescription
@upload{ key, name, url, publicUrl }File uploaded from the Upload tab
@select{ key, name, url, publicUrl } | { url, name }Asset picked from the library, or URL imported. For a URL, url is the external URL as entered (the kit also sets publicUrl to it)
@update:model-valuebooleanOpen state changed

url is the storage:// URI for uploads and library assets; publicUrl is a signed URL for showing the file right away and must not be saved.

TailorAssetInput (legacy) ​

The previous asset input component with inline edit/save/cancel state. Still registered globally for backward compatibility. New elements should use TailorFileInput instead.

See the File storage section for details on asset URL handling.

TailorElementPlaceholder ​

Placeholder component shown when no content has been provided yet (e.g. no image uploaded, no URL set). Displays a centered icon, name, and contextual instructions that change based on focus state.

vue
<template>
  <TailorElementPlaceholder
    v-if="!element.data.url"
    :icon="manifest.ui.icon"
    :is-focused="isFocused"
    :is-readonly="isReadonly"
    :name="`${manifest.name} component`"
    active-icon="mdi-arrow-up"
    active-placeholder="Use the toolbar above to enter the url"
  />
</template>

Props ​

PropTypeDefaultDescription
iconstringrequiredMDI icon name
namestringrequiredElement display name
colorstringundefinedAvatar color (tonal); inherits text color when unset
placeholderstring'Select to edit'Text shown when unfocused
active-placeholderstring'Use the toolbar above to edit'Text shown when focused
active-iconstring | nullnullIcon shown next to active placeholder
is-focusedbooleanfalseFocus state (enlarges the icon, shows active placeholder)
is-readonlybooleanfalseHides the placeholder instructions

TailorDialog ​

Themed dialog with the Tailor card chrome: an icon and title header, optional subheader, body and actions slots, and an optional close button. Use it for element-level dialogs, for example changing a source URL while the current embed stays in view. It follows the app theme even when opened from inside the always-light element sheet.

vue
<template>
  <TailorDialog
    v-model="isOpen"
    header-icon="mdi-application-brackets"
    title="Change the embed"
    width="500"
  >
    <template #body>
      <VTextField v-model="url" label="URL" variant="outlined" />
    </template>
    <template #actions>
      <VBtn text="Cancel" variant="text" @click="isOpen = false" />
      <VBtn color="primary" text="Save" variant="flat" @click="save" />
    </template>
  </TailorDialog>
</template>

Props ​

PropTypeDefaultDescription
model-valueboolean—Open state (v-model)
titlestring''Header title
header-iconstring'mdi-alert'Header icon
colorstring'primary'Header icon color
widthnumber | string500Dialog width
closeablebooleanfalseShow a close button in the header
themestringapp themeOverride the theme the dialog renders in

Any other attribute (e.g. persistent) is passed to the underlying VDialog.

Slots ​

SlotDescription
activatorTrigger element; receives the VDialog activator props
subheaderContent between the header and the body (e.g. tabs)
bodyDialog content
actionsButtons in the card actions row

Events ​

EventDescription
@open / @closeOpen state changed
@submitListening for it wraps the card in a form; fires on Enter and submit buttons

TailorEmbeddedContainer ​

Interactive container for embedded child elements within composite elements. Supports adding, editing, deleting, and reordering embedded elements.

vue
<template>
  <TailorEmbeddedContainer
    :container="element.data"
    :is-readonly="isReadonly"
    @save="emit('save', $event)"
  />
</template>

Props ​

PropTypeDefaultDescription
containerobjectrequiredData field containing embeds in key-value format
allowed-elements-configarray[]Element configs allowed to be embedded
is-readonlybooleanfalseDisable editing
enable-addbooleantrueShow add element button
add-element-optionsobjectsee belowOptions for the add element button
element-variant'card' | 'field' | 'quiet''quiet'Presentation of each embedded element. card: standard collapsible editor card. field: header-less body for externally-labelled slots. quiet: header revealed on hover/focus, always expanded
default-expandedbooleantrueBaseline expansion state of each embed (card variant only). Embeds added during the session always start expanded

Default addElementOptions:

ts
{
  large: false,
  label: 'Add content',
  icon: 'mdi-plus',
  variant: 'tonal',
}

Events ​

EventPayloadDescription
@saveobjectUpdated container object with modified embeds
@deleteobjectElement to be deleted

See Composite Elements for usage details.

TailorContentElement ​

Internal

Used internally by TailorEmbeddedContainer to render individual embedded elements. Not intended for direct use by element authors.

Renders a single embedded element with edit controls (text input, delete button on hover).

Props ​

PropTypeDefaultDescription
elementobjectrequiredElement entity
parentobject | nullnullParent element (hides delete when set)
is-readonlybooleanfalseDisable editing

Events ​

EventPayloadDescription
@saveobjectUpdated element data
@deleteobjectElement to be deleted

Display Runtime ​

Registered by the CEK display runtime. In production, the LMS that consumes the Display package is responsible for registering these components.

TailorEmbeddedContainer ​

Read-only container that renders embedded child elements for display.

vue
<template>
  <TailorEmbeddedContainer :elements="elements" />
</template>

Props ​

PropTypeDefaultDescription
elementsarrayrequiredArray of embedded element objects to render