Live preview

Interactive example

Loading example…

Usage

Import the component and its manager, then make it your own.

ComponentContentInput
Managercreate_content_input_manager

svelte

<script>
  // Import the shared stylesheet once in your application's root layout.
  import "sveltekit-ui/style.css"
  import { ContentInput, create_content_input_manager, markdown_to_astc } from "sveltekit-ui"

  const manager = create_content_input_manager({
    val: markdown_to_astc("## Your article\n\nSelect a text element to edit it."),
  })
</script>

<div style="height: 50rem; max-height: 80vh;">
  <ContentInput {manager} />
</div>
<details>
  <summary>Document data</summary>
  <pre>{JSON.stringify(manager.val, null, 2)}</pre>
</details>

API reference

Configure the manager, call its methods, and read its reactive state.

9 entries in configuration

PropertyTypeDefaultDescription
valobject nullthe initial top-level ASTC node
on_changefunction nullcallback triggered when the ASTC structure changes
on_finishfunction nullcallback triggered when the user finishes editing
on_eventfunction nullcallback invoked for certain child content manager events
definition_stackany nullexternal definition_stack variables object for show_conditions or other variable-based usage
mapkit_js_tokenstring nulltoken for mapkit if needed by location-based nodes
storageany nullstorage definition used when uploading or managing files
storage_default_folder_pathstring nulldefault folder path for storage uploads
storage_pathstring /api/storage/{storage_id}app-provided stored-media URL template used by previews and media pickers; the library provides no storage backend