Helpers for Haml, in Haml.

Define helper functions in Haml that can be called with native Haml syntax and shared inside your app.

Download Haml User Tags Latest: 0.10.0

What is it?

Compose tags from other tags

Build powerful constructs by composing simpler ones.

- define_tag :Media do |attributes, content|
  .media
    %a.pull-left{href: "#"}
      %img.media-object{src: attributes["image"]}
    .media-body
      %h4.media-heading= attributes["heading"]
      = content

%Media{image: "http://placehold.it/48", heading: "Media"}
  Nulla vel metus scelerisque ante sollicitudin commodo.

Media

Nulla vel metus scelerisque ante sollicitudin commodo.

Share tags across your project

Create helper templates and reuse them everywhere.

- include_tags '_bootstrap.html.haml'
%LaunchModalButton.btn-primary.btn-lg{target: "#introModal"}
  Experience Haml User Tags
%Modal#introModal
  %ModalTitle Welcome to the next generation of Haml
  %ModalBody
    %p Beautiful syntax for defining high-level components.
  %ModalFooter
    %CloseModalButton

Clean syntax for helper methods

Stop using Ruby syntax to call helper methods and start using powerful tags that feel like regular Haml.

= form_for @article, html: {role: "form"} do |f|
  .form-group
    = f.label :email
    = f.text_field :email, {class: "form-control"}
  .form-group
    = f.label :password
    = f.password_field :password, {class: "form-control"}
  .form-group
    = f.label :file
    = f.file_field :file
    %p.help-block Example block-level help text here.
  .checkbox
    = f.label :checkbox do
      = f.check_box :checkbox
      Check me out
  = f.submit "Submit", class: "btn btn-default"
%Form{for: @article, role: "form"}
  .form-group
    %Label#email
    %Input.form-control#email
  .form-group
    %Label#password
    %Input.form-control#password{type: "password"}
  .form-group
    %Label#file
    %Input#file{type: "file"}
    %p.help-block Example block-level help text here.
  .checkbox
    %Label#checkbox
      %Input#checkbox{type: "checkbox"}
      Check me out
  %Submit.btn.btn-default Submit

Intrigued? Learn more about Haml User Tags.