google/xb-uiblocks
>- Build rich spatial UI with the uiblocks addon — flexbox-laid-out 3D cards/panels (`UICard`, `UIPanel`, `UIText`, `UIImage`, `UIIcon`) with gradients, strokes, rounded corners, drop/inner shadows, and spatial behaviors (head-leash, billboard, grab/manipulate, object-anchor). Use when you need web-like styling fidelity or real flexbox layout beyond the lightweight core `xb.SpatialPanel`. Requires `options.uikit.enable(uikit)` and the `@pmndrs/uikit` peer deps. The complete reference (styling rules, behaviors, gotchas, troubleshooting) lives at src/addons/uiblocks/SKILL.md.
npx skills add https://github.com/google/xrblocks --skill xb-uiblocks
uiblocks wraps @pmndrs/uikit (yoga flexbox) for styled 3D cards. Use it over the core
xb-ui SpatialPanel when you need flexbox layout, gradients, strokes,
or shadows. Don't mix the two on one panel, and never import UIPanel/UICard from
xrblocks core — they exist only in this addon.
> Full reference (UICard/UIPanel/UIText/UIImage/UIIcon props, behaviors, sizing gotchas,
> and a clicks/styling/sizing troubleshooting playbook):
> ../../src/addons/uiblocks/SKILL.md. Samples:
> src/addons/uiblocks/samples/.
Needs the @pmndrs/uikit + yoga/troika peer deps in your importmap (see the addon
README) and:
const options = new xb.Options();
options.enableUI();
options.uikit.enable(uikit); // REQUIRED — registers the uikit renderer
import * as uikit from '@pmndrs/uikit';
import * as THREE from 'three';
import {UICore, UIPanel, UIText, raycastSortFunction} from 'uiblocks';
import * as xb from 'xrblocks';
class CustomScript extends xb.Script {
constructor() {
super();
this.uiCore = new UICore(this);
}
init() {
// REQUIRED for raycasting against uiblocks to work.
if (xb.core.input.raycaster) {
xb.core.input.raycaster.sortFunction = raycastSortFunction;
}
const card = this.uiCore.createCard({
name: 'HelloCard',
sizeX: 1.0,
sizeY: 0.6,
position: new THREE.Vector3(0, 1.5, -1),
width: 'auto',
alignItems: 'center', // shrink-wrap + center (see full ref §5.1)
});
const panel = new UIPanel({
width: '100%',
height: '100%',
fillColor: '#1a1a24',
cornerRadius: 20,
padding: 30,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
});
card.add(panel);
panel.add(
new UIText('Hello World', {
fontSize: 32,
fontWeight: 'bold',
color: 'white',
})
);
}
}
strokeWidth/strokeColor, not borderWidth/borderColor.'#ffffff') or THREE.Color — never rgba()/hsla().UIPanel + child UIText/UIIcon/UIImage.UICard per spatial pivot; partition complex layouts with child UIPanels + flexbox.For multi-section, polished interfaces, follow the design guide in §6 of the full reference
(../../src/addons/uiblocks/SKILL.md). The essentials:
pixelSize (density), a small fontSize/fontWeight type scale, aspacing scale (gap/padding multiples of one unit), one–two cornerRadius values, and a
restrained hex palette — then reuse them everywhere.
UICard; partition intosections with nested UIPanels + flexbox (flexDirection, justifyContent, flexGrow).
dropShadow*, innerShadow*, andstrokeWidth/strokeColor (shared cornerRadius) — avoid large literal position.z offsets.
xb.user.height / -xb.user.panelDistance; keep opaqueenough fillColor + a shadow/stroke to read over AR passthrough; size text for distance.
ToggleAnimationBehavior for enter/exit, hover/pressstates for feedback, gentle lerp on HeadLeashBehavior/BillboardBehavior.
ManipulationBehavior({draggable, faceCamera, manipulationMargin}) with aheader as the grab handle; ObjectAnchorBehavior (+ billboard) for contextual, object-attached UI.
See §6.7 of the full reference for a complete, styled settings-card example.
Take google/xb-uiblocks from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.