@astryx-svelte/core
Svelte 5 components for Astryx, Meta's open source design system.1. Install the package
bashnpm install @astryx-svelte/core
2. Import a component
typescriptimport { Button } from '@astryx-svelte/core';
Your bundler must run the StyleX compiler
This is the one setup fact that has no upstream counterpart, and getting it wrong fails without
an error: the components render, and they render unstyled.
Astryx's own package ships pre-built CSS, so a consumer imports a stylesheet and is done. This one
cannot. Components are styled with StyleX, and
svelte-package — which
builds this package — transpiles TypeScript but does not run StyleX. So dist/**/*.stylex.js is
published uncompiled, and every consumer compiles it as part of their own build. That is the
same property that makes the port verifiable: the compiler derives its class names from the source,
so authoring against Astryx's token references emits byte-identical atomic CSS.For Vite (and therefore SvelteKit), that is three things — the plugin, and two settings that exist
because Vite has two ways to route a dependency around the plugin pipeline:
ts// vite.config.tsimport { sveltekit } from '@sveltejs/kit/vite';import stylex from '@stylexjs/unplugin/vite';import { defineConfig } from 'vite';export default defineConfig({plugins: [stylex({dev: process.env.NODE_ENV !== 'production',runtimeInjection: false,treeshakeCompensation: true,useCSSLayers: true,// Without explicit targets, lightningcss lowers `light-dark()` to a pair of// `var(--lightningcss-*)` references that resolve to nothing, and every// colour token silently goes empty.lightningcssOptions: {targets: { chrome: 123 << 16, firefox: 120 << 16, safari: (17 << 16) | (5 << 8) }},unstable_moduleResolution: { type: 'commonJS', rootDir: import.meta.dirname }}),sveltekit()],// Vite's dev-time pre-bundler runs esbuild outside the plugin pipeline, so anything// it optimises never reaches the StyleX transform and `stylex.create` survives into// the browser as a runtime no-op.optimizeDeps: { exclude: ['@astryx-svelte/core'] },// Same reasoning for the server build: an externalised dependency is imported from// node_modules at runtime rather than transformed.ssr: { noExternal: ['@astryx-svelte/core'] }});
Both
optimizeDeps.exclude and ssr.noExternal fail silently when missing. If a page renders with
the right markup and none of the styling, check those two first.Component Docs
Look up any component's full API — props, variants, examples, best practices, and theming — through
the CLI:
bashpnpm exec astryx-svelte component --list # every component, groupedpnpm exec astryx-svelte component Button # full docs for one componentpnpm exec astryx-svelte util --list # the runes-based composablespnpm exec astryx-svelte search button # components, utils, docs and templates at once
Everything is exported from the package root. There are no per-component subpath entrypoints —
Astryx publishes one per component and this port publishes none, so
@astryx-svelte/core is where
Button lives and the barrel is tree-shaken by your bundler. The subpaths that do exist are for
non-component surfaces:| Subpath | What it is |
|---|---|
@astryx-svelte/core | Every component, every util, every props type |
@astryx-svelte/core/theme | Theme, useTheme, the token vars |
@astryx-svelte/core/theme/define | defineTheme and its types, for authoring a theme |
@astryx-svelte/core/theme/syntax | Syntax-highlighting themes for CodeBlock |
@astryx-svelte/core/hooks | The composables, without the components |
@astryx-svelte/core/utils | Framework-free helpers |
@astryx-svelte/core/naming | The class-name helpers themes and integrations build against |
@astryx-svelte/core/i18n | The message catalog runtime |
@astryx-svelte/core/locales/* | The shipped catalogs (en, fr-FR, pseudo) |
@astryx-svelte/core/base.css | The one stylesheet — see below |
Page Layouts
Building a full page? Astryx's advice is to start from a template rather than composing from
scratch, and the CLI has the command:
bashpnpm exec astryx-svelte template --list # browse page and block templatespnpm exec astryx-svelte template <id> --skeleton
Core contributes none of them yet. Astryx's 1,329 template assets are React source and are
deferred, so
template --list finds nothing from this package today. The command is not a stub —
templates contributed by an integration package, or by any other installed package, are discovered
and injected normally — but do not plan on scaffolding a dashboard out of core.Related Packages
| Package | Description |
|---|---|
@astryx-svelte/cli | Component docs, reference topics, themes, scaffolding, codemods |
@astryx-svelte/theme-neutral | The default Astryx look — muted and minimal |
@astryx-svelte/theme-butter | Warm creamy yellows with a friendly blue accent |
@astryx-svelte/theme-chocolate | Rich cozy browns with Fraunces headings |
@astryx-svelte/theme-gothic | Deep blue-grays and a display serif; dark-only |
@astryx-svelte/theme-matcha | Earthy greens, calm and organic |
@astryx-svelte/theme-stone | Warm stone and slate, understated |
@astryx-svelte/theme-y2k | Hot pinks, lime greens, and Poppins |
@astryx-svelte/theme-liquid-glass | macOS translucent materials; no upstream counterpart |