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

Layout and utilities

Small CSS classes for the layout work every screen needs: stacks, rows, responsive grids, sidebars, fixed ratios, scroll areas and a few page helpers. They respond to the space they are given, so most screens need no media queries.

Layout

Stack

Children in a column with even spacing. Set the space with --pm-gap.

One
Two
Three
<div class="pm-stack" style="--pm-gap: var(--pm-space-3)"> <div>One</div> <div>Two</div> <div>Three</div> </div>

Cluster

Items in a row that wrap when space runs out: button rows, tags, toolbars. pm-spacer pushes what follows to the end.

Filter
Sort
Export
<div class="pm-cluster"> <div>Filter</div> <div>Sort</div> <span class="pm-spacer"></span> <div>Export</div> </div>

Grid

As many equal columns as fit. --pm-grid-min is the narrowest a column may be; no media queries needed.

1
2
3
4
5
<div class="pm-grid" style="--pm-grid-min: 9rem"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div>

Split

A sidebar next to main content. The sidebar is --pm-side wide; when the main part would get narrower than --pm-split-min, the two stack.

Sidebar
Main content
<div class="pm-split" style="--pm-side: 12rem"> <div>Sidebar</div> <div>Main content</div> </div>

Switcher

A row of equal parts that turns into a column all at once when the container is narrow (never two-plus-one).

Plan
Usage
Billing
<div class="pm-switcher"> <div>Plan</div> <div>Usage</div> <div>Billing</div> </div>

Container and centre

pm-container centres page content with side padding (--pm-container sets the width). pm-center centres one child both ways.

Centred
<div class="pm-center" style="min-block-size: 8rem"> <div>Centred</div> </div>

Horizontal scroll

Wide content scrolls inside its box instead of widening the page. Add tabindex="0" so keyboard users can scroll it.

Mon
Tue
Wed
Thu
Fri
Sat
Sun
Mon
Tue
Wed
Thu
Fri
<div class="pm-scroll-x" tabindex="0" role="region" aria-label="Weekly numbers"> <div class="pm-cluster" style="flex-wrap: nowrap; inline-size: max-content"> <div>Mon</div> <div>Tue</div> <div>Wed</div> <div>Thu</div> <div>Fri</div> <div>Sat</div> <div>Sun</div> <div>Mon</div> <div>Tue</div> <div>Wed</div> <div>Thu</div> <div>Fri</div> </div> </div>

Helpers

Aspect ratio

Keeps a box (image, video, map, embed) at a fixed ratio so nothing jumps when it loads. Set --pm-ratio.

<div class="pm-aspect" style="--pm-ratio: 21 / 9; max-inline-size: 24rem"></div>

Scroll area

A scrolling box with thin themed scrollbars; data-fade fades the edges where more content is hidden. --pm-scroll-height sets the height.

Ada signed in
Invoice 1042 paid
Grace joined the team
Plan changed to Pro
Export finished
Password updated
New comment on Roadmap
Backup completed
<div class="pm-scroll-area pm-stack" data-fade tabindex="0" role="region" aria-label="Activity" style="--pm-scroll-height: 9rem; --pm-gap: var(--pm-space-2)"> <div>Ada signed in</div> <div>Invoice 1042 paid</div> <div>Grace joined the team</div> <div>Plan changed to Pro</div> <div>Export finished</div> <div>Password updated</div> <div>New comment on Roadmap</div> <div>Backup completed</div> </div>

Disclosure

The native <details> element, styled: keyboard and screen-reader support come from the browser. For a group where one opens at a time, use Accordion.

Shipping and returns

Orders ship within two working days. Returns are free for 30 days.

<details class="pm-details"> <summary>Shipping and returns</summary> <p>Orders ship within two working days. Returns are free for 30 days.</p> </details>

Choice cards

Any radio or checkbox label becomes a selectable card with data-card. In components: variant="card" on a radio or checkbox group.

