Row(ui_row)
UiBibz::Ui::Core::Layouts::Row
Grid systems are used for creating page layouts through a series of rows 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
ui_row content, options, html_options
# or by block
ui_row options, html_options do
content
end
# or by block tapped
ui_row options, html_options do |c|
# by variable
c.col content, options, html_options
# or by block
c.col options, html_options do
content
end
end
Examples
Some examples explain how to use the options present in the component.Row
Col 1
Col 2
Col 1
Col 2
ui_row class: 'test' do
ui_col "Col 1"
ui_col do
Col 2
end
end
ui_row class: 'test' do |row|
row.col "Col 1"
row.col do
Col 2
end
end
<div class="test row">
<div class="col">Col 1</div>
<div class="col">Col 2</div>
</div>
<div class="test row">
<div class="col">Col 1</div>
<div class="col">Col 2</div>
</div>
Size
Cols accept an integer
or a hash
:
Col 1
Col 2
Col 3
Col 1
Col 2
Col 3
ui_row 1, class: 'test' do
ui_col 'Col 1'
ui_col 'Col 2'
ui_col 'Col 3'
end
ui_row md: { num: 2 }, xs: { num: 1}, class: 'test' do
ui_col 'Col 1'
ui_col 'Col 2'
ui_col 'Col 3'
end
<div class="test row row-cols-1">
<div class="col">Col 1</div>
<div class="col">Col 2</div>
<div class="col">Col 3</div>
</div>
<div class="test row row-cols-md-2 row-cols-xs-1">
<div class="col">Col 1</div>
<div class="col">Col 2</div>
<div class="col">Col 3</div>
</div>
<div class="test row">
<div class="col">
<input type="text" name="test" id="test" class="form-control">
</div>
<div class="col">
<input type="text" name="test" id="test" class="form-control">
</div>
</div>
Gutters
Gutters accept an integer
or a hash
:
col 1
col 2
col 3
col 4
col 1
col 2
col 3
col 4
col 1
col 2
col 3
col 4
col 1
col 2
col 3
col 4
col 1
col 2
col 3
col 4
ui_container class: "border" do
ui_row gutters: 3, class: "test" do
ui_col 'col 1', num: 6
ui_col 'col 2', num: 6
ui_col 'col 3', num: 6
ui_col 'col 4', num: 6
end
end
ui_container class: "border" do
ui_row gutters: { num: 2 }, class: "test" do
ui_col 'col 1', num: 6
ui_col 'col 2', num: 6
ui_col 'col 3', num: 6
ui_col 'col 4', num: 6
end
end
ui_container class: "border" do
ui_row gutters: { num: 4, position: :horizontal }, class: "test" do
ui_col 'col 1', num: 6
ui_col 'col 2', num: 6
ui_col 'col 3', num: 6
ui_col 'col 4', num: 6
end
end
ui_container class: "border" do
ui_row gutters: {md: { num: 1 }}, class: "test" do
ui_col 'col 1', num: 6
ui_col 'col 2', num: 6
ui_col 'col 3', num: 6
ui_col 'col 4', num: 6
end
end
ui_container class: "border" do
ui_row gutters: {md: { num: 5, position: :vertical }, xs: { num: 3}}, class: "test" do
ui_col 'col 1', num: 6
ui_col 'col 2', num: 6
ui_col 'col 3', num: 6
ui_col 'col 4', num: 6
end
end
<div class="border container">
<div class="test row g-3">
<div class="col-6">col 1</div>
<div class="col-6">col 2</div>
<div class="col-6">col 3</div>
<div class="col-6">col 4</div>
</div>
</div>
<div class="border container">
<div class="test row g-2">
<div class="col-6">col 1</div>
<div class="col-6">col 2</div>
<div class="col-6">col 3</div>
<div class="col-6">col 4</div>
</div>
</div>
<div class="border container">
<div class="test row gx-4">
<div class="col-6">col 1</div>
<div class="col-6">col 2</div>
<div class="col-6">col 3</div>
<div class="col-6">col 4</div>
</div>
</div>
<div class="border container">
<div class="test row g-md-1">
<div class="col-6">col 1</div>
<div class="col-6">col 2</div>
<div class="col-6">col 3</div>
<div class="col-6">col 4</div>
</div>
</div>
<div class="border container">
<div class="test row gy-md-5 g-xs-3">
<div class="col-6">col 1</div>
<div class="col-6">col 2</div>
<div class="col-6">col 3</div>
<div class="col-6">col 4</div>
</div>
</div>