Next Commerce
Data Attributes

Data Attributes Reference

Complete catalog of every data-next-* attribute that controls SDK behavior

Data attributes are the API through which your HTML communicates with the Campaign Cart SDK.

Core Principles

  • HTML as the source of truth. Behavior is declared in markup, not JavaScript.
  • Progressive enhancement. Elements render meaningful fallback content first, then enhance once the SDK loads.
  • Composable patterns. Combine attributes to build complex UI without custom code.
  • State management. The SDK tracks state and manages CSS classes automatically.

How the Categories Fit Together

The 10 categories above are the cross-cutting attribute reference. Most pages combine attributes from several categories at once — a typical add-to-cart button uses Actions + State + Display + Configuration:

<!-- Actions: turns the element into a cart trigger -->
<!-- Display: binds button text to live state -->
<!-- Configuration: formats the price -->
<!-- State: hides the button when no package is selected -->
<button
  data-next-action="add-to-cart"
  data-next-package-id="42"
  data-next-hide="!cart.hasItems && cart.total === 0"
  data-add-text="Add for $99"
  data-remove-text="In cart">
  Add for <span data-next-display="package.42.price" data-format="currency">$99</span>
</button>

For higher-level guides that walk through complete features end-to-end, see:

On this page