UiBibz::Ui::Core::Forms::Choices::ChoiceGroup
Allow use checkbox or radio inputs throught button element.
ui_choice_group do |bc|
# by variable
bc.choice content, options, html_options
# or by block
bc.choice options, html_options do
content
end
end
ui_choice_group do |bc|
bc.choice "Checkbox 1"
bc.choice "Checkbox 2", state: :active
end
<div data-toggle="buttons" class="btn-group btn-group-toggle" >
<label class="btn-secondary btn"><input type="checkbox" autocomplete="off">Checkbox 1</label>
<label class="active btn-secondary btn"><input type="checkbox" autocomplete="off" checked="checked">Checkbox 2</label>
</div>
Button choice has on block type:
ui_choice_group size: :sm, outline: true, status: :success do |bc|
bc.choice "Checkbox 1"
bc.choice "Checkbox 2", state: :active, glyph: "gem"
end
<div data-toggle="buttons" class="btn-group btn-group-sm button-choice btn-group-toggle">
<label class="btn-outline-success btn btn-sm checkbox">
<input type="checkbox" autocomplete="off">Checkbox 1
</label>
<label class="active btn-outline-success btn btn-sm checkbox" aria-pressed="true">
<input type="checkbox" autocomplete="off" checked="checked">
<i class="glyph fa fa-gem"></i>Checkbox 2
</label>
</div>
ui_choice_group do |bc|
bc.choice "Radio 1"
bc.choice "Radio 2", state: :active
end
<div data-toggle="buttons" class="btn-group btn-group-toggle" role="group">
<label class="btn-primary btn"><input type="radio" autocomplete="off">Radio 1</label>
<label class="active btn-primary btn"><input type="radio" autocomplete="off" checked="checked">Radio 2</label>
</div>
ui_choice_group size: :lg, outline: true, type: :radio do |bc|
bc.choice "Radio 1", status: :danger, glyph: "gem"
bc.choice "Radio 2", status: :danger, state: :active
end
<div data-toggle="buttons" class="btn-group btn-group-toggle" role="group">
<label class="btn-danger-outline btn btn-lg"><input type="radio" autocomplete="off">Radio 1</label>
<label class="active btn-danger-outline btn btn-lg"><input type="radio" autocomplete="off" checked="checked">Radio 2</label>
</div>
ui_choice_group size: :lg, status: :primary, outline: true, type: :radio do |bc|
bc.choice "Radio 1", glyph: "gem", state: :active, text: false
bc.choice "Radio 2", status: :danger
bc.choice "Radio 3"
bc.choice "Radio 4", status: :danger
end
<div data-toggle="buttons" class="btn-group btn-group-toggle" role="group">
<label class="btn-danger-outline btn btn-lg"><input type="radio" autocomplete="off">Radio 1</label>
<label class="active btn-danger-outline btn btn-lg"><input type="radio" autocomplete="off" checked="checked">Radio 2</label>
</div>