Svelte API

Import components from @page-sections/svelte. The public components are listed below. Component props are documented on the linked pages; this index shows where to start, without duplicating the full reference.

ExportPurpose / required propsReference
ContentPageMain content; pagePages
PageShellShared theme/mode; nonePages
SectionGeneral content region; sectionSection and grids
ContentGridResponsive block grid; noneSection and grids
ContentBlockExplicit grid span; noneSection and grids
SectionSurfaceGroupAdjacent background corners; noneSurface groups
HeroSectionProminent copy/image/actions; sectionHeroSection
RichTextSectionMarkdown, plain text or blocks; sectionRichTextSection
RichTextContentText without a section wrapper; contentRichTextSection
InlineTextContentEscaped inline runs; textRichTextSection
ActionsNative action links; optional actionsPanels
ContentPanelReusable inset panel; no required propsPanels
PanelSectionPanel with section metadata; sectionPanels
ImageSectionImage with optional text; sectionImageSection
VideoSectionHTML5/YouTube with optional text; sectionVideoSection
CardGridSectionResponsive card collection; section, listCardGridSection
CarouselSectionHorizontal card collection; section, listCarouselSection
CardStandalone article; itemCard and Image
ImageShared picture/img renderer; imageCard and Image
NavigationIndependent menu and satellites; noneNavigation
MainMenuRecursive native menu; itemsNavigation
ButtonGroupLabelled controls/links; items, labelNavigation
BreadcrumbsSite ancestry; itemsBreadcrumbs and index
SectionNavigationExplicit anchor list; itemsBreadcrumbs and index
SectionsData-driven dispatcher; sectionsData models
CodeBlockStandalone source presentation; codeCode
CodeSectionSource with section metadata; sectionCode

Props and snippets

Svelte 5 snippets are used instead of named legacy slots. Navigation has menu/brand/left/right/tools/settingsIcon/menuIcon snippets. Card has media(item)/surface(item)/children(item); the collections have media(item)/itemContent(item). CardGridSection also has surface(item) and a complete card(item, configuration) replacement. Generic item subtypes are preserved. Section, ContentPage, PageShell, ContentGrid, ContentBlock, SectionSurfaceGroup, HeroSection, ImageSection and VideoSection accept ordinary children snippets.

RichTextSection and Sections have no children prop. Section forwards ordinary HTMLElement attributes except id/children; ContentGrid and ContentBlock forward div attributes. ContentPage forwards main attributes (including id, lang and ARIA attributes), except style; use theme and class for styling. Card also forwards HTMLElement attributes, including class and event callbacks. Other components do not accept general class/style or arbitrary HTML attributes. Configure them through documented props, section metadata and CSS variables.

Most predefined components accept section: Omit<TheirSectionData, 'type'>. CardGridSection and CarouselSection instead take shared SectionDefinition plus separate list/configuration props. type belongs to serialized sections rendered by Sections, not to a required declarative prop.

Types and styles

The root export includes export type * from '@page-sections/core' and the Svelte-specific CardElements<T> type (item, root, surface, media, copy, title). It does not re-export core runtime classes/functions/constants. Component prop interfaces are not separately named exports; use Svelte's ComponentProps where applicable or the shared data interfaces.

Shared styles are exported through @page-sections/svelte/styles.css. The optional @page-sections/svelte/highlight entry exports highlightCode; install its Shiki peer to use it, preferably at build/server time. No internal component file, context symbol or generated CSS path is a supported deep import. See Installation for which components load shared CSS themselves.

Rendering contract

These are Svelte source components compiled by the consuming toolchain. SSR requires host support. Text, native links and responsive layouts do not require hydration; button callbacks and reactive updates do. There are no routing, fetching, CMS, image-processing or automatic SSR configuration APIs.

Related: Core API, SSR and Progressive Enhancement.

Heading components

Heading accepts text, level (HeadingLevel, default 2), size (HeadingSize, default m), id, eyebrow and introduction. It renders typography only. HeadingSection accepts section: Omit<HeadingSectionData, 'type'> and adds section layout, surface and registration. See Headings.

ContentPage renders the sections supplied as children. Place HeadingSection or HeroSection directly in that content and set headingLevel: 1 for the page title. SidebarNavigation accepts a disclosureIcon snippet for its disclosure chevron; the website supplies Lucide.