Gem Version


A small, simple Ruby user interface framework

NOTE: This project is its very early stages of development. If you experience a bug or have an idea for a new feature, don't hesitate to open an issue


Add this line to your application's Gemfile:

gem 'RIUI'

And then execute:

$ bundle

Or install it yourself as:

$ gem install RIUI


First include the gem in your Ruby file.

include 'RIUI'


When you create a new view, you must also create a new instace of RIActions. This is necessary to provide functionality to UI elements.

actions =

You must then add each element to the action class:

button =
slider =


To create a new button object:

button = 125, y: 100, width: 150, height: 100, color: "green", hover_color: "blue")

See docs for descriptions of each arrtibute

To add clicking functionality, first create the method you would like to trigger:

def click
  puts 'button clicked'

Then, create an object with that method:

 onclick = method(:click)

Alternatively, you can call a method from a class:

 my_class =
 onclick = my_class.method(:method_name)

Next, assign the method to the button:

 button.onClick(onclick: onclick)


To create a new slider object:

 slider = 200, square_size: 10, x: 100, y: 250, ticks: 20)

See docs for descriptions of each attribute

To access the slider's value:

 slider.value #returns the current value of the slider

To reset the slider to 0 and reset the position of the square:


To add call a method when the slider's value changes:

 def slider_change
  puts "#{slider.value}
 value_changed = method(:slider_change)
 slider.onChange(onchange: value_changed)


Bug reports and pull requests are welcome on GitHub at[USERNAME]/RIUI.


The gem is available as open source under the terms of the MIT License.