GoodsAction
A product-page bottom bar: icon buttons on the left (favorites / shop / cart, with badges and pressed state) and main buttons on the right (add to cart, buy now). Data comes from the items / actions JSON attributes; every item can be disabled individually and clicks dispatch oas-action-click.
Basic usage
An item's key is its event identity; built-in keys (favorite / shop / cart) get default labels and icons, other keys need their own label:
Icon group + main buttons + event feedback
Click any item to see oas-action-click feedback.
Badges and pressed state
badge renders when greater than 0 and collapses above 99 to 99+; active marks an icon button as pressed (aria-pressed="true"), suited to favorites toggles.
Badge cap + pressed favorites
Custom icons and disabling
icon takes a registered icon name (built-in or registerIcon) to override the default icon; an unregistered name warns once in development and falls back to the built-in icon for that key (no built-in icon means no icon, and the text stays readable). actions[].disabled disables a single button and the host disabled disables everything:
Custom icon / single disabled / globally disabled
Primary-button loading / visual tiers
actions[].loading puts a single primary button into its loading state: clicks are blocked + aria-busy + spinner, orthogonal to disabled (they can coexist); actions[].type switches the visual tier (default / primary / success / warning / danger), defaulting to the primary flag. Without type the behavior is unchanged:
Per-item loading + semantic tiers
Custom icon colors
items[].color tints an icon button: preset names (magenta / red / volcano / orange / gold / lime / green / cyan / blue / geekblue / purple) map to the --oas-preset-<name>-text safe tokens, other values pass through as declared by the host; once colored, base / hover / pressed states stay pinned to that color:
Custom icon color
Navigation accessible name
label overrides the accessible name of the navigation region (<nav>), which defaults to the i18n goodsAction.label; use it to tell several action bars on one page apart:
Custom accessible name
API
oas-goods-action
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
actions | Primary buttons JSON array [{ key, text, primary?, disabled?, loading?, type? }]; loading blocks clicks with aria-busy + spinner (orthogonal to disabled); type visual tier default / primary / success / warning / danger, defaults to the primary flag | GoodsActionButton[] | string | — |
disabled | Disables everything (honours config-provider injected disabled) | boolean | — |
items | Icon buttons JSON array [{ key, label?, icon?, badge?, active?, color? }]; built-in keys (favorite / shop / cart) fall back to built-in labels and icons; color preset names map to --oas-preset-<name>-text tokens, other values pass through as declared | GoodsActionItem[] | string | — |
label | Navigation accessible name, defaults to the i18n goodsAction.label | — | — |
Events
| Event | Description |
|---|---|
oas-action-click | Dispatched when any item is clicked with { key, source: 'icon' | 'button' }, detail: { key, source } satisfies GoodsActionDetail |
CSS Variables
| CSS Variable | Default |
|---|---|
--oas-goods-action-item-color | var(--oas-color-text-secondary) |