<div class="pm-choice-grid"> <label class="pm-check-label" data-card><input type="radio" class="pm-radio" name="u-plan" checked><span class="pm-check-text"><span>Monthly</span><span class="pm-check-desc">$12 per seat</span></span></label> <label class="pm-check-label" data-card><input type="radio" class="pm-radio" name="u-plan"><span class="pm-check-text"><span>Yearly</span><span class="pm-check-desc">$10 per seat, billed once</span></span></label> </div>

Description list

Label and value pairs on a native <dl>. Add data-divided for lines and data-layout="vertical" to stack.

Order
#1042
Status
Shipped
Total
$128.00
<dl class="pm-dl" data-divided> <div><dt>Order</dt><dd>#1042</dd></div> <div><dt>Status</dt><dd>Shipped</dd></div> <div><dt>Total</dt><dd>$128.00</dd></div> </dl>

Sticky header

Keeps a header or action bar in view while its section scrolls. --pm-sticky-offset leaves room for a fixed app bar, data-edge="bottom" pins a footer instead. Wrap the content in pm-sticky-inner to get a shadow only while it is stuck (browsers with scroll-state queries).

Invoices · 24

INV-1048

INV-1047

INV-1046

INV-1045

INV-1044

INV-1043

INV-1042

INV-1041

<div class="pm-scroll-area" tabindex="0" role="region" aria-label="Invoices" style="--pm-scroll-height: 12rem"> <header class="pm-sticky"><div class="pm-sticky-inner u-box">Invoices · 24</div></header> <p>INV-1048</p> <p>INV-1047</p> <p>INV-1046</p> <p>INV-1045</p> <p>INV-1044</p> <p>INV-1043</p> <p>INV-1042</p> <p>INV-1041</p> </div>

Sticky side column

A summary, filter list or table of contents that stays in view beside a long column (an order summary next to a checkout form). --pm-sticky-top is the distance from the top; it has no background of its own.

Step 1
Step 2
Step 3
<div class="pm-split" data-side="end" style="--pm-side: 12rem"> <div class="pm-stack"> <div>Step 1</div> <div>Step 2</div> <div>Step 3</div> </div> <aside class="pm-sticky-side"><div>Summary</div></aside> </div>

Pane

A column as tall as the screen allows, for chat and other screens where the list scrolls and the input stays put. pm-pane-body is the part that scrolls; --pm-pane-offset is the height of what is above and below the pane.

Header
Hello
How can I help?
An invoice is missing
Which month?
October
Found it
Message box
<div class="pm-pane" style="--pm-pane-offset: calc(100dvh - 14rem)"> <div>Header</div> <div class="pm-pane-body pm-scroll-area pm-stack" tabindex="0" role="region" aria-label="Messages"> <div>Hello</div> <div>How can I help?</div> <div>An invoice is missing</div> <div>Which month?</div> <div>October</div> <div>Found it</div> </div> <div>Message box</div> </div>

Table of contents

Links to the sections of a long page. Mark the section being read with aria-current (an IntersectionObserver does it in the article template).

<nav class="pm-toc" aria-label="On this page"> <a href="#stack">Stack</a> <a href="#grid" aria-current="true">Grid</a> <a href="#split">Split</a> </nav>

Placeholder art

A tinted box with an icon where a product photo or illustration will go, so a page looks finished before the images exist. data-tone picks the colour, data-size="sm" makes a thumbnail.

▲
●
■
<div class="pm-cluster"> <div class="pm-art" data-tone="accent" style="inline-size: 9rem">▲</div> <div class="pm-art" data-tone="success" style="inline-size: 9rem">●</div> <div class="pm-art" data-size="sm" data-tone="warning">■</div> </div>

Marquee

A slowly moving row (logos, quotes). It pauses on hover and focus, and becomes a row you scroll yourself when reduced motion is on. Repeat the items once so the loop is seamless, and hide the copy from screen readers.

