Dropdown
The Bootstrap dropdown
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.
bs_dropdown(*args, &block)
bs_dropdown(*args, &block)
Returns a bootstrap dropdown. Also the dropdown is customizable with the following options.
Optional options
:variant
- Specify a variant for the dropdown. 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
:text
- Expects a string with the text that should go inside the dropdown buttonbtn_class
- adding custom class for dropdown button elementmenu
- Expects an array of hash items with possible keys:type
,path
,text
or a hash withclass
anditems
where the keyitems
expects an array with hash items like abovedirection
- Trigger dropdown menus above, below, right or left of the elements by adding direction attributes with:up
,:down
,:right
or:left
align
- By default, a dropdown menu is automatically positioned 100% from the top and along the left side of its parent. By addingalign
attribute, you can change alignment of the menuoffset
- Offset of the dropdown relative to its target. By default is 0reference
- Reference element of the dropdown menu. Accepts the values oftoggle
,parent
, or an HTMLElement reference. By default istoggle
slots
- Adding customize Split Button to the dropdown menu button withsplit_btn
key inslots
optionAdditionally, you can add custom
class
,id
ordata
attributes to the dropdown componentHtml attributes - all w3c confirm html attributes for div's can be set via options and will be added to the surrounding dropdown div.
Examples
Example 1: Single Button
returns
Example 2: Split Button
returns
Last updated