Decide what the editor offers with cesdk.features: which features exist,
where they show, and what they offer.

Features decide what the editor UI offers. They do not limit what your code can do: cesdk.actions.run() and engine calls work whatever a feature says. Use cesdk.features to hide the delete button for locked blocks, switch off text decoration, or show a control only in some contexts. Unlike the Component Order API, which arranges the components of one area, a feature applies everywhere in the editor at once.
Features drive only the CE.SDK UI. A custom UI that you build on the engine alone has no cesdk.features, so gate its controls in your own code.
This guide covers how to switch features on, switch options off, change settings, narrow or extend where a feature shows, read features, define your own feature and read features in a custom component.
Features, Options and Settings#
A feature is one thing a user recognizes: text, crop, fill, the dock. Its id is ly.img.text, ly.img.crop, ly.img.fill or ly.img.dock.
An option is something the user can do inside a feature. Text has the options fontSize, alignment and decoration. Crop has rotation, flip and scale. Options nest by what they belong to, so ly.img.text has an option path, and path has the option curve.
A setting is a value that an option offers. The font size presets [12, 14, 18], the alignments Left and Center, and crop’s open are settings. Take the sentence: the user can change the stroke style to Dotted. Changing the stroke style is an option. Dotted is a setting value.
Every level has the same shape: enabled switches it on or off, when says where it shows, options holds the nested options, and every other key is a setting.
Switch Features On#
The editor starts empty. Built-in features start off, and an editor configuration such as DesignEditorConfig switches on what it offers. Call cesdk.features.configure() to switch on more.
// The editor starts empty. The editor configuration switches on what it offers.await cesdk.addPlugin(new DesignEditorConfig());Pass an object with feature ids as keys. Each entry is an object, so write { enabled: true }. A bare true throws and names the fix.
// Built-in features start off. Switch on the ones this editor offers.cesdk.features.configure({ 'ly.img.preview': { enabled: true }, 'ly.img.rulers': { enabled: true }});A feature that is off turns off everything inside it. The last write wins, so a later call overrides an earlier one. An unknown id throws. Add the plugin that defines the feature first, or check the spelling.
Switch Options Off#
Options start on, except lineWidth in ly.img.shape. When a feature is on, its options are on. List an option in options and write enabled: false to switch it off. Nest options the same way they nest in the feature.
// Options start on. Switch off the ones the editor should not offer.cesdk.features.configure({ 'ly.img.text': { options: { decoration: { enabled: false }, path: { enabled: false } } }});This switches off the decoration controls and text on a path. The rest of text keeps working.
Change Settings#
A setting takes a value or a function. A plain value replaces what is there. A function receives the rule context and previous, the value so far, so two functions both apply, one after the other. Write a function so that it gives the same result when your setup runs twice, for example when it runs again after resetEditor(): previous.includes(x) ? previous : [...previous, x].
// A setting takes a value, or a function that gets the value before it.cesdk.features.configure({ 'ly.img.crop': { open: 'manual' }, 'ly.img.text': { options: { fontSize: { presets: [12, 14, 18, 24, 36] }, alignment: { alignments: ({ previous }) => previous.filter((alignment) => alignment !== 'Auto') } } }});Prefer the function form when you remove a value. previous.filter(…) keeps the values that a later CE.SDK version adds. A fixed list does not. A value that does not match the setting’s schema throws and names the valid values. A function that throws or returns such a value is skipped: the setting keeps the value before it, and the console logs the error.
Set Where a Feature Shows#
The when rule decides where a feature shows. It is a function that receives { engine, blockId, selection, features } and returns a boolean. It can also be the id of an action that you registered with cesdk.actions. A rule must answer synchronously.
blockId is the block the caller asked about. CE.SDK never fills it in from the selection, and selection is always the full selection.
A rule that reads selection judges the selection, not the block. A when that says selection.length === 1 gives the same answer for every blockId while one block is selected, and a feature can be available for block 3 when only block 9 is selected. To ask about the block, test it against the selection:
cesdk.features.configure({ 'ly.img.crop': { when: { narrow: ({ blockId, selection }) => selection.includes(blockId!) } }});requires is the other way round: it reads blockId, because it states what that block can do.
You can write when in three ways:
| Write | Effect |
|---|---|
when: rule |
Replaces the rule, and resets every narrow and extend written before it. |
when: { narrow: rule } |
Adds a condition that must also hold. |
when: { extend: rule } |
Adds a place where the feature shows, never past a narrow. |
The result is: the base rule or any extend, and every narrow. Apart from a replace, the order of your writes does not matter.
Narrow a Feature#
A narrow is what you want in most cases. It keeps the rule that ships with CE.SDK and adds your condition. Here a block with the locked metadata cannot be deleted.
// A narrow adds a condition that must hold. Locked blocks cannot be deleted.engine.block.setMetadata(subtitleBlock, 'locked', 'true');cesdk.features.configure({ 'ly.img.delete': { when: { narrow: ({ engine, blockId }) => blockId == null || !engine.block.hasMetadata(blockId, 'locked') } }});Extend a Feature#
An extend adds a place where the feature shows. The built-in fill controls do not show for stickers. This extend adds them for a single selected sticker.
// An extend adds a place where the feature shows. Fill now also shows for stickers.cesdk.features.configure({ 'ly.img.fill': { when: { extend: ({ engine, blockId, selection }) => selection.length === 1 && blockId != null && engine.block.getKind(blockId) === 'sticker' } }});Replace a Rule#
A rule written as when: rule replaces the built-in rule. Here opacity shows for creators only, and for a single selected block.
// A rule replaces the built-in one. Opacity is for creators, on a single block.cesdk.features.configure({ 'ly.img.opacity': { when: ({ engine, selection }) => selection.length === 1 && engine.editor.getRole() === 'Creator' }});After a replace, your rule is the only one. Repeat any built-in condition you still need. Write replaces first, and narrows and extends after them.
A narrow is not a lock. Any later when: rule on the same feature resets every narrow written before it, and a plugin or another part of your app can write one. Features hide controls: to keep something from happening, check in your actions or use engine scopes.
Options follow the when of their parent. A narrow on a feature reaches every option that inherits. An option can write its own rule to extend beyond its parent, or write when: 'inherit' to follow the parent again. Only options take 'inherit': a feature has no parent to follow.
An option with its own when stands apart: a narrow on its parent does not reach it. In get(id).options, an option that follows its parent has when.base set to 'inherit'. Any other value stands apart. Write when: 'inherit' on it to bring it back, or narrow the option itself.
What requires Means#
A built-in feature also has a requires rule. It states what the feature needs to work at all, such as a block that supports fills. It always applies, it cascades to every option, and configure() cannot override it. It is not a lock: it reports what the editor cannot do. Product choices belong in when.
Regions, Buttons and Containers#
The regions ly.img.dock, ly.img.navigation.bar, ly.img.inspector.bar, ly.img.canvas.menu and ly.img.canvas.bar are features. A region decides whether and when it shows. What sits inside it comes from the order of its components. To add, remove or move a button, use the Component Order API. See Reorder Components.
Buttons and UI containers are not features. A container, such as a context menu or a panel section, shows when something inside it renders. To hide a container, switch off what is inside it. The inspector and the Document panel follow the same rule. A menu whose entries come from a component order, such as the canvas menu or the timeline clip menu, shows while one of its entries would draw, and is disabled while none of them can be used. A component of your own always counts as drawing, so it keeps the menu showing. To hide a menu outright, empty its order with cesdk.ui.setComponentOrder, in each context that has an order of its own, such as each clip type of the timeline clip menu.
Read a Feature#
Four methods read features. evaluate() and explain() work a feature out for a block. get() and list() show the feature as you configured it and run no rule.
Evaluate#
evaluate() returns the same tree as the feature, with a status on every level and the settings as final values. The status is 'off', 'unavailable' or 'available'.
// evaluate works a feature out for a block: a status per level and the final settings.const text = cesdk.features.evaluate('ly.img.text', { blockId: titleBlock});console.log('Text:', text.status);console.log('Decoration:', text.options.decoration.status);console.log('Font sizes:', text.options.fontSize.presets);'off' means switched off with enabled: false, or inside something that is. 'unavailable' means switched on, but requires or when says no here. 'available' means the UI offers it.
Pass blockId for features that work per block. Without it, the rules get no block, and a built-in feature that works per block throws, for example ly.img.text works per block: pass { blockId }. Features without a block, such as the dock, need none. The Feature Reference marks which features work per block. To ask whether the feature is available, compare status === 'available'. To ask whether it is switched on, use get(id).enabled.
Explain#
explain() answers the question why something is not showing. It returns the tree of evaluate(), with a reason on every level that is not available.
// explain says why a level is not available, and who decided it.const reason = cesdk.features.explain('ly.img.delete', { blockId: subtitleBlock});console.log('Delete:', reason.status, reason.reason, reason.rule);The reason is one of these:
reason |
Meaning |
|---|---|
'switched-off' |
The level is written enabled: false. |
'requires' |
Its requires said no. feature names a feature it depends on that failed. |
'when' |
Its when said no. rule says whether the base or a narrow decided. |
'parent' |
The parent is off or fails requires. The parent’s own entry has the real reason. |
by names who wrote the deciding rule: 'app' for calls from your app or a plugin, 'sdk' for built-in features, 'settings' for the settings panel, and 'legacy' for writes through the old cesdk.feature API. inherited is true when the level follows the when of its parent and the parent’s rule said no. rule and by then describe that rule.
Inspect#
get() returns a feature as configured: enabled, requires, when as { base, extend, narrow }, options, and every setting as { schema, value }. list() returns every feature the same way, so one call shows the whole tree.
// get returns the feature as configured, list returns all of them. No rule runs.const crop = cesdk.features.get('ly.img.crop');console.log('Crop switched on:', crop.enabled);console.log('Crop opens:', crop.open.value);console.log( 'All features:', cesdk.features.list().map((feature) => feature.id));Define Your Own Feature#
A plugin defines its own features, and an integrator defines features for custom components. Defining an id that is already defined throws. Define the feature before anything configures it.
Add plugins that define or configure features one after another, with await cesdk.addPlugin(a) and then await cesdk.addPlugin(b). Do not add them in parallel, for example with Promise.all. CE.SDK credits a write to the plugin whose initialize is running, so two plugins that run at once get each other’s writes.
A definition has these keys:
id,titleanddescription. An id cannot contain*. The title and description are plain English for docs and agents. End users never see them.enabledis the starting value. Left out, it istrue, so the feature works as soon as your plugin is added.requiresis what the feature needs to work at all. It receivesfeatures, so it can depend on another feature withfeatures.evaluate().whenis the starting rule for where it shows.optionsholds the nested options.- Every other key declares a setting with JSON Schema and a
default.
Name a feature after what it lets people do, never after the UI that shows it, such as a panel or a bar, because that UI may change. The built-in features for the editor’s areas are the exception: the navigation bar, inspector bar, canvas bar, canvas menu, dock and inspector are features named after the area.
The names enabled, when, options, requires, title and description are the keys of a definition. The names id, status, reason, by, rule, feature, inherited and renderedIn are reserved for the results of evaluate() and explain(). A setting cannot use any of them. The schema supports type, enum, minimum, maximum, items, properties and additionalProperties.
Type the Feature#
In TypeScript, add the feature to FeatureRegistry. define(), configure(), evaluate(), explain() and get() accept only the ids in the registry, so code that uses your id does not compile without the entry. The entry also types the options and settings, and define() checks the definition against it: a missing, extra or mistyped setting or option does not compile. Write the definition with as const satisfies FeatureDefinition, and derive the shape with FeatureShapeOf, so you write the schema only once. A plugin adds its own entries when you import it.
// Declare the feature once. Settings are JSON Schema with a default.const stampFeature = { id: 'my.guide.stamp', title: 'Stamp', description: 'Stamping a block with a label.', requires: ({ engine, blockId }) => blockId != null && engine.block.supportsFill(blockId), labels: { type: 'array', items: { enum: ['Draft', 'Approved', 'Rejected'] }, default: ['Draft', 'Approved', 'Rejected'] }} as const satisfies FeatureDefinition;
// TypeScript accepts only registered ids, so add the feature to the registry.declare module '@cesdk/cesdk-js' { interface FeatureRegistry { 'my.guide.stamp': FeatureShapeOf<typeof stampFeature>; }}Define and Configure#
Call define() with the definition. Then configure() accepts the feature id, and the compiler checks the setting values.
// Define the feature before anything configures it.cesdk.features.define(stampFeature);cesdk.features.configure({ 'my.guide.stamp': { enabled: true, labels: ['Draft', 'Approved'] }});Read Features in a Custom Component#
A custom component reads features with cesdk.features.evaluate() and re-renders when a feature changes. A menu built from a component order counts your component as drawing, even when it renders nothing.
// The component re-renders when the feature changes.cesdk.ui.registerComponent( 'my.guide.stamp.canvasMenu', ({ builder, engine }) => { const [blockId] = engine.block.findAllSelected(); const stamp = cesdk.features.evaluate('my.guide.stamp', { blockId }); if (stamp.status !== 'available') return;
builder.ButtonGroup('stamp-labels', { children: () => { stamp.labels.forEach((label) => { builder.Button(`stamp-${label}`, { label, onClick: () => engine.block.setName(blockId, label) }); }); } }); });cesdk.ui.insertOrderComponent( { in: 'ly.img.canvas.menu', position: 'end' }, 'my.guide.stamp.canvasMenu');The component shows its buttons only when the feature is available for the selected block. Switching the feature off, or selecting a block that fails requires, hides the group.
Recipes#
Switch Between Modes#
To switch between modes, such as a basic and a pro mode, write the same features in every mode. A plain enabled write replaces the one before it, so each mode states its full answer and switching back needs no cleanup. enabled is the hard switch: a feature that is off turns off everything inside it, whatever a when says.
import type { FeatureConfiguration } from '@cesdk/cesdk-js';
const modes = { basic: { 'ly.img.crop': { enabled: false }, 'ly.img.text': { options: { decoration: { enabled: false } } } }, pro: { 'ly.img.crop': { enabled: true }, 'ly.img.text': { options: { decoration: { enabled: true } } } }} satisfies Record<string, FeatureConfiguration>;
function setMode(mode: keyof typeof modes) { cesdk.features.configure(modes[mode]);}Do not switch modes with when narrows. Narrows pile up, and the earlier mode’s narrow stays in force.
Change a Rule Over Time#
No call withdraws one write or resets a feature to its starting state. Write one rule that reads the state instead, and change the state. Here a narrow reads a metadata key on the block.
cesdk.features.configure({ 'ly.img.delete': { when: { narrow: ({ engine, blockId }) => !engine.block.hasMetadata(blockId!, 'my-app/protected') } }});
cesdk.engine.block.setMetadata(3, 'my-app/protected', 'true');cesdk.engine.block.removeMetadata(3, 'my-app/protected');The editor and your components update when a rule’s engine reads change, such as block metadata. A rule that reads a plain variable is not run again when the variable changes, so keep such state in the engine.
Feature Reference#
CE.SDK defines these built-in features. All of them start off. Each entry shows the id, whether evaluate() and explain() need a blockId, and what the feature governs. A feature marked per block throws without a blockId. An editor-wide feature needs none, except for the options named next to it.
ly.img.adjustment(per block): Adjusting brightness, contrast, saturation and similar properties of an image or video.ly.img.animations(per block): Adding in, out and loop animations to a block.ly.img.blendMode(per block): Choosing how a block blends with the layers below it.ly.img.blur(per block): Blurring an image or video.ly.img.canvas.bar(editor-wide): The bar with the page controls on the canvas.ly.img.canvas.menu(editor-wide): The menu next to the selected block.ly.img.combine(editor-wide): Merging several selected shapes into one with a boolean operation.ly.img.crop(per block): Cropping the content of a block: size, rotation, flip, fill mode, scale and position.ly.img.cutout(per block): Editing the type, offset and smoothing of a cutout.ly.img.delete(per block): Deleting the selected blocks or pages.ly.img.dock(editor-wide): The bar of buttons that open the asset libraries and panels.ly.img.documentSettings(editor-wide): The settings of the whole document, such as its pages, unit and layout.ly.img.duplicate(per block): Duplicating, copying, cutting and pasting blocks and pages.ly.img.effect(per block): Applying visual effects such as pixelize or glow to an image or video.ly.img.exclusionArea(per block): The settings of an exclusion area block.ly.img.fill(per block): Filling a block with a color, a gradient, an image or a video.ly.img.filter(per block): Applying color filters to an image or video.ly.img.group(editor-wide): Grouping blocks, ungrouping, entering a group and selecting its group.ly.img.inspector(editor-wide): The side panel with the properties of the selected block.ly.img.inspector.bar(editor-wide): The bar with the controls of the selected block.ly.img.keyboard.shortcuts(editor-wide): The editor keyboard shortcuts.ly.img.layerList(editor-wide): The panel that lists pages and layers: select, show or hide, lock, rename and reorder them.ly.img.library(editor-wide): The asset library and dragging assets out of it onto the canvas.ly.img.navigation.bar(editor-wide): The bar at the top of the editor.ly.img.notifications(editor-wide): The notifications the editor shows, for example after undo and redo.ly.img.opacity(per block): Changing how transparent a block is.ly.img.page(editor-wide;moveper block): Adding, moving and resizing pages, page spreads, and their layout, bleed, print marks and safety margin.ly.img.placeholder(per block): The Placeholder panel, where a template author chooses what an adopter may change on a block.ly.img.playbackSpeed(per block): Changing how fast a video or audio clip plays.ly.img.position(editor-wide): Changing the stacking order of blocks and aligning or distributing them.ly.img.preview(editor-wide): Switching to the preview, the Adopter view of the design.ly.img.replace(per block): Replacing the image, video, shape or audio of the selected block.ly.img.rulers(editor-wide): The rulers along the canvas and the grid settings.ly.img.settings(editor-wide): The settings panel, for trying out editor options such as theme, role and language while you build.ly.img.shadow(per block): Adding a drop shadow: color, offset and blur.ly.img.shape(per block): Changing the geometry of a shape: corner radius, points, sides and editing its path.ly.img.stroke(per block): Outlining a block: color, width, style, position, corners and line caps.ly.img.text(per block): Editing text and caption blocks: font, size, style, alignment, lists, text on a path and background.ly.img.timing(per block): Typing the start and duration of a block, and the duration of a page.ly.img.transform(per block): Changing the position, size, rotation and flip of a block.ly.img.transitions(editor-wide): Adding transitions between two adjacent clips.ly.img.trim(per block): Trimming the start and length of a video or audio clip.ly.img.vectorEdit(editor-wide): Editing the points and curves of a vector path.ly.img.video.caption(editor-wide): Adding and editing captions on a video.ly.img.video.timeline(editor-wide): The timeline below the canvas: tracks, clip controls, playback and zoom.ly.img.volume(per block): Changing the volume of a video or audio clip and muting it.
cesdk.features.list() returns the full tree of every feature with its options and settings. Plugins define their own features, such as ly.img.plugin-ai-image-generation-web. They show up in list() after you add the plugin.
Troubleshooting#
A Feature Does Not Show#
Call cesdk.features.explain(id, { blockId }) and read the reason.
'switched-off': switch the feature on withconfigure({ [id]: { enabled: true } }). The editor starts empty, so every feature you want must be switched on.'when': a rule says no. Readruleandbyto find who wrote it.'requires': the block or the engine cannot do it.featurenames a dependency, if one failed.'parent': the parent feature is off or failsrequires. Look at the parent’s entry.'error': a rule threw, returned something other than a boolean, or reads a feature that reads it back.errorhas the message, and the console logs it once. Fix the rule; the feature and everything inside it stay unavailable until then.
configure() Throws#
configure() checks every write. It throws for an unknown id, a dotted key such as 'ly.img.text.fontSize', a bare boolean, an unknown option or setting, a value that fails its schema, and requires. The message names the fix. Nest options inside options.
evaluate() Throws “Works Per Block”#
The message ly.img.text works per block: pass { blockId } means that the feature reads the block you ask about. Pass the block: cesdk.features.evaluate(id, { blockId }). The Feature Reference marks these features.
API Reference#
| Method | Signature | Purpose |
|---|---|---|
cesdk.features.define() |
define(definition: FeatureDefinitionOf<K>): void |
Create a feature |
cesdk.features.configure() |
configure(configuration: FeatureConfiguration): void |
Switch features and options, change settings and rules |
cesdk.features.get() |
get(id): ConfiguredFeature |
Read a feature as configured, without running a rule |
cesdk.features.list() |
list(): ConfiguredFeature[] |
Read every feature as configured |
cesdk.features.evaluate() |
evaluate(id, options?: { blockId?: DesignBlockId }): EvaluatedFeature |
Work out a status per level for a block |
cesdk.features.explain() |
explain(id, options?: { blockId?: DesignBlockId }): FeatureExplanation |
Say why a level is not available |
Next Steps#
- Show/Hide Components - Hide UI elements without switching a feature off
- Reorder Components - Add, remove and move buttons
- Create Custom Components - Build components that read features
- Canvas Menu - Customize the canvas context menu
- Inspector Bar - Customize the inspector bar