Components and mounting
$component(setup)defines a compiler-managed component.mount(component, target)mounts one compiled component into a validated DOM target.Headmounts owned JSX children intodocument.headwithout a body wrapper or deduplication.renderToStringAsync(component, props?, { timeoutMs?, onHead? })serializes body markup and reports compiler-managed Head markup through the requiredonHeadcallback when present.class,className, andclassNamesare equivalent on intrinsic elements.createRef<T>()creates a mutable, non-reactive{ current: T | null }DOM ref; intrinsicrefalso accepts callback and structurally compatible object refs.Portalrenders JSX, text, and primitive children into a required reactiveElementtarget without recreating them during retargeting.GlobalPortalrenders the same child types directly underdocument.bodywithout an element wrapper.
Reactivity
$signal(initial)creates manual state outside compiled component inference.$computed(read)creates an explicit derived value.$bind={state}connects supported form controls in both directions.
batch() is an internal compiler-runtime operation, not an author-facing export from sol.
Forms
$form(options, submit)creates values, errors, form errors, submission state, reset behavior, and validation handlers.$form={controller}connects the controller to an intrinsic form.Parser inputs may be callable, expose
parse()orparseAsync(), or implement Standard Schema.
Queries and mutations
$query(config, ...initialArgs)creates a component-owned, JSON-keyed query observer and starts its enabled initial request.Query config contains
query,queryKey,enabled,staleTime,cacheTime,pollingInterval, and phase-specificsuspenseoptions.Query controllers expose
data,lastData,error,isFetching,isRefetching,isFailed, andrefetch(options, ...args).$mutation({ mutation, suspense? })creates an imperative mutation controller without starting work.Mutation controllers expose
data,lastData,error,isMutating,isFailed, andmutate(options, ...args).QueryKey, config, controller, Suspense, and per-call option types are exported fromsol.
Server declarations
$rpcQuery(name, { schema }, handler)declares a validated JSON POST RPC whose schema parses the full argument tuple.$rpcMutation(name, { schema }, handler)declares the corresponding POST RPC.$httpRoute({ method, path, schema, body? }, handler)declares a Fetch endpoint with decoded path parameters, query values, headers, and JSON/text or byte body input.Server declarations and
$route()must be exported top-level constants in.sol.tsor.sol.tsxfiles.HTTP handlers receive the schema output and original
Request, and must return aResponse.Static HTTP path segments are URL-canonicalized. Paths reject query or fragment syntax, backslashes, control characters, dot segments, trailing or empty segments, and authored percent escapes; use
:parameterfor decoded dynamic segments.RPC and HTTP request bodies are limited to 1 MiB by default. Configure another non-negative byte limit with
solkit({ entry, adapter, maxBodyBytes }); oversized requests return 413.
Routing
$route(config, component)declares a compile-time route handle.Linkdecorates exactly one anchor child with a typed destination.Routerenders the active route and an optional pending component.routerexposes browser location state and untyped navigation.
Context and async work
$context<T>()createsProvider,use(), anduseOptional().Suspenseowns async fallback and error rendering.Awaitrenders a promise result and may own a local error renderer.ErrorBoundarycatches descendant setup and rendering failures.
Transitions
$transition={transition}attaches enter and leave phases to eligible intrinsic blocks.Transitioncontains optional whitespace-separatedenterandleaveclass strings.
Compiler and Vite
compile(source, filename, { target? })from@sol/compilervalidates and transforms one Sol module for a client or server target. It returns{ code, map }, wheremapis the generated source map ornullwhen no compiled declarations are present.CompileOptionsandCompileResultdescribe that boundary.sol()from@sol/compiler/vitecompiles TSX, discovers.solUI and server declarations, rejects colliding route and endpoint matchers, and maintains both virtual manifests during development.staticAdapter()fromsolkit/adapters/staticrenders the entry module's non-emptystaticPathsarray into nestedindex.htmldocuments beside Vite's client assets.configureRouterBase(base)configures logical routing beneath a validated root-relative deployment base; Solkit calls it automatically with Vite'sBASE_URLbefore hydration.Place
sol()before other JSX transforms in the Vite plugin list. The website additionally places its Markdown compiler beforesol()so generated examples use the same compiler path.
Validation behavior
Public runtime boundaries reject invalid targets, component factories, transition definitions, route destinations, schema outputs, class values, and context usage with descriptive errors. Prefer those failures over silently accepting ambiguous state.