Skip to content

Directives Reference

SenangStart Actions uses HTML attributes prefixed with ss- to add reactive behavior to elements.

Core Directives

DirectiveDescription
ss-dataDefine reactive data scope
ss-textBind text content
ss-showToggle visibility
ss-ifConditional rendering
ss-forList rendering

Form & Binding

DirectiveDescription
ss-modelTwo-way data binding
ss-bindAttribute binding
ss-onEvent handling

Utilities

DirectiveDescription
ss-refElement references
ss-effectSide effects
ss-transitionCSS transitions
ss-cloakHide until ready

Quick Examples

Counter

html
<div ss-data="{ count: 0 }">
  <button ss-on:click="count--">-</button>
  <span ss-text="count"></span>
  <button ss-on:click="count++">+</button>
</div>

Toggle

html
<div ss-data="{ open: false }">
  <button ss-on:click="open = !open" ss-text="open ? 'Hide' : 'Show'"></button>
  <div ss-show="open" ss-transition>Hidden content</div>
</div>

List

html
<div ss-data="{ items: ['A', 'B', 'C'] }">
  <template ss-for="item in items">
    <div ss-text="item"></div>
  </template>
</div>

Form

html
<div ss-data="{ name: '' }">
  <input ss-model="name" placeholder="Enter name">
  <p ss-text="'Hello, ' + (name || 'stranger')"></p>
</div>

Properties

For special properties like $refs, $store, $el, $event, and $dispatch, see the Properties section.