Widgets

Dozens of reusable widgets built to provide navigation, alerts, text editing, and more.

Individual or complied

As with all havok modules, widgets are all comply with the AMD specification. They may be loaded individually, built into your own compiled layer with the dojo build tool (or another build tool), or used from the compiled havok.js distributable.

Declataive use

All widgets can be defined declatively as valid HTML and then instantated with the dojo parser.

To define declartively, use the `data-dojo-type` attribute, and parse the html when the dom is ready:

<script type="text/javascript">
    require(['dojo/parser', 'havok/widget/Alert','dojo/domReady!'], function(parser){parser.parse()})
</script>
<div data-dojo-type="havok/widget/Alert" data-dojo-props="hidden: false">
    <strong>Warning!</strong> Best check yo self, you're not looking too good.
</div>

Programatic use

To define programatically, first create an instance, then add to the dom, and call `startup`:

<script type="text/javascript">
    require(['havok/widget/Alert', 'dojo/domReady!'], function(Alert){
        var alert = new Alert({
            innerHTML: "<strong>Warning!</strong> Best check yo self, you're not looking too good.",
            hidden: false
        });
        dom.byId('alert').appendChild(alert.domNode);
        alert.startup();
    })
</script>
<div id="alert"></alert>

Leveraging the power of dojo

Widgets are built on dojo's dijit framework, and so use the standard dijit lifecycle, templating, etc.

Many of the havok widgets use the havok/widget/_StoreMixin to manage lists of items. Stores allow great flexibility. Items may be fetched via ajax, filtered, sorted, and reused throughout your application.

Properties

This mixin adds four properties to any widget using it:

name type default description
store object undefined

The dojo/store instance used by the widget. May be set in one of three different ways:

  • string if a string is passed, it is treated as the name of a store in the havok/store/manager, and retrieved from there.
  • data object if an object is passed that does not have a query property, it is treated as the construtor options to create an instance of dojo/store/Memory.
  • store object if an object is passed that does have a query property, it is expected to implement the dojo/store/api.
  • implicit if the store is not explicitly set, a store will be created by reading the dom.

When getting, the store object is returned

query object undefined A query object used to interogate the store.
queryOptions object undefined Options for start count and sort.
queryThrottle integer 0 Minimum time in milliseconds between queries on the store. Great for ajax backed stores on a Typeahead to prevent too many requests.
data object undefined Read only. Returns a data set from the store using the query and queryOptions.

Examples

Declative store

Store data may be passed in using the data-dojo-props attribute

<ul data-dojo-type="havok/widget/Dropdown"
    data-dojo-props="store: {
        data: [
            {id: 0, text: 'Action'},
            {id: 1, text: 'Another Action'},
            {id: 2, text: 'Something else here'},
            {id: 3, type: 'divider'},
            {id: 4, href: '#dropdowns', text: 'Dropdowns'}
        ]
    }"
></ul>

Programatic store

A store can be created progamatically and passed to the widget. Eg:

<div id="dropdown2"></div>
<script type="text/javascript">
  require(
      ['dojo/dom', 'havok/widget/Dropdown', 'dojo/store/Memory', 'dojo/domReady!'],
      function(dom, Dropdown, Memory){
          var dropdown = new Dropdown({ //create a new instance of the Dropdown widget
              store: new Memory({ //create a new instance of a Memory store for the dropdown widget to consume
                  data: [
                      {id: 0, text: 'Action'},
                      {id: 1, text: 'Another Action'},
                      {id: 2, text: 'Something else here'},
                      {id: 3, type: 'divider'},
                      {id: 4, href: '#dropdowns', text: 'Dropdowns'}
                  ]
              })
          });
          dom.byId('dropdown2').appendChild(dropdown.domNode); //add the dropdown to the dom
          dropdown.startup(); //call startup on the dropdown
      }
  )
</script>

Store from the Store Manager