Northwind
Contoso
Fabrikam
Tailspin
Adatum
<div class="pm-marquee" tabindex="0" role="group" aria-label="Customers"> <div class="pm-marquee-track"> <div>Northwind</div><div>Contoso</div><div>Fabrikam</div><div>Tailspin</div><div>Adatum</div> <span aria-hidden="true" style="display: contents"><div>Northwind</div><div>Contoso</div><div>Fabrikam</div><div>Tailspin</div><div>Adatum</div></span> </div> </div>

Floating action button

Add pm-fab to a button for the main action of a screen. It stays in the bottom corner, above the tab bar in native phone mode. data-position="start | center" moves it. (Shown in place here.)

<button class="pm-button pm-fab" data-icon aria-label="New message">+</button>

Visually hidden

Text for screen readers only: names for icon buttons, extra context in tables, skip links (it shows again when focused).

<button class="pm-button" data-icon>★<span class="pm-visually-hidden">Add to favourites</span></button>

Utility classes

Utility classes (opt-in)

One more stylesheet with 273 small classes for spacing, size, colour, corners, position and effects. It is not part of @prismora/css: import it when you want it. Every value is a theme token, so the classes follow your theme, dark mode and surface. They sit in the last cascade layer and win over component styles without !important.

import '@prismora/css'; import '@prismora/css/utilities.css';
pm-glow
pm-gradient-border
pm-shimmer
pm-dots
pm-grid-lines
pm-spotlight
<div class="pm-cols-3 pm-gap-4"> <div class="pm-glow pm-rounded-lg pm-p-5 pm-bg-surface">pm-glow</div> <div class="pm-gradient-border pm-rounded-lg pm-p-5">pm-gradient-border</div> <div class="pm-shimmer pm-rounded-lg pm-p-5 pm-bg-accent">pm-shimmer</div> <div class="pm-dots pm-border pm-rounded-lg pm-p-5">pm-dots</div> <div class="pm-grid-lines pm-border pm-rounded-lg pm-p-5">pm-grid-lines</div> <div class="pm-spotlight pm-border pm-rounded-lg pm-p-5 pm-hover-lift">pm-spotlight</div> </div>

Padding

Steps of the spacing scale: pm-p-4 all round, pm-px-4 left and right, pm-py-2 top and bottom, pm-pt-, pm-pb-, pm-ps- (start) and pm-pe- (end).

pm-p-0pm-p-1pm-p-2pm-p-3pm-p-4pm-p-5pm-p-6pm-p-8pm-p-10pm-p-12pm-p-16pm-px-0pm-px-1pm-px-2pm-px-3pm-px-4pm-px-5pm-px-6pm-px-8pm-px-10pm-px-12pm-px-16pm-py-0pm-py-1pm-py-2pm-py-3pm-py-4pm-py-5pm-py-6pm-py-8pm-py-10pm-py-12pm-py-16pm-pt-0pm-pt-1pm-pt-2pm-pt-3pm-pt-4pm-pt-5pm-pt-6pm-pt-8pm-pt-10pm-pt-12pm-pt-16pm-pb-0pm-pb-1pm-pb-2pm-pb-3pm-pb-4pm-pb-5pm-pb-6pm-pb-8pm-pb-10pm-pb-12pm-pb-16pm-ps-0pm-ps-1pm-ps-2pm-ps-3pm-ps-4pm-ps-5pm-ps-6pm-ps-8pm-ps-10pm-ps-12pm-ps-16pm-pe-0pm-pe-1pm-pe-2pm-pe-3pm-pe-4pm-pe-5pm-pe-6pm-pe-8pm-pe-10pm-pe-12pm-pe-16

Margin

pm-mt-4, pm-mb-4, pm-ms-2 (start), pm-me-2 (end), pm-m-0, and pm-mx-auto to centre a block. Prefer pm-stack and pm-gap-* for space between siblings.

