---
title: "Editing Affordances"
description: "Resolve capability flags and inspector sections for a selected element so your editor panel is element-aware."
---
`resolveElementAffordances` answers the question "what can the user do with this element right now?" given a live DOM element and its SDK model entry. It returns two objects: `capabilities` (boolean flags for each edit action) and `sections` (which inspector panels apply). You use these to conditionally render controls in your editor's detail panel rather than showing a fixed field set for all elements.
This API lives on the `@hyperframes/sdk/editing` subpath, available since `@hyperframes/sdk@0.7.22`. If the import fails to resolve, upgrade: `npm install @hyperframes/sdk@latest`.
## Import
```typescript
import { resolveElementAffordances } from "@hyperframes/sdk/editing";
```
## Signature
```typescript
function resolveElementAffordances(
liveEl: HTMLElement,
modelEl: Pick | null,
ctx?: AffordanceContext,
): EditingAffordances
```
- `liveEl` — a live, laid-out `HTMLElement` from the composition iframe. The resolver calls `getComputedStyle` on it, so it must be attached to a rendered document.
- `modelEl` — the SDK model element (`comp.getElement(id)`), or `null` when the element exists in the live DOM but not in the SDK source model (generated elements). Passing `null` restricts affordances: style editing is disabled and `reasonIfDisabled` is set.
- `ctx` — optional context for studio-specific concepts. For most custom editors, omit it or leave all flags at their defaults (`false`).
### `AffordanceContext`
```typescript
interface AffordanceContext {
isCompositionHost?: boolean; // default false
isCompositionRoot?: boolean; // default false
isInsideLockedComposition?: boolean; // default false
isMasterView?: boolean; // default false
}
```
These flags are studio-specific. In a standalone custom editor you can omit `ctx` entirely.
## Return value
```typescript
interface EditingAffordances {
capabilities: DomEditCapabilities;
sections: EditingSectionApplicability;
}
```
### `capabilities`
```typescript
interface DomEditCapabilities {
canSelect: boolean;
canEditStyles: boolean;
/** Directly editable authored left/top style fields. */
canMove: boolean;
/** Directly editable authored width/height style fields. */
canResize: boolean;
/** Canvas translate-drag maps here, not to canMove. */
canApplyManualOffset: boolean;
canApplyManualSize: boolean;
canApplyManualRotation: boolean;
/** Set when canEditStyles / canMove / canResize is false; explains why. */
reasonIfDisabled?: string;
}
```
`canMove` and `canResize` indicate that the element has authored `left`/`top`/`width`/`height` style values that can be directly edited as fields. A canvas drag operation maps to `canApplyManualOffset`, not `canMove`. Do not gate drag handles on `canMove`.
### `sections`
```typescript
interface EditingSectionApplicability {
text: boolean; // true when the element has editable text content
media: boolean; // true for