The store manager allows data store to be easily interchanged and injected into store consumers. To use a store from the manager, set the store property to the name used to register that store with the manager. Eg:

<ul data-dojo-type="havok/widget/Dropdown"
    data-dojo-props="store: 'dropdownStore'"
></ul>
<script type="text/javascript">
    require([
        'havok/get!havok/store/manager', //get the store manager instance from the havok dependency injection container
        'dojo/store/Memory'
    ],
        function(storeManager, Memory){
            storeManager.stores.push( //add a new store to the store manager
                new Memory({
                    name: 'dropdownStore', //give the store a name so it can be fetched with that name
                    data: [
                        {id: 0, text: 'Action'},
                        {id: 1, text: 'Another Action'},
                        {id: 2, text: 'Something else here'},
                        {id: 3, type: 'divider'},
                        {id: 4, href: '#dropdowns', text: 'Dropdowns'}
                    ]
                })
            );
        }
    )
</script>

Implicit store

If no store is set by one of the above methods, a store is created implicitly from the markup. For example, in the Dropdown widget each li becomes an item in the store.

Store queries

Any store can be filtered by setting a query on the store.

Basic example

This query will filter so only items with A in the text will display:

<ul data-dojo-type="havok/widget/Dropdown"
    data-dojo-props="
      query: {text: /^.*A.*$/},
      store: {
          data: [
              {id: 0, text: 'Action'},
              {id: 1, text: 'Another Action'},
              {id: 2, text: 'Something else here'},
              {id: 3, type: 'divider'},
              {id: 4, text: 'Separated Link'}
          ]
      }
    "
>
</ul>

Queries on an implicit store

Implicitly created stores can also be queried. Eg:

<ul data-dojo-type="havok/widget/Dropdown"
  data-dojo-props="
      query: {text:  /^.*A.*$/}
  "
>
  <li><a href="">Action</a></li>
  <li><a href="">Another action</a></li>
  <li><a href="">Something else here</a></li>
  <br />
  <li><a href="">Separated link</a></li>
</ul>

Store query options

Query options can be set to control start count and sort. Eg:

<ul data-dojo-type="havok/widget/Dropdown"
    data-dojo-props="
      queryOptions: {
          start: 1,
          count: 3,
          sort: [{attribute: 'text', descending: true}]
      },
      store: {
          data: [
              {id: 0, text: '0'},
              {id: 1, text: '1'},
              {id: 2, text: '2'},
              {id: 3, text: '3'},
              {id: 4, text: '4'},
              {id: 5, text: '5'},
              {id: 6, text: '6'}
          ]
      }
    "
>
</ul>

Keyboard handling buttons

Use havok/widget/Button to add a button that can also respond to keypress events. The button widget can be used in place of any button tag.

Note: be careful, the keypress listeners on buttons may override normal browser controls. The keyTarget property controls the node that keypress events are listened to. By default it is set to 'window'. To turn off keyboard event listening, set keyTarget to false.

you clicked:


            
<button data-dojo-type="havok/widget/Button" data-dojo-props="keys: 'm'">press 'm'</button>
<button data-dojo-type="havok/widget/Button" data-dojo-props="keys: {ctrl: true, char: 'm'}">press 'ctrl m'</button>
<button data-dojo-type="havok/widget/Button" data-dojo-props="keys: {ctrl: true, shift: true, char: 'm'}">press 'ctrl shift m'</button>
<button data-dojo-type="havok/widget/Button" data-dojo-props="keys: {ctrl: true, shift: true, alt: true, char: 'm'}">press 'ctrl shift alt m'</button>

Button Groups

Wrap a series of buttons with havok/widget/ButtonGroup to create a group.

<div data-dojo-type="havok/widget/ButtonGroup" >
  <button>Left</button>
  <button>Middle</button>
  <button>Right</button>
</div>

Vertical button groups

Make a set of buttons appear vertically stacked rather than horizontally.

