DocsDesign

Components

A component is a board whose layers define a reusable piece: a button, a menu item, an item slot. An instance is a copy of it on a screen. Edit the component and every instance follows.

Open a component from the gallery, see its variants in every state, then change an instance’s text from its properties.

Create one

Select a layer and press Ctrl Alt K, or choose Create component in the right-click menu. The layer becomes a component board, and the original spot holds an instance of it.

To place an instance, press Shift I and pick a component. To make a frame behave as a button (states and click actions), turn on Interactive in the inspector’s Interact tab.

Variants

Components that belong to the same set and differ in variant values are variants. In The Last Hunt · UI kit v2, the Button set has a Style (Primary, Secondary, Danger, Ghost), a State (Default, Focus, Pressed, Disabled) and a Size (Small, Medium, Large): 48 variants. Switch an instance between them with the lists in the inspector’s Instance section, or pick any component under Swap.

On a component, the Main component section adds a variant property, sets this variant’s values, and has Add variant, Duplicate and Delete.

Properties

Properties let an instance change what it’s meant to change, in one field. Add them on the component, under Properties: + Text, + Boolean or + Instance swap.

Type What it does
Text Replaces {prop.Label} in the component’s text layers. Pick a text layer under Show in text layer…, or type {prop.Label} in one
Boolean Shows or hides target layers (a badge, a meta line, a glyph)
Instance swap Swaps a nested instance for another component (a different glyph or icon)

The kit’s Menu item has Label, Meta and Show meta. On 02 Main menu, each item sets them: Continue shows “Chapter III”, New hunt hides its meta line. An instance shows one field per property in the inspector.

Overrides

Anything else can be overridden per instance: a layer’s text, fill, visibility, image, states, click actions or bindings. Double-click a layer inside an instance to edit it. Overrides are stored on the instance by the path of the layer inside the component, and survive changes to the component. A dot marks an overridden property.

The Instance section has three buttons: Edit main component goes to the component board, Reset all overrides clears them, and Detach instance (Ctrl Alt B) turns the instance into plain layers.

Button states

Buttons have hover, pressed and disabled states, each a small patch: fill, border color, text color, scale and opacity. Set them in the Interact tab’s States section. Keyboard and gamepad focus use the hover look, plus an optional focus ring (see Keyboard and gamepad focus). Preview each state on the canvas from the pill at the bottom left of the canvas, before any code exists.

Hover and pressed also work on frames, text and the other layers, with the same States section. Only buttons take keyboard and gamepad focus. A layer with a hover or pressed look takes the pointer, so it stops clicks from reaching the layers under it.

Hover, tooltips and sound

All of this is in the Interact tab and works on any layer. A layer that sits inside a button never reacts, because the button takes the pointer. Document checks warn about it (hover-in-button).

Tooltips

Press + next to Tooltip to add one.

Field Meaning
Text The words. It takes data like {item.cost}
Key A translation key, to translate the tooltip. See Localization
Look Plain box, or a component to draw instead. If the component has a text property named text, the tooltip’s text fills it
Delay Milliseconds before it shows. 400 by default
Side Above, Below, Left or Right. It moves to the opposite side when only that one has room
"tooltip": { "text": "Costs {item.cost} gold", "key": "shop.cost", "delay": 400, "side": "top" }

A tooltip shows when the pointer rests on the layer, and when a button has keyboard or gamepad focus, so gamepad players see it too. Only one shows at a time. It sits above everything, never takes input, and goes away on a press, a screen change and while a text field is in use. A disabled layer still shows its tooltip, so you can say why it is locked. The canvas shows no tooltips; Preview and the game do.

Hover actions

On hover and On hover end run actions when the pointer comes over a layer and when it leaves, the same actions as On click. Only the pointer runs them, not focus. A game hears them as events, like any other.

"events": { "enter": [ { "type": "emit", "event": "card_in" } ], "leave": [ { "type": "emit", "event": "card_out" } ], "hover": { "delay": 150, "throttle": 500 } }

