Button
The Bootstrap button
component, implemented in Ruby. Use it like any other matestack component in your apps, pages and components. It offers customizable options to simply achieve what is possible in bootstrap with this component. See below for more information about the possible options.
btn(*args, &block)
btn(*args, &block)
Returns a bootstrap button containing text or content specified by a block. Also the button is customizable with the following options.
Optional options
:variant
- Specify a variant for the button. Variant represent bootstraps contextual classes and can have one of the following values::primary, :secondary, :success, :info, :warning, :info, :light, :dark
or your custom contextual class. The default is:primary
:outline
- Settrue
for outline button styling:size
- Use:block, :sm, :md or :lg
to change the size of the button. The default isnil
.:type
- Specify the type button tags. By default is set asbutton
. You can set is for example assubmit
,reset
, etc.:text
- Expects a string with the text that should go inside the button:link
- Expects a hash with parameters for a link component, button will act as a link (a
tag with btn css classes):transition
- Expects a hash with parameters for a transition component, button will act as a transition (a
tag with btn css classes):action
- Expects a hash with parameters for a action component, button will act as a action (a
tag with btn css classes):onclick
- Expects a hash with parameters for a onclick component, button will act as a onclick (a
tag with btn css classes)Html attributes - all w3c confirm html attributes for div's can be set via options and will be added to the surrounding button div.
Examples
Example 1: Basic Bootstrap btn with predefined styes
The btn implemented in ruby has by default primary as styling
returns
Example 2: Applying actions, transition, links or onclicks
Example 3: Yield a given block
returns
Example 4: Using btn size parameter
returns
Last updated