<div data-dojo-type="havok/widget/ButtonGroup" class="btn-group-vertical">
    ...
</div>

Properties

name type default description
templateString string content of havok/widget/template/ButtonGroup.html The base template for a ButtonGroup.
active object Array of active buttons.

Events

name description
item-click Fires when an item is clicked.

Single toggle

Use havok/widget/ToggleButton to create a single toggle button.

<button data-dojo-type="havok/widget/ToggleButton" class="btn-primary">Single Toggle</button>

Properties

name type default description
templateString string content of havok/widget/template/Button.html The base template for a Button.
active boolean false If the button is toggled.

Methods

name description
toggle() Toggles the button.

Events

name description
item-click Fires when an item is clicked.

Checkbox

Use havok/widget/CheckboxGroup for checkbox style toggling on btn-group.

<div class="havok/widget/CheckboxGroup">
  <button type="button" class="btn-primary">Left</button>
  <button type="button" class="btn-primary">Middle</button>
  <button type="button" class="btn-primary">Right</button>
</div>

Properties

name type default description
templateString string content of havok/widget/template/ButtonGroup.html The base template for a ButtonGroup.
active object Array of active buttons.

Events

name description
item-click Fires when an item is clicked.

Radio

Add data-toggle="buttons-radio" for radio style toggling on btn-group.

<div data-dojo-type="havok/widget/RadioGroup">
  <button type="button" class="btn-primary">Left</button>
  <button type="button" class="btn-primary">Middle</button>
  <button type="button" class="btn-primary">Right</button>
</div>

Properties

name type default description
templateString string content of havok/widget/template/ButtonGroup.html The base template for a ButtonGroup.
active object The active button.

Events

name description
item-click Fires when an item is clicked.

Button Dropdowns

Overview and examples

havok/widget/DropdownToggle with a btn-group class can be used to create button dropdown menus.

<button class="btn" data-dojo-type="havok/widget/DropdownToggle">
  Action <span class="caret"></span>
  <ul class="hidden" data-dojo-type="havok/widget/Dropdown">
    <li><a>Action</a></li>
    <li><a>Another action</a></li>
    <li><a>Something else here</a></li>
    <hr />
    <li><a>Separated link</a></li>
  </ul>
</button>

Works with all button sizes

Button dropdowns work at any size: .btn-large, .btn-small, or .btn-mini.


Split button dropdowns

Building on the button group styles and markup, we can easily create a split button. Split buttons feature a standard action on the left and a dropdown toggle on the right with contextual links.

<div class="btn-group" data-dojo-type="havok/widget/DropdownToggle">
  <button class="btn">Inverse</button>
  <button data-dojo-attach-point="button" class="btn btn-inverse"><span class="caret"></span></button>
  <ul data-dojo-type="havok/widget/Dropdown">
      ...
  </ul>
</div>

Sizes

Utilize the extra button classes .btn-mini, .btn-small, or .btn-large for sizing.

Dropup menus

<div class="btn-group dropup"
     data-dojo-type="havok/widget/DropdownToggle"
     data-dojo-props="placement: {toggle: 'top-left', dropdown: 'bottom-left'}"
>
  <button class="btn">Dropup</button>
  <button data-dojo-attach-point="button" class="btn"><span class="dropup caret"></span></button>
  <ul data-dojo-type="havok/widget/Dropdown">
      ...

  </ul>
</div>

Right Dropup

<div class="btn-group dropup"
     data-dojo-type="havok/widget/DropdownToggle"
     data-dojo-props="placement: {toggle: 'top-right', dropdown: 'bottom-right'}"
>
  <button class="btn">Right Dropup</button>
  <button data-dojo-attach-point="button" class="btn"><span class="dropup caret"></span></button>
  <ul data-dojo-type="havok/widget/Dropdown">
      ...
  </ul>
</div>

Bring your tabs to life with havok/widget/TabContainer.

Tabbable example

The title attribute will be used to create an instance of havok/widget/NavTab.

