Alert
The Bootstrap alert
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_alert(*args, &block)
bs_alert(*args, &block)
Returns a bootstrap alert containing text and/or content specified by a block. Also the alert is customizable with the following options.
Optional options
:variant
- Specify a variant for the alert. 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
:title
- Expects a string specifying the content of the heading.:title_size
- Set a different heading size. By default it is set to 4 corresponding to a "h4".:text
- Passing content as String for alert. If a text and block is given, the block will be rendered below the text.:dismissible
- Expects a boolean value. If set totrue
, a close button to dismiss the alert will be displayed.:animated
- Expects a boolean value. If set totrue
the alert will be animated if dismissed. By default, it is set asfalse
.:close_on
- Expects an event as string on which the alert will be closed calling bootstrapsclose
method.:dispose_on
- Expects an event as string on which the alert will be disposed calling bootstrapsdispose
method.&block
- Use a block to create custom content/markup inside an alert. If used together with:text
the text will be displayed before the block.Html attributes - all w3c confirm html attributes for div's can be set via options and will be added to the surrounding alert div.
Examples
Basic alert with title and text
returns
Animated, dismissible alert with content specified in a block
returns
Alert closing on event triggered by button click
Showing an alert after an event is triggered
Not intended by Bootstrap but you can use matestack toggle mechanism to trigger an alert
Last updated