intro option is set to false.
Parameters
Component<Props, Exports>
required
The Svelte component to mount
MountOptions<Props>
required
Configuration options for mounting the component
Document | Element | ShadowRoot
required
Target element where the component will be mounted
Node
Optional node inside
target. When specified, the component is rendered immediately before itProps
Component properties. Required if the component expects props
boolean
default:"true"
Whether or not to play transitions on initial render
Map<any, any>
Can be accessed via
getContext() at the component levelRecord<string, (e: any) => any>
deprecated
Allows the specification of events. Use callback props instead
(error: unknown) => unknown | Promise<unknown>
A function that transforms errors caught by error boundaries before they are passed to the
failed snippet. Defaults to the identity functionReturns
Exports
The component’s exports (and potentially the props if compiled with
accessors: true)Examples
Basic usage
Mounting with anchor
Disabling intro transitions
With context
Notes
- In Svelte 5, components are functions, not classes. Use
mount()instead ofnew Component() - The component is mounted synchronously
- To unmount the component later, use the
unmount()function - See the migration guide for more information about the change from Svelte 4