<svelte:options> element provides a place to specify per-component compiler options. These options control how Svelte compiles the component.
Options
boolean
Forces a component into runes mode or legacy mode.
runes={true}— forces the component into runes moderunes={false}— forces the component into legacy mode
string
The namespace where this component will be used.Possible values:
"html"(default) — for regular HTML elements"svg"— for SVG elements"mathml"— for MathML elements
string | object
Options for compiling this component as a custom element.
- If a string is provided, it’s used as the tag name
- If an object is provided, it can contain custom element configuration options
string
Controls how component styles are injected.
css="injected"— styles are injected inline. During server-side rendering, it’s injected as a<style>tag in the head. During client-side rendering, it’s loaded via JavaScript.
Usage
Force runes mode
SVG namespace
Custom element
Custom element with options
Injected CSS
MathML namespace
Deprecated Options (Svelte 4)
boolean
Deprecated. Controls whether the compiler can use simple referential equality checks.
immutable={true}— you never use mutable dataimmutable={false}— the default
boolean
Deprecated. Adds getters and setters for the component’s props.
accessors={true}— adds getters and settersaccessors={false}— the default