Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic

Troubleshooting and FAQ

Fixes for the problems people hit most often, grouped by where they show up. Run npx @prismora/cli doctor first: it checks your packages, theme file, generated CSS and colour contrast.

Setup

Components render as plain text, or have no styles

Two things must load: the CSS (@prismora/css/foundation.css plus your theme) and the element definitions. Wrappers (@prismora/react, vue, svelte) register each element when you import it. With raw <pm-*> tags, import each element (@prismora/elements/button) or all of them (@prismora/elements/define). Until an element is registered, the browser shows its children as plain content. To hide that briefly on slow connections:

pm-tabs:not(:defined), pm-data-table:not(:defined) { visibility: hidden; }

Icons are missing

Icons named in attributes (icon-start="moon", <pm-icon name="check">) must be registered once. Register only the ones you use, so the rest are tree-shaken:

import { registerIcons } from '@prismora/elements/icon'; import { check, moon, sun } from '@prismora/icons'; registerIcons([check, moon, sun]); // Your own: SVG content on a 24×24 grid registerIcons([{ name: 'logo', body: '<path d="M4 12h16"/>' }]);

Fonts do not change

Set typography.font in prismora.theme.ts and import that pairing's files once: import '@prismora/fonts/pairing-inter.css'. Without a bundler, the font packages cannot be resolved; use font: 'system' or host the font files yourself.

I edited prismora.theme.css and my change disappeared

That file is generated. Edit prismora.theme.ts and run npx @prismora/cli theme build (the reference apps run it before dev and build). Override individual tokens in your own CSS instead: unlayered CSS always wins over Prismora's layers.

The CLI fails to read prismora.theme.ts

The CLI runs on Node 20 or later and on Bun. Reading a TypeScript config needs Node 22.13 or later (built-in type stripping) or Bun; on older Node, rename it to prismora.theme.mjs or use JSON. In a monorepo, run prismora init inside the app folder, where its package.json is.

SSR and hydration

Hydration warning about attributes on <html>

The no-flash script sets data-mode and similar attributes on <html> before your framework hydrates. That is intended. In React and Next.js add suppressHydrationWarning to <html>; it affects that element only.

"window is not defined" or "localStorage is not defined"

Elements register only in the browser, and the wrappers are SSR-safe. Code you write that touches the browser must run there too: create ThemeController and call registerIcons in useEffect (React), onMounted or a .client plugin (Nuxt), onMount (Svelte), or a client <script> (Astro).

The page flashes light before turning dark

The no-flash script is missing or runs too late. It must be an inline script near the top of <head>, not a module or deferred script (is:inline in Astro). npx @prismora/cli init adds it for every framework; the reference apps show where it goes.

Frameworks

React: events do nothing, or table data arrives as a string

Use the wrappers' camelCase event props (onPmChange, onPmInput), not onChange. The wrappers need React 19, which sets custom element properties (arrays, objects) instead of string attributes; React 18 is not supported.

Vue: "Failed to resolve component: pm-…"

Tell Vue that pm- tags are custom elements: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('pm-') } } }) in Vite, or vue.compilerOptions.isCustomElement in nuxt.config.ts.

Svelte 5 does not forward slot attributes through components. Pass named slots as snippets: {#snippet footer()}…{/snippet}.

Angular: "'pm-input' is not a known element" or "No value accessor for form control"

Add schemas: [CUSTOM_ELEMENTS_SCHEMA] (from @angular/core) to each standalone component that uses <pm-*>, and imports: [FormsModule, ...PRISMORA_FORMS] for ngModel, formControl or formControlName. Bind non-input attributes with [attr.icon-start].

Solid: the value does not update

Attributes set only the initial value. Bind the live property with prop:value or prop:checked, and listen with onPm-input or onPm-change.

Forms

Does a Prismora input submit with my form?

Yes. Form controls are form-associated custom elements: they submit with name, appear in FormData, take part in required and constraint validation, reset with the form, and are disabled by a disabled <fieldset>. Server validation errors go in the error attribute.

Reading a value in a plain script

Wait until the element is defined, then use its properties, exactly like a native input:

await customElements.whenDefined('pm-input'); const email = document.querySelector('pm-input[name=email]'); email.addEventListener('pm-input', () => console.log(email.value));

Themes and dark mode

Force light or dark for the whole app, or one section

data-mode="dark" (or light) on <html> fixes the mode; on any element it themes just that subtree. Without it, the mode follows the operating system until the user picks one with ThemeController, which saves the choice.

A "Dark mode" button needs two clicks

toggle() cycles system → light → dark, which suits a three-way control. For a two-state button, use flip(), which sets the opposite of what is shown:

button.addEventListener('click', () => theme.flip());

Using Prismora with Tailwind CSS

Import @prismora/css after tailwindcss and export a Tailwind preset from the generator (prismora theme export --format tailwind) so utilities such as bg-accent-soft use your theme. Prismora styles live in cascade layers, so your utilities win without !important.

Right-to-left languages

Set dir="rtl" on <html> or any section. Components use logical properties, so padding, icons and drawers mirror automatically.

Content Security Policy

The only inline script is the no-flash script. With a strict CSP, allow it by hash (this hash is for the current version and changes when the script changes):

Content-Security-Policy: script-src 'self' 'sha256-hTxqDLoYyvSmOh2df4W7TB1H3tCNp9S0AYe0cyDM3B4='

Alternatively, add a nonce your server generates per request: <script nonce="…">. Component styles load as constructable stylesheets, but some components set inline style attributes for sizes and positions, so keep style-src-attr 'unsafe-inline' (inline style attributes cannot run code).

Phones: native or web

mobile on <html> turns on native patterns below 640 px: menus and dialogs become bottom sheets, list items swipe, and <pm-nav> becomes a tab bar. mobile="false" on any element opts that subtree out. Users can switch with theme.set({ mobile: 'web' }), which is saved and applied before first paint. See Mobile.

Bundle size

Import single elements (@prismora/elements/button) or wrapper components. Each brings only its own code and CSS. @prismora/elements/define and the standalone build register everything, which is convenient for prototypes and plain HTML. Icons are named exports, so unused ones are dropped too.

Testing

Test in a real browser engine (Playwright, Vitest browser mode). jsdom has no ElementInternals, so form association and validation do not work there. In tests, wait for customElements.whenDefined(tag) and the element's updateComplete before asserting, and reach inner parts through the element's properties rather than its shadow DOM.

Still stuck?

Compare your setup with the reference app for your framework, check the framework setup, or open an issue with the output of npx @prismora/cli doctor.