Ui Behaviors
Published by perimetre in framework
What this skill does
Builds components in a Périmètre app from @perimetre/ui-behaviors, the behaviours and primitives Périmètre adds to UI SDK. Covers a lens that magnifies under the pointer, a 360 or frame-by-frame viewer you drag and play, a store locator that links a list to a map, Google Places address fields and Google Maps for the locator, an accessible Icon, plus the behaviours underneath (createFollowPoint, createScrub, createAutoProgress, createLinkedHighlight) for components nobody ships. Use whenever a pr
Add Ui Behaviors to your agent
Review the source and files first. When you are ready, copy the prompt instruction or use the CLI command supported by your environment.
Install with a prompt
Paste this into a compatible coding agent:
add this skill "ui-behaviors" from https://github.com/perimetre/frameworkInstall with the CLI
Run this command in a controlled environment after reviewing the repository:
npx skills add https://github.com/perimetre/framework --skill ui-behaviorsSkill instructions
Build with @perimetre/ui-behaviors
@perimetre/ui-behaviors adds behaviours, primitives and utilities to UI SDK. The app owns its components and builds them from these.
This skill covers only what differs from UI SDK. For definePrimitive, createParts, styling, the agent bridge and tests, follow UI SDK's skill.
Read first
- UI SDK's skill:
node_modules/@ui-sdk/core/skills/ui-sdk/SKILL.md, orgh api repos/vercel-labs/ui/contents/packages/core/skills/ui-sdk/SKILL.md -H "Accept: application/vnd.github.raw". - The types of what you import.
node_modules/@perimetre/ui-behaviors/dist/**/*.d.tshas JSDoc for every option, reason, part and CSS variable. It is the API reference. - The story of what you use. One sits next to each entry, as its shortest working example:
node_modules/@perimetre/ui-behaviors/src/primitives/sequence/sequence.stories.tsx. The source of each entry is in the same folder.
Pick your path
| You need | Read |
|---|---|
| A lens, a 360 viewer or a store locator | references/primitives.md |
| Something close to one of those, or a component of your own | references/behaviors.md |
| An address field with Google's suggestions, or a Google map for a locator | references/google.md |
Start from a primitive when one fits. When the parts or the rules differ, write your own primitive from the behaviours. Import a behaviour, never copy its code into the app: a copy misses every later fix.
Entries
Every folder is its own entry. There is no root import.
Import from @perimetre/ui-behaviors/… | What it holds |
|---|---|
primitives/magnify | magnify, createMagnifyController |
primitives/sequence | sequence, createSequenceController |
primitives/locator | locator, createLocatorController |
behaviors/follow-point | createFollowPoint |
behaviors/scrub | createScrub, normalizeProgress |
behaviors/auto-progress | createAutoProgress, prefersReducedMotion |
behaviors/linked-highlight | createLinkedHighlight |
behaviors/google-map | bindGoogleMap, bindGoogleMarker |
utilities/google-places | createPlacesSession |
utilities/geo | sortByDistance, distanceBetween, isInBounds |
utilities/geolocation | requestGeolocation |
utilities/accessible-icon | accessibleIcon, visuallyHidden |
react/icon | Icon, IconProps |
No entry has "use client", so a Server Component can import any of them. Only react/icon needs React.
Rules
- The app owns the component. Write it in the app's components folder. This package has no components to import, apart from
Icon. - Name the parts for the app as you destructure them:
const { Root: ProductSpin, Viewport: ProductSpinViewport } = createParts(sequence, { … }). - Style from the app's design tokens. The app defines its own tokens in its stylesheet (
@themein Tailwind CSS v4). A component reads those, never a raw colour, radius or shadow. Add the token to the app when one is missing. - Merge classes with
cnfrom thecnpackage. It replacesclsxandtailwind-merge, so use neither. - Wrap every svg in
Icon, fromreact/icon. Give the app's icon componentsIconProps, and passaria-hiddenor alabelwhere the icon is used, never where it is declared. - Every label comes from the app's translations. Nothing here renders text. The one exception is the "Google Maps" attribution, which Google's terms fix.
- Never bump UI SDK alone. This package pins one exact version as a peer.
- Test what you wired, not what you imported. The behaviours and primitives are tested in this package. In the app, follow UI SDK's
references/testing.mdfor the component's name, labels and callbacks, and add its agent test.
Agents
Each primitive declares its agent key, so UI SDK's bridge finds it with no extra code:
| Primitive | Actions | Notes |
|---|---|---|
magnify | setActive, moveTo | |
sequence | setValue, stepBy, play, pause | |
locator | setValue, setHighlighted | closed: the value is one of its places, listed by name |
The bridge lists primitive instances only. A behaviour or a utility reaches an agent through the primitive that uses it, and Icon never does. A primitive you write yourself needs its own agent: { actions: [...] }.
Files included
- references/behaviors.md
- references/google.md
- references/primitives.md
- SKILL.md

