|
| 1 | +--- |
| 2 | +title: "Action components — component reference" |
| 3 | +navTitle: "Actions" |
| 4 | +description: "The action:* components that put an action on a page: a button, an icon, a group or a menu." |
| 5 | +--- |
| 6 | + |
| 7 | +{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Generated from sdui.manifest.json by node scripts/gen-sdui-reference.mjs; change the manifest or the generator, never this page. */} |
| 8 | + |
| 9 | +The `action:*` components put an action on a page as a button, an icon button, a group of buttons or a menu. |
| 10 | + |
| 11 | +<Callout type="info"> |
| 12 | +This page is generated from the repo-root `sdui.manifest.json`, the component manifest CI |
| 13 | +regenerates from the renderer registry. Regenerate it with |
| 14 | +`node scripts/gen-sdui-reference.mjs`; `node scripts/gen-sdui-reference.mjs --check` fails when it is stale. |
| 15 | +</Callout> |
| 16 | + |
| 17 | +## `action:button` [#action-button] |
| 18 | + |
| 19 | +Namespace `action`. |
| 20 | + |
| 21 | +| Input | Type | Required | Description | |
| 22 | +| :--- | :--- | :--- | :--- | |
| 23 | +| `name` | `string` | | — | |
| 24 | +| `label` | `string` | | — | |
| 25 | +| `icon` | `string` | | — | |
| 26 | +| `actionType` | `enum`: `script`, `url`, `modal`, `flow`, `api` | | — | |
| 27 | +| `target` | `string` | | — | |
| 28 | +| `variant` | `enum`: `default`, `primary`, `secondary`, `destructive`, `outline`, `ghost` | | — | |
| 29 | +| `size` | `enum`: `default`, `sm`, `md`, `lg`, `icon` | | Button size: the Button primitive's `default`, `sm`, `lg` or `icon`, plus `md`, which renders as `default` (default: `default`) | |
| 30 | +| `className` | `string` | | — | |
| 31 | +| `visible` | `boolean` \| `string` \| `object` | | Visibility predicate: `true`/`false`, a bare CEL expression, or the `{ dialect: 'cel', source }` envelope, evaluated against the row the host binds; the button is not rendered when it is false, nor when the predicate fails to evaluate. Omit for always-visible | |
| 32 | +| `disabled` | `boolean` \| `string` \| `object` | | Disabled predicate, in the same three shapes as `visible`: the button is shown but cannot be pressed while it holds. Omit for never-disabled | |
| 33 | +| `params` | `array` | | The parameters to collect from the user before the action runs (`ActionParam` objects: `name`, `type`, `label`, …); each collected value reaches the executor under its parameter `name`. Static execution values ride `properties.params` instead | |
| 34 | +| `description` | `string` | | Action description — the parameter dialog shows it under its title | |
| 35 | +| `openIn` | `enum`: `self`, `new-tab` | | For a `url` action: `self` navigates in place, `new-tab` opens a new browser tab | |
| 36 | +| `method` | `string` | | HTTP method of an `api` action (`POST` when omitted) | |
| 37 | +| `bodyExtra` | `object` | | Static request-body fields of an `api` action, merged last, so a constant here overrides a collected value of the same name | |
| 38 | +| `bodyShape` | `enum` \| `object`: `flat` | | How an `api` action shapes its request body: `flat` (the default) or `{ wrap: KEY }` to nest the collected values under that key, with `bodyExtra` beside it | |
| 39 | +| `operation` | `enum`: `update` | | `update` declares a single-record field write: the row runs the declared action its `name` names, so it needs a `name`. The runner posts the collected values to the platform action route under that name, and the route writes that action's own `patch` | |
| 40 | +| `confirmText` | `string` | | Confirmation question asked before the action runs; the action runs only if it is confirmed | |
| 41 | +| `successMessage` | `string` | | Toast text when the action succeeds; a `${result.*}` token reads the handler's answer (e.g. `${result.id}`) | |
| 42 | +| `errorMessage` | `string` | | Toast text when the action fails, in place of the raw error | |
| 43 | +| `refreshAfter` | `boolean` | | Refresh the surrounding data after the action succeeds | |
| 44 | +| `locations` | `array` of `string` | | The placements the action declares (`list_toolbar`, `list_item`, `record_header`, …). A `script` or `flow` action declared record-scoped (`list_item`, `record_header`, `record_more` or `record_section`) refuses to run when no record or single selection is in scope, instead of running without one | |
| 45 | +| `toast` | `object` | | Toast behaviour: `{ showOnSuccess?, showOnError?, duration? }` — `false` suppresses that toast, `duration` is handed to the toast | |
| 46 | +| `resultDialog` | `object` | | One-shot result dialog for a value the response shows exactly once (a 2FA code, a fresh secret); it replaces the success toast | |
| 47 | +| `onSuccess` | `object` | | Post-success navigation `{ navigate, openIn? }`: `navigate` is a route template that can read `${result.*}`, `openIn` is `self` (the default) or `newTab` | |
| 48 | +| `objectName` | `string` | | Object the action acts on — dispatch goes to this object instead of the page's. Omit to act on the page's object | |
| 49 | +| `recordIdField` | `string` | | For a `script` action run against a single selected row: the row field whose value is sent as the record id (default `id`) | |
| 50 | +| `undoable` | `boolean` | | Offer an Undo affordance after an update action: once an `operation: update` succeeds, its success toast offers Undo, which writes back the values the fields it wrote held on the record in scope (the record page's record, or the row the host binds), provided that record carries each of them. The one limit: a button with no record in scope (standalone, or writing a record other than the one in scope) offers no Undo, because there is no row to restore | |
| 51 | + |
| 52 | +## `action:group` [#action-group] |
| 53 | + |
| 54 | +Namespace `action`. |
| 55 | + |
| 56 | +| Input | Type | Required | Description | |
| 57 | +| :--- | :--- | :--- | :--- | |
| 58 | +| `label` | `string` | | — | |
| 59 | +| `icon` | `string` | | — | |
| 60 | +| `actions` | `array` of `object` | | The actions in this group, in order. Each member is an action object the group draws and runs itself (`name`, `label`, `icon`, `type`, `target`, `locations`, `visible`, `disabled`, …); a member's executor is its own `type` | |
| 61 | +| `display` | `enum`: `inline`, `dropdown` | | — | |
| 62 | +| `location` | `enum`: `list_toolbar`, `list_item`, `record_header`, `record_more`, `record_related`, `record_section` | | Render only the members whose `locations` include this location. Omit to render every member | |
| 63 | +| `variant` | `enum`: `default`, `secondary`, `outline`, `ghost` | | — | |
| 64 | +| `size` | `enum`: `default`, `sm`, `lg`, `icon` | | Button size for the dropdown trigger and for every inline member that sets none | |
| 65 | +| `visible` | `boolean` \| `string` \| `object` | | Visibility predicate for the whole group: `true`/`false`, a bare CEL expression, or the `{ dialect: 'cel', source }` envelope, evaluated against the row the host binds. Omit for always-visible | |
| 66 | +| `className` | `string` | | — | |
| 67 | + |
| 68 | +## `action:icon` [#action-icon] |
| 69 | + |
| 70 | +Namespace `action`. |
| 71 | + |
| 72 | +| Input | Type | Required | Description | |
| 73 | +| :--- | :--- | :--- | :--- | |
| 74 | +| `name` | `string` | | — | |
| 75 | +| `label` | `string` | | — | |
| 76 | +| `icon` | `string` | | — | |
| 77 | +| `actionType` | `enum`: `script`, `url`, `modal`, `flow`, `api` | | — | |
| 78 | +| `target` | `string` | | — | |
| 79 | +| `variant` | `enum`: `default`, `secondary`, `destructive`, `outline`, `ghost` | | — | |
| 80 | +| `className` | `string` | | — | |
| 81 | +| `visible` | `boolean` \| `string` \| `object` | | Visibility predicate: `true`/`false`, a bare CEL expression, or the `{ dialect: 'cel', source }` envelope, evaluated against the row the host binds; the icon is not rendered when it is false. Omit for always-visible | |
| 82 | +| `disabled` | `boolean` \| `string` \| `object` | | Disabled predicate, in the same three shapes as `visible`: the icon is shown but cannot be pressed while it holds. Omit for never-disabled | |
| 83 | +| `params` | `array` | | The parameters to collect from the user before the action runs (`ActionParam` objects: `name`, `type`, `label`, …); each collected value reaches the executor under its parameter `name`. Static execution values ride `properties.params` instead | |
| 84 | +| `description` | `string` | | Action description — the tooltip text when there is no `label`, and what the parameter dialog shows under its title | |
| 85 | +| `openIn` | `enum`: `self`, `new-tab` | | For a `url` action: `self` navigates in place, `new-tab` opens a new browser tab | |
| 86 | +| `method` | `string` | | HTTP method of an `api` action (`POST` when omitted) | |
| 87 | +| `bodyExtra` | `object` | | Static request-body fields of an `api` action, merged last, so a constant here overrides a collected value of the same name | |
| 88 | +| `bodyShape` | `enum` \| `object`: `flat` | | How an `api` action shapes its request body: `flat` (the default) or `{ wrap: KEY }` to nest the collected values under that key, with `bodyExtra` beside it | |
| 89 | +| `operation` | `enum`: `update` | | `update` declares a single-record field write: the row runs the declared action its `name` names, so it needs a `name`. The runner posts the collected values to the platform action route under that name, and the route writes that action's own `patch` | |
| 90 | +| `confirmText` | `string` | | Confirmation question asked before the action runs; the action runs only if it is confirmed | |
| 91 | +| `successMessage` | `string` | | Toast text when the action succeeds; a `${result.*}` token reads the handler's answer (e.g. `${result.id}`) | |
| 92 | +| `errorMessage` | `string` | | Toast text when the action fails, in place of the raw error | |
| 93 | +| `refreshAfter` | `boolean` | | Refresh the surrounding data after the action succeeds | |
| 94 | +| `locations` | `array` of `string` | | The placements the action declares (`list_toolbar`, `list_item`, `record_header`, …). A `script` or `flow` action declared record-scoped (`list_item`, `record_header`, `record_more` or `record_section`) refuses to run when no record or single selection is in scope, instead of running without one | |
| 95 | +| `toast` | `object` | | Toast behaviour: `{ showOnSuccess?, showOnError?, duration? }` — `false` suppresses that toast, `duration` is handed to the toast | |
| 96 | +| `resultDialog` | `object` | | One-shot result dialog for a value the response shows exactly once (a 2FA code, a fresh secret); it replaces the success toast | |
| 97 | +| `onSuccess` | `object` | | Post-success navigation `{ navigate, openIn? }`: `navigate` is a route template that can read `${result.*}`, `openIn` is `self` (the default) or `newTab` | |
| 98 | +| `objectName` | `string` | | Object the action acts on — dispatch goes to this object instead of the page's. Omit to act on the page's object | |
| 99 | + |
| 100 | +## `action:menu` [#action-menu] |
| 101 | + |
| 102 | +Namespace `action`. |
| 103 | + |
| 104 | +| Input | Type | Required | Description | |
| 105 | +| :--- | :--- | :--- | :--- | |
| 106 | +| `label` | `string` | | — | |
| 107 | +| `icon` | `string` | | — | |
| 108 | +| `actions` | `array` of `object` | | The menu's actions, in order. Each member is an action object the menu draws and runs itself (`name`, `label`, `icon`, `type`, `target`, `visible`, `disabled`, `tags`, …); a member's executor is its own `type` | |
| 109 | +| `variant` | `enum`: `default`, `secondary`, `outline`, `ghost` | | — | |
| 110 | +| `size` | `enum`: `default`, `sm`, `lg`, `icon` | | Trigger button size (renderer default: `icon`) | |
| 111 | +| `visible` | `boolean` \| `string` \| `object` | | Visibility predicate for the whole menu: `true`/`false`, a bare CEL expression, or the `{ dialect: 'cel', source }` envelope, evaluated against the row the host binds; a predicate that fails to evaluate hides it. Omit for always-visible | |
| 112 | +| `className` | `string` | | — | |
0 commit comments