xcookbook · components

Wave 1 — form controls. Styling resolves from each component's registered node (x.classes groupings).

XButton — variant × color

to (link)

Inputs

Shown on your public profile.

That address is already taken.

£
@example.com

Grows as you type.

XSelect

Choices

Wave 2 — layout + feedback

A card
title/description are content props — slot twins + block values.
Badges + status
(this card is variant=soft)
primaryneutralsuccesswarningdanger solid activependingfailedbespoke
instance classes
Nothing here yet
An XEmpty with an action slot.

Wave 2.5 — XApi (renderless data)

Wave 3 — overlays + navigation

The overview panel — each tab is a named slot keyed by the option value.

XForm — the form engine

Bare controls auto-bind through XFormField names (labels derive from them too). Live validation after the first attempt; an email containing 'taken' triggers a server-shaped error.

Try an address containing 'taken'.

…from OUTSIDE the form — the native form attribute (the slideover-footer fix).

XForm — entity mode

no row = insert (Create) · a row with an id = update (Save)
The fields derive from the baked forms.json — controls, labels, required marks and the status/type enum options all come off the bake (checklist plumbing skipped). The database is injected (no DB here): a name containing 'taken' answers a server-shaped 400. The title field shows a per-field slot override. File Id is the x.file() control (batch 4): XUpload → the file row id (the transport is injected here; wired for real it POSTs /api/v1/files/upload).
Drop files here or click to browse
mm
dd
yyyy

XSpinner

Wave 4 — data components

NameEmailStatusLogins
Ada Lovelaceada@example.comactive42
Grace Hoppergrace@example.compending17
Edsger Dijkstraedsger@example.comarchived5
Margaret Hamiltonmargaret@example.comactive88
XList: one rows contract, `is` swaps the semantic rendering.
  • Ada Lovelace
  • Grace Hopper
  • Edsger Dijkstra
  • Margaret Hamilton
page 1 of 7 — speaks the API envelope ({ total, page, pages, limit }).

Wave 5 batch 1 — toast · stat · details · divider · guard · expose · avatar

Revenue
£48,230 12.4vs last month
Churn
2.1% 0.4
Loading
Name
Ada Lovelace
Email
ada@example.com
Cookbook
/x/cookbook
ALGH·
ALtyping…
Guarded content
Flip the switch — overlay mode blurs this and centres the overlay slot.

Secret things live here.

Wave 5 batch 2 — icon · mask · date · multi-select · attribute

XIcon — any of the Iconify catalogue via @nuxt/icon.

mask: ##-##-##

mm
dd
yyyy

multiple

XAttribute
key + operator + value rows → the XWhere DSL, live.
{}

Wave 5 batch 3 — the editor cluster (lazy chunks, SSR shells)

export function greet(name: string) {
  // a comment
  return `Hello ${name}`
}

CodeMirror 6, theme from the tokens, grammar by name.

Rendered ⇆ code toggle; the code view is an XCode.

Sanitised in and out; the element itself is editable.

The tiptap editor — try selecting and typing. v-model is HTML.

tiptap + StarterKit; mode=inline drops the chrome.

Wave 5 batch 4 — XUpload (useXUploader)

The default transport POSTs the live /api/v1/files/upload route and resolves the inserted file row — this demo injects a ticking fake (no server needed).

