# Content — SvelteKit UI

Package: sveltekit-ui 1.1.94

Page: https://www.sveltekit-ui.com/components/content

Category: Data & content

manages a nested tree of typed components, allowing dynamic rendering based on type_ids and attributes

Public component import: `Content`

Public manager import: `create_content_manager`

## Usage

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

  const manager = create_content_manager({
    val: markdown_to_astc("## Welcome\n\nCompose **rich content** with the library's components."),
  })
</script>

<Content {manager} />
```

## Configuration

### `val`

- type: object
- default: null
- description: the top-level content node containing { type_id, selector_id, attributes, children }

### `is_dark_theme`

- type: boolean
- default: false
- description: if true, toggles usage of dark theme variants for certain components

### `storage_path`

- type: string
- default: /api/storage/{storage_id}
- description: template path for retrieving stored media, used by some child components (e.g. image, audio)

### `variables`

- type: any
- default: null
- description: external data object used by show_conditions or variable-based attributes

### `mapkit_js_token`

- type: string
- default: null
- description: token for mapkit if needed by location-based components

### `on_event`

- type: function
- default: null
- description: callback for setting or manipulating variables when certain components update

### `on_search_table_row_ids`

- type: function
- default: null
- description: callback that returns table row ids for table-row-based inputs (like table_row_id_input)

### `table_options`

- type: object
- default: null
- description: an object of additional options passed along to table-based components if present

## Methods

### `init()`

- description: initializes the manager, preparing the top-level content node and any children
- parameters:
  - config: object
- returns: void

### `prepare_component_and_children()`

- description: recursively creates the required sub-managers for the given node, returning a structured object with type_id, manager, and children
- parameters:
  - val: object
- returns: object

### `pass_event_down()`

- description: allows external events to propagate through children and possibly trigger state updates
- parameters:
  - input: object
- returns: void

### `set_variable_at_path()`

- description: handles changes to variables via the on_event callback, adjusting stored data by array/object indexing
- parameters:
  - path: array
  - value: any
  - type: string (optional: 'insert', 'delete', 'set_key', or null)
- returns: any

## Returned state

### `val_prepped`

- type: object
- description: the processed content node with type, manager, and possible children

### `definition_stack`

- type: any
- description: the definition_stack variables reference passed in config, potentially used by show_conditions
