BackpackUI is a Rails engine that provides a set of reusable UI components for Rails applications. Currently, it includes a Button component.
To use the Button component, add the following to your view:
<%= render(BackpackUi::ButtonComponent.new(text: "Click me", icon: "check", type: 'button', options: { classification: 'primary',
size: 'medium' })) %>
The classification
option can be one of primary
, secondary
, tertiary
, outline
, no_outline
, outline_dark
, link
, or delete
. The size
option can be one of small
, medium
, or large
.
Add this line to your application's Gemfile:
gem "backpack_ui"
And then execute:
$ bundle
Or install it yourself as:
$ gem install backpack_ui
Add the following to your app/assets/stylesheets/application.css
file:
*= require backpack_ui/application
Add the following to your app/assets/javascripts/application.js
file:
import "backpack_ui/application"
Add the following to your app/config/routes.rb
file:
mount BackpackUi::Engine => "/backpack_ui"
To run the engine locally, clone the repository and run the following commands:
$ bundle install
$ cd test/dummy
$ bin/rails assets:precompile
$ bin/rails server
Then, navigate to http://localhost:3000
in your browser.
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.