Github

Action Blocks

Open portals, change data attributes, submit forms, and more...

Atomic Payload Is Not Recommended For Production Builds At The Moment

Overview

Each individual action block handles a single type of action, which can be utilized by Child Blocks. By having Actions structured with blocks, we have much greater flexibility in applying dynamic handling to our front end.

With the block structure we can filter where blocks are utilized, have smaller self contained action logic, and more easily expand our number of supported actions. All of which is already established in Atomic Payload.

Currently Implemented Features:

  • Filters to prevents actions from being used on the wrong blocks
  • Global state and local data persistence to preserve action state (Thanks Zustand)
  • Automatic initial value inheritance for SSR handling

Currently Implemented Actions:

  • Toggle Theme
  • Set Cookie Consent
  • Cookie Consent To Data Attribute
  • Submit Form
  • Reset Form
  • Form Error To Data Attribute
  • Form Status To Data Attribute
  • Set Boolean State
  • Set Text State
  • Cycle Text State
  • Boolean State To Data Attribute
  • Text State To Data Attribute

Notes

As an optimization many Child Blocks have a static and client component version. What determines if a child block is statically generated to html or is delivered as a client component, is whether or not it has an action.