Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub

Server-Side Rendering & Hydration

Methane wraps @lit-labs/ssr behind @methane-ui/ssr and ships adapters for Next.js, Nuxt, SvelteKit, Astro, and Angular so custom elements render on the server with Declarative Shadow DOM and hydrate cleanly on the client.

Hybrid Stylesheet Delivery

  • styles: 'linked' (Default): Emits a content-hashed<link rel="stylesheet" href="..."> inside<template shadowrootmode="open"> paired with a compact critical inline<style> shell to prevent FOUC and layout shift.
  • styles: 'inline': Embeds the full component stylesheet inside<style> for emails, single-file HTML exports, and edge responses.
  • Client-only fallback: @methane-ui/css/defined-guard.css applies a fail-open :not(:defined) reveal animation (never visibility: hidden), while pure-CSS layout tags (mth-stack, mth-grid, mth-flex,mth-container, mth-spacer) stay immediately visible at opacity: 1.
import { renderToString, transformHtmlDsd } from '@methane-ui/ssr';

const result = await transformHtmlDsd('<mth-button variant="solid">Save</mth-button>', {
  styles: 'linked',
  assetBase: '/assets/methane',
});