I'm in Section 1.

Howdy, I'm in Section 2.

What up girl, this is Section 3.

<div data-dojo-type="havok/widget/TabContainer" style="margin-bottom: 18px;">
    <div title="Section 1" class="active">
      <p>I'm in Section 1.</p>
    </div>
    <div title="Section 2">
      <p>Howdy, I'm in Section 2.</p>
    </div>
    <div title="Section 3">
      <p>What up girl, this is Section 3.</p>
    </div>
</div>

Tabbable in any direction

Use the placement property of havok/widget/TabContainer to alter where the tabs appear.

Tabs on the bottom

I'm in Section 1.

Howdy, I'm in Section 2.

What up girl, this is Section 3.

<div id="tabContainer1" data-dojo-type="havok/widget/TabContainer"
    data-dojo-props="placement: 'bottom'">
    ...
</div>
<div id="buttonGroup1" data-dojo-type="havok/widget/RadioGroup"
     data-dojo-props="active: 'bottom', store: {idProperty: 'text', data: [
          {type: 'button', text: 'top'},
          {type: 'button', text: 'left'},
          {type: 'button', text: 'right'},
          {type: 'button', text: 'bottom'}
     ]}"
>
</div>
<script type="text/javascript">
    require(['dijit/registry', 'havok/parseComplete!'], function(registry){
        var tabContainer = registry.byId('tabContainer1'),
            buttonGroup = registry.byId('buttonGroup1');

        buttonGroup.on('item-click', function(item){
            tabContainer.set('placement', item.text);
        });
    })
</script>

havok/dnd/_SortableMixin makes list type elements sortable by drag n drop.

Example

<ul class="nav-stacked"
    data-dojo-type="havok/widget/NavTab"
    data-dojo-mixins="havok/widget/_SortableMixin"
    data-dojo-props="store: {
        idProperty: 'text',
        data: [
            {text: 'ACT'},
            {text: 'NSW'},
            {text: 'Vic'},
            {text: 'Qld'},
            {text: 'SA'},
            {text: 'NT'},
            {text: 'WA'},
            {text: 'Tas'}
        ]
    }"
>
</ul>

Sort between lists

Use the dropTargets property to allow sorting between lists.

<ul class="span6 nav-stacked"
    id="leftSortable"
    data-dojo-type="havok/widget/NavTab"
    data-dojo-mixins="havok/widget/_SortableMixin"
    data-dojo-props="dropTargets: ['this', 'rightSortable']"
>
    <li><a>Harry</a></li>
    <li><a>Max</a></li>
    <li><a>Phillip</a></li>
    <li><a>James</a></li>
</ul>
<ul class="span6 nav-stacked"
    id="rightSortable"
    data-dojo-type="havok/widget/NavTab"
    data-dojo-mixins="havok/widget/_SortableMixin"
    data-dojo-props="dropTargets: ['this', 'leftSortable']"
>
    <li><a>Michael</a></li>
    <li><a>Tim</a></li>
    <li><a>Shaun</a></li>
    <li><a>Robert</a></li>
</ul>

Horizontal example

Tabs example

Tabs in a havok/widget/TabContainer are sortable by default.

I'm in Section 1.

Howdy, I'm in Section 2.

What up girl, this is Section 3.


The content of an Affix widget will stay visible in the viewport when it's target element is also visible. By default, Affix will target the parent element.

Example

Fix a widget to always be visible. The nav to the left is an example.

Stand alone widget

Scroll the viewport to see the example working

<style>
  .affix-example1.affix {
    top: 40px;
  }
  .affix-example1.affix-bottom {
    position: absolute;
    top: auto;
    bottom: 14px;
  }
</style>
<div style="height: 300px">
    <div
        class="affix-example1"
        data-dojo-type="havok/widget/Affix"
        data-dojo-props="viewportOffset: {top: 40, bottom: 0}"
    >
        <button class="btn">I'm affixed!</button>
    </div>
