Skip to content
Rails plugin for Oscar Alexander's sexy buttons method
Find file
Latest commit 4620bf1 Jun 7, 2011 @lleger lleger committed with Updates to work with Rails 3



Pretty Buttons is another button plugin that allows you to use pretty buttons like the ones shown by Oscar Alexander at :


  1. Run:

    rake pretty_buttons:install
  2. add this to your layout file

    <%= include_pretty_buttons %>


# standard pretty button
<%= pretty_button "Sign up!", signup_path %>

# form submit button
<%= pretty_submit "Create User" %>

# icon based pretty buttons, just like the ones that github uses!
<%= add_button "Add User", user_path %>

# the buttons also match restful conventions as well
<%= edit_button "Edit User", edit_user_path %>
<%= destroy_button "Delete User", user_path, :method => :delete %>

# run the following task to get a list of all icon based button methods
# note that you will need the `less` command to run this task, sorry windows people
rake pretty_buttons:list


pretty_button "click me", path, options={}

The pretty_button method takes the same options as link_to


<%= pretty_button "Sign up!", signup_path %>

pretty_submit "submit", options={}, &blk

Creates a pretty submit button, note that this submits the form via javascript, it will automatically submit the parent form that the button is contained in, if you are using pretty_submit on a complex form layout, simply give the form an id and pass in the :form option.


  • :div = div html attributes for the container, all html attributes are valid
  • :btn = anchor attributes for the button, all html attributes are valid
  • :form = the id of the form that you want to submit, use this only if button is nested more than 2 levels deep


 # simple submit pretty button
 <%= pretty_submit "Sign Up!" %>

 # submit pretty button inside a complex form layout
 <%= pretty_submit "Sign Up!", :form => "signup-form" %>

 # submit pretty button with content inside container
 <% pretty_submit "Sign Up!" do %>
    or <%= link_to "cancel", "javascript:history.go(-1)" %>
 <% end %>   

Copyright (c) 2009 Vann Ek, released under the MIT license Original Concept by Oscar Alexander:

Silk Icons from famfamfam:
Something went wrong with that request. Please try again.