expressive prop.Quaff.init({ expressive: true });A plain object works for fixed settings. For runtime changes, pass a $state object or getters. This applies to expressive, rtl, language, locale, and translations.
Import a language pack and pass it to Quaff.init() in your root layout. It
supplies the UI text for QTable, QDate, QTime, QSelect, and QSearch, along with the
locale for date and time formatting, the calendar's first weekday, the clock's hour
cycle, and table sorting. English (en-US) is the default.
import { Quaff } from "@quaffui/quaff";
import frFR from "@quaffui/quaff/locales/fr-FR";
Quaff.init({ language: frFR });Each pack is a separate import, so unused languages stay out of your bundle. Available BCP
47 locales are ar-SA, bn-BD, cs-CZ, da-DK, de-DE, el-GR, en-US, es-ES, fa-IR, fi-FI, fil-PH, fr-FR, he-IL, hi-IN, hu-HU, id-ID, it-IT, ja-JP, ko-KR, mr-IN, ms-MY, nb-NO, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, sv-SE, sw-KE, ta-IN, te-IN, th-TH, tr-TR, uk-UA, ur-PK, vi-VN, zh-CN, and zh-TW.
Use locale to override regional formatting, or translations for optional wording changes; omitted entries keep the selected pack's text. Existing component
props such as locale, labels, cancelLabel, and noOptionText take precedence. Custom packs use the exported QuaffLanguage type.
For language switching, pass a $state configuration object to Quaff.init() once, then update its language property. When
configuration comes from props, use getters so it stays current. Keep the same initial
configuration for server rendering and hydration, and set your page's lang and dir attributes to match your application.
rtl: true for RTL or false for LTR. Omit it to manage
direction with HTML dir attributes.Quaff.init({ rtl: true });See Right-to-left layouts for setup, local overrides, and live examples.
version property. This property returns a string with the version number.The Quaff framework provides a very simple way to manage dark mode with the darkMode property of the Quaff class.
isActive property and manage it using the set and toggle methods. The set method sets dark
mode according to the given boolean value and the toggle method toggles dark mode. Dark mode is also persistent across page reloads and sessions as it stores the current display mode in local storage.
Quaff.screen provides reactive, read-only viewport dimensions and size
flags using MD3 boundaries: 600/840/1200/1600px. Call Quaff.init() once
during root layout setup, including in client-only apps. Read screen properties directly
in markup or inside $derived.
Quaff.screen.width; // Viewport width in CSS pixels
Quaff.screen.height; // Viewport height in CSS pixels
Quaff.screen.name; // "xs" | "sm" | "md" | "lg" | "xl"
Quaff.screen.sizes; // { sm: 600, md: 840, lg: 1200, xl: 1600 }
Quaff.screen.md; // Only md: 840px up to, but excluding, 1200px
Quaff.screen.lt.md; // Below md: less than 840px
Quaff.screen.gt.md; // Above md: at least 1200px
Quaff.screen.ready; // Whether viewport measurements are available
Quaff.screen.navigation; // "navbar" below 600px, otherwise "railbar"
Quaff.screen.twoPane; // true from 840px
const expanded = $derived(!Quaff.screen.lt.md); // md or wider: at least 840pxThe xs, sm, md, lg, and xl flags each match exactly one size class. lt supports sm/md/lg/xl; gt supports xs/sm/md/lg. gt.md means above the entire md class; !lt.md includes md from 840px.
Until the root layout mounts, width and height are 0, name is "xs", and ready is false. Live viewport updates begin on mount. This
keeps the initial server render and hydration consistent.
Quaff.getScreen(width, height?) returns a ScreenState with the
same properties for a container; height defaults to 0. It is pure and needs
no Quaff.init(). Derive it from a measured width with $derived.
A valid width, including 0, makes ready true; undefined or invalid widths leave it false. See adaptive layouts for container sizing, navigation, and list/detail examples.
Quaff.screen replaces Quaff.breakpoints. Initialize it with Quaff.init() in your root layout. The md/lg/xl thresholds also change from 960/1280/1920px
to 840/1200/1600px; sm stays at 600px.
const screen = $derived(Quaff.screen);
screen.width; // Was breakpoints.currentWidth
screen.name; // Was breakpoints.current
screen.sizes.md; // Was breakpoints.md (now 840px)
// Comparisons using the new thresholds, once screen.ready is true:
!screen.lt.md; // Was isMoreThan("md", true)
screen.width > screen.sizes.md; // Was isMoreThan("md")
screen.lt.sm; // Was isLessThan("sm")
screen.width <= screen.sizes.sm; // Was isLessThan("sm", true)The old methods compared against a class's starting width. screen.gt.md instead means above the whole md class, starting at 1200px. To keep comparisons false before
mounting, guard them with screen.ready, for example screen.ready && screen.lt.sm.
Quaff provides a handle to Sveltekit's page state with its router property. This allows you to easily access and react to route changes
or query parameters. Here's what it looks like for the current page:
{
"data": {},
"error": null,
"form": null,
"params": {},
"route": {
"id": "/utils/quaff"
},
"shallow": null,
"state": {},
"status": 200,
"url": "http://sveltekit-prerender/utils/quaff/"
}