# UI/UX Engine > Framework-independent interface components. One serializable definition per component drives React, Figma and declarative specs. Engine 0.4.0. A spec names a component by its full id; Engine components also accept their alias. Validate specs before rendering them. ## Components ### engine.button (alias `button`) Triggers an action. Renders a native button. - Use primary for the single most important action in a view, secondary for other actions, ghost in dense toolbars, danger for destructive actions. - Labels are short verbs or verb phrases, for example 'Run analysis'. - Icon-only buttons need an accessibleLabel that says what the button does. - Use loading while the action runs. The button stays focusable and ignores presses. - Size is local to the button. Density comes from the surrounding application, never from a prop. Events: `press`. Install: `npm install @uiuxengine/react` Example spec: ```json {"component":"engine.button","props":{"label":"Button"},"slots":{"leadingIcon":{"type":"icon","id":"plus"},"trailingIcon":{"type":"icon","id":"chevron-down"}}} ``` ### engine.input (alias `input`) A single line of text that a person types. Takes part in forms like a native input. - Name every input: put it in a field, or use accessibleLabel or a label element that points at its id. - The placeholder is an example of what to type, not a label, and it disappears as a person types. - Act on valueCommit, when a person leaves the field or presses Enter, rather than on every keystroke. - Set invalid while the host shows a validation message for it. The input doesn't set it by itself. Events: `valueChange` (value), `valueCommit` (value). State a spec may set: `value`. Install: `npm install @uiuxengine/react` Example spec: ```json {"component":"engine.input","props":{"placeholder":"Placeholder","accessibleLabel":"Input"},"slots":{"leadingIcon":{"type":"icon","id":"envelope"}}} ``` ### engine.menu-item (alias `menu-item`) One command in a menu. - Use only inside a menu. - Labels are short verbs or verb phrases, for example 'Duplicate'. End with an ellipsis when the command asks for more before it runs, for example 'Rename…'. - Values are unique within a menu and stay the same when labels change; the menu reports the value of the item that was pressed. - Disable an item that can't run now rather than removing it. It stays focusable, so people still find it and hear that it's unavailable. Install: `npm install @uiuxengine/react` Example spec: ```json {"component":"engine.menu-item","props":{"label":"Menu item","value":"value"}} ``` ### engine.menu (alias `menu`) A button that opens a list of commands. Pressing an item runs its command; a menu holds no value. - Use for commands, for example 'Duplicate' or 'Archive'. Links that navigate, such as site navigation, belong in a navigation list, not a menu. - The trigger's label names the group of commands, for example 'Actions'. An icon-only trigger needs an accessibleLabel. - Keep menus short and flat. Put the commands people use most first. - A command that needs confirmation or more input opens a dialog from itemPress. The menu has closed and focus is on its trigger by then. Events: `itemPress` (value), `openChange` (open). State a spec may set: `open`. Install: `npm install @uiuxengine/react` Example spec: ```json {"component":"engine.menu","props":{"label":"Actions"},"slots":{"items":[{"component":"engine.menu-item","props":{"value":"duplicate","label":"Duplicate"}},{"component":"engine.menu-item","props":{"value":"rename","label":"Rename…"}},{"component":"engine.menu-item","props":{"value":"archive","label":"Archive"}}]}} ``` ### engine.option (alias `option`) One choice in a select's list. - Use only inside a select. - Values are unique within a select and stay the same when labels change; the label is what people read. - Disable an option that can't be chosen now rather than removing it, so the list keeps its shape. Install: `npm install @uiuxengine/react` Example spec: ```json {"component":"engine.option","props":{"label":"Option","value":"value"}} ``` ### engine.select (alias `select`) Chooses one option from a list that opens below a button. Takes part in forms like a native select. - Use for choosing one of several known options. For two options, consider a switch or radio buttons. - Name every select: put it in a field, or use accessibleLabel or a label element that points at its id. In a spec, a field or accessibleLabel names it. - The placeholder says what to choose, for example 'Choose a region'. It isn't a label. - Set invalid while the host shows a validation message for it. The select doesn't set it by itself. - Keep options short. Long lists scroll; a select is not a search field. Events: `valueChange` (value), `openChange` (open). State a spec may set: `value`, `open`. Install: `npm install @uiuxengine/react` Example spec: ```json {"component":"engine.select","props":{"placeholder":"Choose an option","accessibleLabel":"Select"},"slots":{"options":[{"component":"engine.option","props":{"value":"apple","label":"Apple"}},{"component":"engine.option","props":{"value":"banana","label":"Banana"}},{"component":"engine.option","props":{"value":"cherry","label":"Cherry"}}]}} ``` ### engine.field (alias `field`) Gives one control a visible label, a description and an error message, and relates them to it. - Use a field for every input or select that has a visible label. - Keep the label short. Put instructions and formats in the description. - Set invalid and error together while the host shows why the value is wrong. Say how to fix it. Install: `npm install @uiuxengine/react` Example spec: ```json {"component":"engine.field","props":{"label":"Label","description":"Description","error":"Error message"},"slots":{"control":{"component":"engine.input","props":{"placeholder":"Placeholder"}}}} ``` ## Blocks ### engine.empty-state (alias `empty-state`) Says that a view has nothing to show yet, and offers the action that fills it. - Use it in place of a list, table or result that is empty, not for errors or loading. - The title says what is missing, for example 'No reports yet'. The description says why, or what to do next. - Offer at most one action: the one that fills the view, as a primary button. - Use size sm inside panels, table cells and sidebars, and md for a whole page or view. Install: `npx @uiuxengine/cli add empty-state` Example spec: ```json {"component":"engine.empty-state","props":{"title":"No items yet","description":"Items you create appear here."},"slots":{"icon":{"type":"icon","id":"inbox"},"action":{"component":"engine.button","props":{"variant":"primary","label":"Create item"}}}} ``` ## Docs - [Introduction](https://uiuxengine.com/docs/) - [Installation](https://uiuxengine.com/docs/installation/) - [Theming and density](https://uiuxengine.com/docs/theming/) - [Icons](https://uiuxengine.com/docs/icons/) - [Blocks and the CLI](https://uiuxengine.com/docs/blocks/) - [Registry format](https://uiuxengine.com/docs/registry/) - [Figma](https://uiuxengine.com/docs/figma/) - [Agents and MCP](https://uiuxengine.com/docs/agents/) - [Your own components](https://uiuxengine.com/docs/own-components/) - [Licensing](https://uiuxengine.com/docs/licensing/) ## Registry - [Index](https://uiuxengine.com/r/registry.json): every block, without file contents - [Agent index](https://uiuxengine.com/r/agents.json): every definition's JSON Schema and example spec - Snapshots of each release: https://uiuxengine.com/r/v// - [Registry format](https://uiuxengine.com/docs/registry/), with the JSON Schemas at https://uiuxengine.com/schema/v/