</div>

Alternate affix target

Scroll the viewport to see the example working

Target 1

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch.

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch.

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch.

Target 2

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch.

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch.

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch.

<style>
  .affix-example2.affix {
    top: 40px;
  }
  .affix-example2.affix-bottom {
    position: absolute;
    top: auto;
    bottom: 0px;
  }
</style>
<div class="row-fluid" style="position:relative">
    <div class="span3">
      <div
          class="affix-example2"
          data-dojo-type="havok/widget/Affix"
          data-dojo-props="
              viewportOffset: {top: 40, bottom: 0},
              affixTarget: 'AffixTarget1'
          "
      >
          <button class="btn">Target 1</button>
      </div>
    </div>
    <div class="span9">
      <div id ="AffixTarget1" class="well">
          <p><b>Target 1</b></p>
          ...
      </div>
    </div>
</div>
...

Affix Mixin

Affix behaviour can be mixed in to any widget. Simply use data-dojo-mixins="havok/widget/_AffixMixin"

<div style="height: 300px">
    <button
        class="affix-example1"
        data-dojo-type="havok/widget/ToggleButton"
        data-dojo-mixins="havok/widget/_AffixMixin"
        data-dojo-props="viewportOffset: {top: 40, bottom: 0}"
    >
        Affixed toggle
    </button>
</div>

Properties

Name type default description
affixTarget dom node Parent element The dom node to affix to.
viewportOffset object {top: 0, bottom: 0} Distance in pixels from the top and bottom of the viewport that affixing should be applied.

Example in navbar

The ScrollSpy plugin is for automatically updating nav targets based on scroll position. Scroll the area below the navbar and watch the active class change. The dropdown sub items will be highlighted as well.

Simply use havok/widget/_ScrollSpyMixin with a nav widget, and set the spyTarget property.

@superdweebie

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

@crimsonronin

Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.

one

Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.

two

In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.

three

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.

<div data-dojo-type="havok/widget/NavBar" class="navbar-static">
    <div class="container" style="width: auto;">
      <a class="brand" href="#">Project Name</a>
      <ul data-dojo-type="havok/widget/NavBarLinks"
          data-dojo-mixins="havok/widget/_ScrollSpyMixin"
          data-dojo-props="
          spyTarget: 'scrollspyExample1',
          store:{
            idProperty: 'text',
            data: [
                {text: '@superdweebie', spy: 'superdweebie'},
                {text: '@crimsonronin', spy: 'crimsonronin'},
                {type: 'dropdown', text: 'Dropdown'},
                {text: 'one', spy: 'one', parent: 'Dropdown'},
                {text: 'two', spy: 'two', parent: 'Dropdown'},
                {type: 'divider', text: 'divider1', parent: 'Dropdown'},
                {text: 'three', spy: 'three', parent: 'Dropdown'}
            ]
          }"
      >
      </ul>
    </div>
</div>
<div id="scrollspyExample1" class="scrollspy-example">
  <h4 id="superdweebie">@superdweebie</h4>
  <p>...</p>
  <h4 id="crimsonronin">@crimsonronin</h4>
  <p>...</p>
  <h4 id="one">one</h4>
  <p>...</p>
  <h4 id="two">two</h4>
  <p>...</p>
  <h4 id="three">three</h4>
  <p>...</p>
</div>

Auto populate nav

ScrollSpy can autopopulate the nav using the id and title attributes of the child elemnts of spyTarget.

@superdweebie

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

@crimsonronin

Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.

one

Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.

two

In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.

three

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.

