Skip to content
Markie Arnold edited this page Jun 24, 2019 · 28 revisions

For a rails kit, the wrapping element of the kit should look like the following:

<%= content_tag(:div,
    id: object.id,
    data: object.data,
    class: object.classname("pb_my_kit")) do %>
  CONTENT HERE
<% end %>

This allows for every kit to have the following props by default:

  • id
  • classname
  • data

Default prop: id

The user should be able to add their own unique id attribute to your kit.

<%= pb_rails("my_kit", props: { id: "awesome_id" }) %>

This is generate in the browser:

<div class="pb_my_kit" id="awesome_id"></div>

Default prop: classname

The user should be able to add their own classes to your kit, but not override the classes required by the kit.

<%= pb_rails("my_kit", props: { classname: "new_class" }) %>

This is generate in the browser:

<div class="pb_my_kit new_class"></div>

Default prop: data