pm-mt-0pm-mt-1pm-mt-2pm-mt-3pm-mt-4pm-mt-5pm-mt-6pm-mt-8pm-mt-10pm-mt-12pm-mt-16pm-mb-0pm-mb-1pm-mb-2pm-mb-3pm-mb-4pm-mb-5pm-mb-6pm-mb-8pm-mb-10pm-mb-12pm-mb-16pm-ms-0pm-ms-1pm-ms-2pm-ms-3pm-ms-4pm-ms-5pm-ms-6pm-ms-8pm-ms-10pm-ms-12pm-ms-16pm-me-0pm-me-1pm-me-2pm-me-3pm-me-4pm-me-5pm-me-6pm-me-8pm-me-10pm-me-12pm-me-16pm-m-0pm-mx-autopm-ms-autopm-me-autopm-mt-auto

Display and visibility

pm-hide-phone, pm-hide-tablet and pm-hide-desktop take a thing off one size of screen (under 40rem, 40 to 64rem, 64rem and up); pm-show-phone shows it on phones only.

pm-blockpm-inline-blockpm-inlinepm-flexpm-inline-flexpm-d-gridpm-nonepm-invisiblepm-hide-phonepm-hide-tabletpm-hide-desktoppm-show-phone

Flex and grid

pm-row and pm-col set the direction, pm-wrap lets items wrap, pm-flex-1 shares the free space. pm-cols-3 is a grid of three equal columns; pm-span-2 and pm-span-full size an item. (Alignment and gaps: pm-items-*, pm-justify-*, pm-gap-*.)

pm-rowpm-colpm-wrappm-flex-nowrappm-flex-1pm-flex-nonepm-self-startpm-self-centerpm-self-endpm-self-stretchpm-place-centerpm-justify-startpm-justify-aroundpm-justify-evenlypm-cols-1pm-cols-2pm-cols-3pm-cols-4pm-cols-5pm-cols-6pm-cols-12pm-span-2pm-span-3pm-span-4pm-span-6pm-span-fullpm-order-firstpm-order-last

Size

pm-w-full, pm-h-full, pm-h-screen (the visible screen, also on phones), pm-min-w-0 (lets a flex or grid child shrink), pm-max-w-sm to pm-max-w-xl and pm-max-w-prose, and fixed ratios.

pm-w-fullpm-w-autopm-w-fitpm-h-fullpm-h-screenpm-min-h-screenpm-min-w-0pm-max-w-xspm-max-w-smpm-max-w-mdpm-max-w-lgpm-max-w-xlpm-max-w-prosepm-ratio-squarepm-ratio-videopm-ratio-photopm-ratio-portraitpm-object-coverpm-object-contain

Background and border

Backgrounds of the theme (pm-bg-canvas, -surface, -subtle, -muted, -inverse), tinted ones (pm-bg-accent, -success, -warning, -danger, -info), and hairline borders.

pm-bg-canvaspm-bg-surfacepm-bg-subtlepm-bg-mutedpm-bg-inversepm-bg-accentpm-bg-successpm-bg-warningpm-bg-dangerpm-bg-infopm-bg-accent-solidpm-bg-success-solidpm-bg-warning-solidpm-bg-danger-solidpm-bg-info-solidpm-text-mutedpm-text-infopm-borderpm-border-strongpm-border-tpm-border-bpm-border-spm-border-epm-border-dashedpm-border-0pm-border-accentpm-border-successpm-border-warningpm-border-dangerpm-border-info

Corners and shadows

pm-rounded-sm to pm-rounded-2xl, pm-rounded-full, pm-rounded-none, and the six elevations pm-shadow-0 to pm-shadow-5. They follow the theme: a sharp theme stays sharp.

pm-rounded-xspm-rounded-smpm-rounded-mdpm-rounded-lgpm-rounded-xlpm-rounded-2xlpm-rounded-fullpm-rounded-nonepm-shadow-0pm-shadow-1pm-shadow-2pm-shadow-3pm-shadow-4pm-shadow-5pm-ringpm-opacity-50pm-opacity-70

Position and overflow

pm-relative, pm-absolute, pm-fixed, pm-inset-0, the corners (pm-top-0, pm-end-0…), pm-overflow-auto and -hidden, a sideways snap lane (pm-snap-x with pm-snap-start or pm-snap-center on the items) and pm-no-scrollbar.