Drop files here or click to browseimage/*,.pdf · up to 5.0 MB

Wave 5 batch 4b — media (XImage · XVideo · XEmbed · XFile)

demodemo filtered
a-very-long-export-of-everything-2026-06-10-final-FINAL-v2.csv471 KB
portrait.png2.3 MB
linked-by-id.pdf100 KB

A file-entity row's id derives the download link (/api/v1/files/:id/download) — same bridge on XImage :file (a row or a row id → src).

Wave 5 batch 4 stretch — XCropper (cropperjs v2)

SSR paints the plain image (no CLS); cropperjs mounts into its own chunk. The v-model is the crop box in natural image px — the file row's cropX/cropY/cropWidth/cropHeight columns, spoken bare. @crop fires on commit; Save PATCHes the file row through useXDatabase('file') — the database is injected here (no DB), answering the patched row back.

crop box: —

Wave 5 batch 5 — showcase chrome + css-as-data

xcookbook — gates
$npm run gates
typecheck · lint · 368 tests · bake · smoke
smoke green — the module boots, serves its pages
$git commit
$
localhost:3210/x/components
Components
56 8this session

This paragraph is styled by an XCss block — css-as-data rendered into a live style tag.

…and this one by XStyle — style-as-data on the element itself.

XChallenge — one control, four guards (slide · pin · code · hold)

The v-model is the resolved boolean — set it false to rearm. pass/fail report verdicts; a pin without expected hands the entry to the parent via @code. The code type's verifier is injected here (no backend) — the default posts the live 2FA endpoint.

slide — slide to unlock (drag, or arrow keys / End)

Slide to confirm

hold — press and hold (the delete-guard pattern)

pin — local verify (the pin is 2468; a wrong entry fails + clears)

pin — parent verify (no expected: @code hands over; 1357 passes)

code — authenticator (injected verifier; 246810 passes after a beat)

Enter the 6-digit code

XColorMode — the dark-mode toggle

One control over useXColorMode(): light / dark / system, persisted in the x-color-mode cookie so the server renders <html class="dark"> in the initial payload (no flash). The baked theme's .dark { --x-* } scope and Tailwind's dark: variant both ride the one class; system follows the OS live.

mode system → resolved light

XChart · KPI stats · XFacets · XShare — the Lane G batch

XChart lazy-chunks Chart.js behind an SSR shell; the palette and text/grid colours read off the live --x-* tokens at mount (authored dataset colours win). The SAME config object becomes an email-embeddable image via quickChartUrlOf. XStat's chart prop is the KPI sparkline; XFacets rides the facets crud op (here an injected fetcher) and speaks XWhere; XShare is the native sheet with a clipboard + toast fallback.

No data yet

the same config as a QuickChart image URL: https://quickchart.io/chart?c=%7B%22type%22%3A%22line%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22Jan%22%2C%22Feb%22%2C%22Mar%22%2C%22Apr%22%2C%22May%22%2C%22Jun%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Signups%22%2C%22data%22%3A%5B12%2C19%2C14%2C27%2C32%2C41%5D%7D%2C%7B%22label%22%3A%22Churn%22%2C%22data%22%3A%5B3%2C5%2C2%2C6%2C4%2C5%5D%7D%5D%7D%7D&w=600&h=300&bkg=white

Signups
41 9
Active
1,204users 12
Loading KPI
Status
No values
Type
No values
{
  "selection": {
    "status": [
      "active"
    ]
  },
  "where": {}
}

XGraphic — the konva graphic editor

Canva/Polotno posture: pages of elements on a Konva stage — drag with smart guides, transform, marquee/multi-select, align, z-order, undo/redo, inline text editing, page presets — exporting to PNG, multi-page PDF, webm video and the document JSON (which IS the v-model).

Empty page — add elements from the toolbar.
Document
Preset
W / H
Page
Name
Fill
Seconds

Reference — every registered component

Generated from the baked kitchen manifest (the same nodes the Studio and the form layer read) — 75 components. Props marked “model” are the v-model; “content” props take a string or an XBlock tree.

XAlert
loader #default #title #icon @close
prop type default
colorprimary | neutral | success | warning | danger"neutral"
variantsoft | solid | outline"soft"
titlecontent (string | block)
descriptioncontent (string | block)
iconstring
closablebooleanfalse
classesjson
XApi
loader #default #loading #error #empty
prop type default
fetchjson
immediatebooleantrue
XAttribute
loader @where
prop type default
modelValue (model)json
keysjson
operatorsjson
classesjson
XAuth
loader #default #fallback
prop type default
rulejsontrue
XAutomationBuilder
loader @save
prop type default
modelValue (model)json
bakedbooleanfalse
savingbooleanfalse
classesjson
XAutomationList
loader @open @refresh
prop type default
entitystring"automation"
rowsjson
loadingbooleanfalse
classesjson
XAvatar
loader
prop type default
srcstring
namestring
altstring
sizesm | md | lg | xl"md"
shapecircle | square"circle"
classesjson
XBadge
loader #default
prop type default
colorprimary | neutral | success | warning | danger"neutral"
variantsolid | soft | outline"soft"
sizesm | md | lg"md"
classesjson
XButton
loader #default #prepend #append
prop type default
variantsolid | soft | outline | ghost | link"solid"
colorprimary | neutral | success | warning | danger"primary"
sizesm | md | lg"md"
typebutton | submit | reset"button"
disabledbooleanfalse
loadingbooleanfalse
blockbooleanfalse
prependcontent (string | block)
appendcontent (string | block)
iconstring
tostring
classesjson
XCard
loader #default #header #footer
prop type default
variantoutline | elevated | soft"outline"
titlecontent (string | block)
descriptioncontent (string | block)
classesjson
XChallenge
loader #label @pass @fail @code
prop type default
modelValue (model)boolean
typeslide | pin | code | hold"slide"
labelcontent (string | block)
lengthnumber
expectedstring
maskedbooleantrue
padbooleantrue
pendingTokenstring
durationnumber1500
sizesm | md | lg"md"
colorprimary | neutral | success | warning | danger"primary"
disabledbooleanfalse
classesjson
XChart
loader #empty
prop type default
configjson
sparklinebooleanfalse
heightnumber256
loadingbooleanfalse
emptycontent (string | block)
classesjson
XChat
loader #empty #message #avatar @reply @error
prop type default
assistantstring
regardingjson
threadstring
placeholderstring"Message…"
heightstring
streambooleantrue
classesjson
XCheckbox
loader #default
prop type default
modelValue (model)boolean
labelstring
sizesm | md | lg"md"
disabledbooleanfalse
indeterminatebooleanfalse
classesjson
XChrome
loader #default
prop type default
isbrowser | window | phone"browser"
urlstring
titlestring
classesjson
XCode
loader
prop type default
modelValue (model)string
langstring"javascript"
readonlybooleanfalse
lineNumbersbooleantrue
classesjson
XColorMode
loader
prop type default
variantsolid | soft | outline | ghost | link"ghost"
colorprimary | neutral | success | warning | danger"neutral"
sizesm | md | lg"md"
classesjson
XComponentDoc
loader
prop type default
componentstring
classesjson
XContainer
loader #default
prop type default
sizesm | md | lg | xl | full"xl"
paddedbooleantrue
classesjson
XCropper
loader #actions @crop @saved @error
prop type default
srcstring
filejson
modelValue (model)json
aspectstring
altstring
disabledbooleanfalse
savebooleanfalse
classesjson
XCss
loader
prop type default
cssjson
scopestring
classesjson
XDatePicker
loader
prop type default
modelValue (model)date
variantoutline | filled | underline"outline"
sizesm | md | lg"md"
disabledbooleanfalse
classesjson
XDefaults
loader #default
prop type default
propsjson
XDesigner
loader @voiceover @render
prop type default
modelValue (model)json
presetstring"video"
titlestring
savedstring
speakingbooleanfalse
renderingbooleanfalse
classesjson
XDetails
loader #value @copy
prop type default
rowsjson
loadingbooleanfalse
classesjson
XDivider
loader #default
prop type default
orientationhorizontal | vertical"horizontal"
labelcontent (string | block)
classesjson
XDocs
loader #default #aside
prop type default
optionsjson
classesjson
XDrawer
loader #default #trigger #footer #title
prop type default
open (model)boolean
titlecontent (string | block)
descriptioncontent (string | block)
sideleft | right | top | bottom"right"
classesjson
XEditor
loader
prop type default
modelValue (model)string
modeinput | inline"input"
editablebooleantrue
classesjson
XEmbed
loader
prop type default
srcstring
titlestring
ratiostring"16/9"
sandboxstring"allow-scripts allow-same-origin allow-popups allow-forms"
allowstring
roundedbooleantrue
lazybooleantrue
classesjson
XEmpty
loader #title #description #action
prop type default
titlecontent (string | block)"Nothing here yet"
descriptioncontent (string | block)
iconstring
classesjson
XExpose
loader #default
prop type default
open (model)json
optionsjson
multiplebooleanfalse
memoryjsonfalse
classesjson
XFacets
loader @where
prop type default
entitystring
columnsjson
wherejson
refinebooleanfalse
modelValue (model)json
classesjson
XFile
loader #default #actions @remove @download
prop type default
filejson
namestring
sizenumber
mimestring
urlstring
loadingbooleanfalse
removablebooleanfalse
classesjson
XForm
loader #default #footer @submit @success @error @reset
prop type default
modelValue (model)json
actionstring
methodpost | put | patch"post"
validatesubmit | live"submit"
draftjsonfalse
historybooleanfalse
timeoutnumber
idstring
entitystring
rowjson
fieldsjson
excludejson
classesjson
XFormField
loader #default
prop type default
labelstring
hintstring
errorstring
requiredbooleanfalse
namestring
classesjson
XGraphic
loader
prop type default
modelValue (model)json
presetpresentation | presentation-4x3 | instagram-post | instagram-story | facebook-post | x-post | linkedin-post | youtube-thumbnail | a4 | a4-landscape | video | video-vertical"presentation"
editablebooleantrue
toolbarbooleantrue
panelsbooleantrue
pagebarbooleantrue
snapbooleantrue
filesbooleantrue
savedownload | files | both"download"
maxHistorynumber50
classesjson
XGrid
loader #default
prop type default
colsjson
gapnone | xs | sm | md | lg | xl"md"
classesjson
XGuard
loader #default #fallback #overlay
prop type default
whenbooleantrue
modeblock | overlay"block"
classesjson
XHeartRate
loader
prop type default
speedslow | normal | fast"normal"
classesjson
XHtml
loader @change
prop type default
modelValue (model)string
editablebooleanfalse
trustedbooleanfalse
classesjson
XIcon
loader
prop type default
namestring
sizexs | sm | md | lg | xl"md"
classesjson
XImage
loader
prop type default
srcstring
filejson
altstring
widthnumber
heightnumber
sizesstring
ratiostring
fitcover | contain"cover"
filtersstring
roundedbooleantrue
lazybooleantrue
classesjson
XIndicator
loader
prop type default
typetyping | cursor"typing"
classesjson
XInput
loader #prepend #prefix #suffix #append @clear
prop type default
modelValue (model)string
typetext | email | password | number | search | url | tel"text"
variantoutline | filled | underline"outline"
maskstring
placeholderstring
sizesm | md | lg"md"
prefixcontent (string | block)
suffixcontent (string | block)
prependcontent (string | block)
appendcontent (string | block)
iconstring
disabledbooleanfalse
readonlybooleanfalse
clearablebooleanfalse
classesjson
XList
loader #item #empty @rowClick
prop type default
rowsjson
islist | table | grid"list"
labelKeystring
loadingbooleanfalse
emptycontent (string | block)
classesjson
XManage
loader
prop type default
entitystring
readonlybooleanfalse
excludejson
classesjson
XMarkdown
loader
prop type default
modelValue (model)string
modedisplay | edit"display"
classesjson
XMenu
loader #trigger #option @select
prop type default
optionsjson
classesjson
XModal
loader #default #trigger #footer #title
prop type default
open (model)boolean
titlecontent (string | block)
descriptioncontent (string | block)
sizesm | md | lg | full"md"
classesjson
XNav
loader #option
prop type default
optionsjson
orientationhorizontal | vertical"horizontal"
classesjson
XPagination
loader
prop type default
page (model)number
totalnumber0
perPagenumber20
classesjson
XPing
loader #default
prop type default
showbooleantrue
colorprimary | neutral | success | warning | danger"danger"
positiontop-right | top-left | bottom-right | bottom-left"top-right"
classesjson
XPopover
loader #default #trigger
prop type default
sidetop | right | bottom | left"bottom"
alignstart | center | end"center"
classesjson
XRadio
loader #option
prop type default
modelValue (model)string
optionsjson
orientationvertical | horizontal"vertical"
sizesm | md | lg"md"
disabledbooleanfalse
classesjson
XSelect
loader #option
prop type default
modelValue (model)json
optionsjson
sourcejson
labelKeystring
valueKeystring"id"
multiplebooleanfalse
placeholderstring"Select…"
variantoutline | filled | underline"outline"
sizesm | md | lg"md"
disabledbooleanfalse
clearablebooleanfalse
classesjson
XServiceSchematic
loader
prop type default
entitystring"service"
rowjson
classesjson
XServiceWizard
loader @refresh
prop type default
entitystring"service"
rowjson
classesjson
XShare
loader #default @share
prop type default
titlestring
textstring
urlstring
variantsolid | soft | outline | ghost | link"outline"
colorprimary | neutral | success | warning | danger"neutral"
sizesm | md | lg"md"
disabledbooleanfalse
classesjson
XSkeleton
loader
prop type default
classesjson
XSpinner
loader
prop type default
sizesm | md | lg"md"
classesjson
XSpreadsheet
loader #empty @edit
prop type default
modelValue (model)json
columnsjson
fieldsjson
readonlybooleanfalse
loadingbooleanfalse
emptycontent (string | block)
classesjson
XStack
loader #default
prop type default
directionvertical | horizontal"vertical"
gapnone | xs | sm | md | lg | xl"md"
alignstart | center | end | stretch | baseline
justifystart | center | end | between | around
wrapbooleanfalse
classesjson
XStat
loader #default #prefix #suffix #prepend #append
prop type default
labelstring
valuecontent (string | block)
deltanumber
unitstring
chartjson
prefixcontent (string | block)
suffixcontent (string | block)
prependcontent (string | block)
appendcontent (string | block)
loadingbooleanfalse
classesjson
XStatus
loader #default
prop type default
valuestring
colorsjson
variantsolid | soft | outline"soft"
sizesm | md | lg"md"
classesjson
XStyle
loader #default
prop type default
valuejson
isstring"div"
classesjson
XSwitch
loader #default
prop type default
modelValue (model)boolean
labelstring
sizesm | md | lg"md"
disabledbooleanfalse
classesjson
XTable
loader #empty @rowClick @sort
prop type default
rowsjson
columnsjson
sort (model)json
selectablenone | one | many"none"
selected (model)json
rowKeystring"id"
loadingbooleanfalse
emptycontent (string | block)
classesjson
XTabs
loader #default
prop type default
modelValue (model)string
optionsjson
variantboxed | underline | pill"boxed"
classesjson
XTerminal
loader
prop type default
linesjson
promptstring"$"
animatebooleantrue
speednumber28
loopbooleanfalse
classesjson
XTextarea
loader
prop type default
modelValue (model)string
rowsnumber3
variantoutline | filled | underline"outline"
sizesm | md | lg"md"
placeholderstring
disabledbooleanfalse
readonlybooleanfalse
autoresizebooleanfalse
classesjson
XToaster
loader
prop type default
positiontop-right | top-left | top-center | bottom-right | bottom-left | bottom-center"bottom-right"
classesjson
XTooltip
loader #default
prop type default
textcontent (string | block)
sidetop | right | bottom | left"top"
classesjson
XUpload
loader #default #upload @select @success @error @reject @progress
prop type default
urlstring"/api/v1/files/upload"
multiplebooleanfalse
acceptstring
maxFilesnumber
maxFileSizenumber
autoUploadbooleantrue
globalstring
disabledbooleanfalse
classesjson
XVideo
loader
prop type default
srcstring
providerauto | youtube | vimeo | stream | native"auto"
posterstring
ratiostring"16/9"
controlsbooleantrue
autoplaybooleanfalse
mutedbooleanfalse
loopbooleanfalse
roundedbooleantrue
lazybooleantrue
classesjson