<div class="row-fluid">
    <div class="span3">
        <ul data-dojo-type="havok/widget/NavPill"
            data-dojo-mixins="havok/widget/_ScrollSpyMixin"
            data-dojo-props="spyTarget: 'scrollspyExample2'"
            class="nav-stacked"
        >
        </ul>
    </div>
    <div id="scrollspyExample2" class="span9 scrollspy-example">
        <h4 id="superdweebie">@superdweebie</h4>
        <p>...</p>
        <h4 id="crimsonronin">@crimsonronin</h4>
        <p>...</p>
        <h4 id="one" title="ONE">one</h4>
        <p>...</p>
        <h4 id="two" title="TWO">two</h4>
        <p>...</p>
        <h4 id="three" title="THREE">three</h4>
        <p>...</p>
    </div>
</div>

Properties

Name type default description
spyTarget dom node The dom node to spy on.

Simply use havok/widget/Accordion. The title attribute of the contained divs will be used for the headings.

Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.

In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.

Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.

Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.

<div data-dojo-type="havok/widget/Accordion">
    <div title="one">
        <p>...</p>
    </div>
    <div title="two">
        <p>...</p>
    </div>
    <div title="three">
        <p>...</p>
    </div>
</div>

For simple modals use havok/widget/Modal.

Live Demo

button:


            
<div data-dojo-type="havok/widget/Modal" title="Modal Heading">
    ...
</div>

Custom footer

Change the modal footer by using data-dojo-attach-point="footer". Button names and keys can also be set. (This modal can be closed with ctrl-y)

button:


            

Text in a modal

Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem.

<div data-dojo-type="havok/widget/Modal" id="modal2" title="Custom footer">
  <h4>Text in a modal</h4>
  <p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem.</p>
  <div data-dojo-attach-point="footer">
      <button class="btn" data-dojo-attach-event="click: onCloseClick">Something</button>
      <button data-dojo-type="havok/widget/Button"
              data-dojo-attach-event="click: onCloseClick"
              data-dojo-props="keys: 'ESCAPE', keyTarget: false">No Thanks</button>
      <button class="btn-info"
              data-dojo-type="havok/widget/Button"
              data-dojo-attach-event="click: onOkClick"
              data-dojo-props="keys: ['ENTER', {char: 'y', ctrl: true}], keyTarget: false">Yeah!</button>
  </div>
</div>

Properties

Name type default description
button string When the modal is closed, this property will be set to the button that was used to close it.
value object A modal can be used like a form. Inputs inside a modal will populate the modal's value object.
hidden boolean true If a modal is hidden or not.
footerTemplate string The markup to add into the modal footer.

Methods

name args description
.show(value) value set's a modal form's value Shows the modal. Also returns a Deferred which will resolve when the modal is closed.
.hide() - Hides the modal.
.toggle() - Toggles the modal.

Use havok/widget/Tooltip to make a tooltip.

Tight pants next level keffiyeh you probably haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel have a terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan whatever keytar, scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.

<a data-dojo-type="havok/widget/Tooltip" title="Default tooltip">you probably</a>

Four directions

<a data-dojo-type="havok/widget/Tooltip" data-dojo-props="placement: 'top'" title="Tooltip on top">Tooltip on top</a>

Custom trigger event

<a data-dojo-type="havok/widget/Tooltip" data-dojo-props="eventShow: 'click'" title="I was clicked">Click to show tooltip</a>

Inverse tooltip

<a class="inverse" data-dojo-type="havok/widget/Tooltip" title="Inverse tooltip">Inverse Tooltip</a>

Use havok/widget/Alert to create and show/hide alerts.

Default alert

Wrap any text in havok/widget/Alert for a basic warning alert message.

Warning! Best check your self, you're not looking too good.
<div data-dojo-type="havok/widget/Alert" data-dojo-props="hidden: false">
  <strong>Warning!</strong> Best check your self, you're not looking too good.
</div>

Block alerts

Add class alert-block for longer messages.

Warning!

Best check your self, you're not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

<div data-dojo-type="havok/widget/Alert" class="alert-block" data-dojo-props="hidden: false">
  <h4>Warning!</h4>
  <p>Best check your self, you're not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</div>

Pretty colors

