Skip to main content
The <svelte:options> element provides a place to specify per-component compiler options. These options control how Svelte compiles the component.

Options

runes
boolean
Forces a component into runes mode or legacy mode.
  • runes={true} — forces the component into runes mode
  • runes={false} — forces the component into legacy mode
If not specified, the mode is determined by the file’s syntax.
namespace
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
customElement
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
See the custom elements documentation for details.
css
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)

The following options are deprecated in Svelte 5 and non-functional in runes mode. They are only supported in legacy mode.
immutable
boolean
Deprecated. Controls whether the compiler can use simple referential equality checks.
  • immutable={true} — you never use mutable data
  • immutable={false} — the default
accessors
boolean
Deprecated. Adds getters and setters for the component’s props.
  • accessors={true} — adds getters and setters
  • accessors={false} — the default

Legacy immutable option

Legacy accessors option