Library event controls
Design References
Contract
Event controls receive Go callback props. Button is for visible
text controls. IconButton is for compact tools and requires
the component prop ariaLabel when no visible text is rendered; when the
component renders a native HTML button, that prop becomes the HTML
aria-label attribute. EventBar groups a short ordered set of
event controls.
| Field | Required | Behavior |
|---|---|---|
onClick |
required for active controls | Go callback function invoked by the component. |
id |
recommended for handled controls | Stable component id for tests, labels, and event payload target data. |
confirm |
required for destructive controls | Public-safe confirmation policy with title, optional summary, and variant: danger. |
var actions = (
<EventBar>
<Button id="save-button" onClick={saveDraft}>Save</Button>
<IconButton id="archive-button" icon="archive" ariaLabel="Archive" onClick={archive}></IconButton>
</EventBar>
)
Destructive controls delete data, revoke access, submit irreversible state, or
start work that is hard to undo. If a destructive control omits confirm,
component validation fails before rendering.
Consequence
Product modules should not attach inline JavaScript for ordinary events. Destructive events use the danger variant and require confirmation policy in the component props.