Add sematic classes for different styling:

Info! alert.
Error! alert.
Success! alert.
<div data-dojo-type="havok/widget/Alert" class="alert-info" data-dojo-props="hidden: false">
  <strong>Info!</strong> alert.
</div>
<div data-dojo-type="havok/widget/Alert" class="alert-error" data-dojo-props="hidden: false">
  <strong>Error!</strong> alert.
</div>
<div data-dojo-type="havok/widget/Alert" class="alert-success" data-dojo-props="hidden: false">
  <strong>Success!</strong> alert.
</div>

Properties

Name type default description
hidden boolean true If an alert is hidden or not.
name args description
.show() - Shows an alert.
.hide() - Hides the alert.
.toggle() - Toggles the alert.

havok/widget/Overlay A widget designed to act as a Standby/Busy/Disable/Blocking widget to indicate a particular DOM node is processing and cannot be clicked on at this time.

Example

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.

This is overlayed
<p>...</p>
<span id="overlay1" data-dojo-type="havok/widget/Overlay" >This is overlayed</span>
<button id="overlayToggle1" data-dojo-type="havok/widget/ToggleButton">Toggle overlay</button>
<script>
    require(['dijit/registry', 'havok/parseComplete!'], function(registry){
        registry.byId('overlayToggle1').watch('active', function(){
            registry.byId('overlay1').toggle();
        });
    })
</script>

With wait cursor

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.

This is overlayed
<p>...</p>
<span id="overlay2" class="overlay-wait" data-dojo-type="havok/widget/Overlay" >This is overlayed</span>
<button id="overlayToggle2" data-dojo-type="havok/widget/ToggleButton">Toggle overlay</button>
<script>
    require(['dijit/registry', 'havok/parseComplete!'], function(registry){
        registry.byId('overlayToggle2').watch('active', function(){
            registry.byId('overlay2').toggle();
        });
    })
</script>

Overlay whole viewport

By default, the overlay widget will target the previous element in the dom. This can be changed by specifying an alternate target node. Eg:

<span id="overlay3"
      data-dojo-type="havok/widget/Overlay"
      data-dojo-props="target: document.body"
>
    <button id="overlay3hide" class="btn">Hide overlay</button>
</span>
<button id="overlay3show" class="btn">Show overlay</button>
<script>
    require(['dijit/registry', 'dojo/dom', 'dojo/on', 'havok/parseComplete!'], function(registry, dom, on){
        on(dom.byId('overlay3show'), 'click', function(){
            registry.byId('overlay3').show();
        });
        on(dom.byId('overlay3hide'), 'click', function(){
            registry.byId('overlay3').hide();
        });
    })
</script>

havok/dnd/Dragable makes an element dragable.

Example

Drag me!
<div class="label label-info" data-dojo-type="havok/widget/Dragable">Drag me!</div>

Grip

Add a data-dojo-attach-point="grip" to indicate a drag grip.

Drag me!
<div class="label label-info" data-dojo-type="havok/widget/Dragable">Drag me! <i class="icon-move icon-white" data-dojo-attach-point="grip"></i></div>

Example

Here is some text to edit.
<div data-dojo-type="havok/widget/TextEditor">
    Here is some text to edit.
</div>

The tools visible will show and hide as the width of the text editor changes.

Here is some text to edit.

Separated toolbar

You can use a separated text editing toolbar, and pass it a target node id to edit. The toolbar below can be used to edit this paragraph.

<div data-dojo-type="havok/widget/TextToolbar" data-dojo-props="target: 'editExample'"></div>

Custom font and size lists

You can change the font and size lists by overriding the appropriate store in di config. Eg:

di: {
    'havok/store/stores': {
        proxies: {
            font: {
                base: 'my/alternative/font/store',
                proxyMethods: [
                    'get',
                    'query'
                ]
            }
        }
    }
}

Properties

Name type default description
text string undefined The text inside the editor.
Loading more havok...