Col(ui_col)
UiBibz::Ui::Core::Layouts::Col
Grid systems are used for creating a series of columns that house your content. You can read about the doc : Bootstrap doc
Usage
This component is an extension of component element. A Ui Bibz component consists of 3 arguments:
# by variable
col content, options, html_options
# or by block
col options, html_options do
content
end
Examples
Some examples explain how to use the options present in the component.Col
Col 1
Col 2
ui_row class: "test" do
ui_col do
Col 1
end
ui_col "Col 2"
end
<div class="test row">
<div class="col">Col 1</div>
<div class="col">Col 2</div>
</div>
Options
A column can take several arguments [Hash
/Integer
]:
- num - Integer/Symbol (1..12 || :auto)
- offset - Integer (1..12)
- pull - Integer (1..12)
- push - Integer (1..12)
Col 1
Col 2
Col 3
Col 4
ui_row class: "test" do
ui_col 3 do
Col 1
end
ui_col({ num: 10, offset: 2 }, { class: "test-col" }) do
Col 2
end
ui_col "Col 3", { num: 2, pull: 4 }, { class: "test-col2" }
ui_col md: 4 do
Col 4
end
end
<div class="test row">
<div class="col-3">Col 1</div>
<div class="test-col col-10 offset-2">Col 2</div>
<div class="test-col2 col-2 col-pull-4">Col 3</div>
<div class="col-md-4">Col 4</div>
</div>
Col with differents sizes
To add multiple sizes of columns, you must use arguments :
Col 1
Col 2
ui_row class: "test" do
ui_col(md: { num: 5, offset: 2 }, xs: { num: 2 }) do
Col 1
end
ui_col "Col 2", { md: { num: 7, pull: 4 }, xs: { num: 10 }}, { class: "test-col2" }
end
<div class="test row">
<div class="col-md-5 offset-md-2 col-xs-2">Col 1</div>
<div class="test-col2 col-md-7 col-md-pull-4 col-xs-10">Col 2</div>
</div>