pm-relativepm-absolutepm-fixedpm-staticpm-inset-0pm-top-0pm-bottom-0pm-start-0pm-end-0pm-z-0pm-z-1pm-z-10pm-isolatepm-overflow-autopm-overflow-hiddenpm-overflow-clippm-overflow-y-autopm-snap-xpm-snap-startpm-snap-centerpm-no-scrollbar

Safe areas

Padding that keeps content out from under a notch, rounded corners or the home indicator, on top of what you set with --pm-pad: pm-safe-top, pm-safe-bottom, pm-safe-x.

pm-safe-toppm-safe-bottompm-safe-x

Interaction

pm-pressable sinks a little when pressed, pm-hover-lift rises under the pointer (not on touch screens, and not with reduced motion), pm-pointer, pm-select-none, pm-events-none.

pm-pointerpm-select-nonepm-select-allpm-events-nonepm-transitionpm-pressablepm-hover-lift

Effects

Finishing touches for hero sections and cards: pm-glow, pm-gradient-border, pm-shimmer (a light sweeping over, for "new" or loading), pm-glass, pm-spotlight (a soft light; set --pm-spot-x and --pm-spot-y to follow the pointer), faded edges (pm-fade-x, pm-fade-y, pm-fade-bottom) and backdrops (pm-dots, pm-grid-lines).

pm-glowpm-gradient-borderpm-glasspm-spotlightpm-fade-xpm-fade-ypm-fade-bottompm-dotspm-grid-linespm-shimmer

JavaScript

Helpers

Small functions that every app ends up writing, tested and ready: 39 of them, with no dependencies. Import from @prismora/elements/utils, or one file at a time (@prismora/elements/utils/format); a bundler keeps only what you call. They do nothing on a server, so they are safe in code that also renders there.

import { hotkey, persisted, formatCurrency, fuzzyFilter, downloadCsv, debounce } from '@prismora/elements/utils'; // Open search with Cmd+K or Ctrl+K. Call the returned function to remove the shortcut. const off = hotkey('mod+k', () => palette.show()); // Remember a choice across reloads and tabs. const density = persisted('orders:density', 'comfortable'); density.subscribe((value) => table.density = value); // Search as the reader types, without a request per key. search.addEventListener('pm-input', debounce((e) => { table.rows = fuzzyFilter(orders, e.detail.value, ['customer', 'email']); }, 200)); formatCurrency(1234.5, 'EUR'); // "€1,234.50" downloadCsv('orders', table.rows); // orders.csv

Browser utils/dom

Keyboard shortcuts (mod+k, sequences like g o), copying, media queries and breakpoints, visibility, scroll lock, focus trap, long press and swipe. Each returns the function that undoes it, for your framework's cleanup hook.

hotkeyhotkeyLabelcopyTextwatchMediabreakpointwatchBreakpointprefersReducedMotioninViewlockScrollfocusabletrapFocuslongPressswipe

Stored state utils/storage

A value that survives a reload, follows other tabs and can be subscribed to: table density, a dismissed tip, the last filter.

persisted

Formatters utils/format

Numbers, money, sizes, durations, dates, relative time and lists in the reader's language, on top of Intl.

formatNumberformatCurrencyformatPercentformatCompactformatBytesformatDurationformatDateformatRelativeformatListinitialspluralize

Lists utils/collection

Sort the way people read ("item 2" before "item 10"), group, total, split into pages and search with typos forgiven.

sortBygroupByuniqueBysumBychunkfuzzyScorefuzzyFilter

Files utils/download

Save rows as CSV (quoted properly, and safe against spreadsheet formulas in user input), JSON or any text.

toCsvdownloadCsvdownloadJsondownloadFile

Timing utils/timing

Rate limiters for search fields, autosave, scroll and resize handlers.

debouncethrottlesleep

Related

Text utilities are on the Typography page. The app shell (pm-app with a sidebar that becomes a tab bar or drawer on phones) is covered in Mobile, and tokens for spacing, radius and elevation in Tokens.