Hover timing appears once a layer has hover actions. Delay is how long the pointer must stay before On hover runs; leaving first cancels it. Throttle is the least time between two runs. On hover end runs only if On hover ran. A layer that goes away, because the screen changed, a list rebuilt or the document reloaded, sends no hover end. On hover doesn’t run on a disabled layer.

Sounds

Add sound files in Assets › Sounds: upload them or drop them there. It takes wav, ogg and mp3 files up to 8 MB each, plays them, shows where each one is used, and deleting one clears its uses after a warning. Sounds are embedded in the document and count toward the 64 MB limit that images share. In the Interact tab, Sounds plays one on Hover, Press and, on buttons, Focus. Each has a picker (None, your sounds, or Upload a sound…), a volume in percent and a play button. The Play sound action plays one from any action list, such as On click.

"sounds": { "hover": { "asset": "snd_…", "volume": 0.5 }, "press": { "asset": "snd_…" } }

A disabled layer is silent. A focus sound plays when the player moves focus, not when your code focuses a button. Envy only starts sounds. Your game owns the mix, so each runtime lets you pick the audio bus or mixer group, mute Envy’s own playback, or take a sound over and play it yourself: see Godot, Unity and Web. Each keeps six players, so a sound that is still ringing isn’t cut off until seven overlap. A sound that is missing or can’t be decoded is reported once and never breaks the UI.

The canvas is silent. Preview plays sounds and has a mute button. The contract lists every sound and who plays it.

The Components page

Components (G C) lists every component. Pick one to see it in four tabs:

Tab What it shows
Variants Every variant of the set
Show states The component in its hover, pressed and disabled looks
Playground An instance with its properties and variants to try
Usage Every screen and layer that uses it

Filter components in the sidebar searches as you type. It is fuzzy, so pbn finds Play button, and it reads the component’s name, its variants’ names, its category and its description. Enter opens the best match and Esc clears the filter. Search the kit on Add from kit works the same way, and each kit component says whether it is already in your document and how many instances use it.

An animation belongs to a screen, so a component’s page has Animate on a screen. It opens a screen that uses the component with that instance selected and the timeline open. If no screen uses it yet, place an instance on a screen first.

Packs

A pack is a .envy-pack.json file that carries chosen components to another project. It holds the components with what they use: nested components, variant sets, color tokens, text styles, images, sounds and the embedded fonts of the families they use. It holds no screens, animations or sample data. Runtimes don’t read packs. The envy pack command is something else: it writes a .envy project.

Packs live in Components › Add from kit, in the sidebar’s Library group.

Export. Under This document, tick the components, type a Pack name (it starts as “project name pack”) and press the export button. It reads Pick components to export until you tick one, then Export 3 components with the number you ticked.

Import. Under Packs, press Open a pack and pick the file. Envy reads it as untrusted input and refuses a file that is over 64 MB, has more than 500 components or 50,000 layers, or doesn’t check out, with a message that says why. A pack you open stays in the Packs list until you close the editor, with an Add button. The Add dialog counts what is inside and lists the clashes. Nothing changes until you press Add to this document.

Every item the pack adds gets a new id. These clash with the document: a component with the same name, a color token with the same name and another value, a text style with the same name and other settings. Pick what happens to each:

Choice What happens
Keep both The default. The pack’s item comes in under a new name, and the pack’s layers use that copy
Skip The document’s item stays, and the pack’s layers use it
Replace The pack’s item overwrites the document’s. Instances follow, and keep their overrides where a layer of the same name sits in the same place

Tokens and text styles with the same content are shared, and so is an image or sound the document already holds. After a Skip or Replace, an override, a property target or an animation track can point at a layer the component that stays doesn’t have. The dialog lists each one, and Envy drops them. Replace is refused when it would make a component contain itself. An import is one undo step.

The pack has no screens or animations, so actions that go to them (goto, push, play) are left out when you export, and so are focus links to layers outside the component.

In the runtimes

Every runtime expands instances before drawing, with the same algorithm (resolve.ts on the web, envy_resolve.gd in Godot, EnvyResolve.cs in Unity). Layers inside an instance get ids like instanceId/sourceId, which animations can target.

Updated View as Markdown