RowLayout#
- class alfred3.element.core.RowLayout(ncols: int, valign_cols: Optional[List[str]] = None, responsive: bool = True)[source]#
Bases:
object
Provides layouting functionality for responsive horizontal positioning of elements.
Default behavior is to have equal-width columns with an automatic breakpoint on extra small screens (i.e. all columns get the bootstrap class ‘col-sm’ by default).
The layout’s width attributes can be accessed and changed to customize appearance. In this example, we change the width of the columns on screens of “small” and bigger width, so that we have narrow columns to the right and left (each taking up 2/12 of the available space), and one wide column (taking up 8/12 of the space) in the middle. On “extra small” screens, the columns will be stacked vertically and each take up the full width.
You can define widths for five breakpoints individually, allowing for fine-grained control (see attributes).
- Parameters
ncols – Number of columns to arrange in a row.
valign_cols – List of vertical column alignments. Valid values are ‘auto’ (default), ‘top’, ‘center’, and ‘bottom’.
responsive – Boolean, indicating whether breakpoints should be responsive, or not.
Examples
layout = RowLayout(ncols=3) # 3 columns of equal width layout.width_sm = [2, 8, 2]
Methods
Returns the column breakpoints for a specific column as strings for use as bootstrap classes.
Takes a list of column sizes (in integers from 1 to 12) and returns a corresponding list of formatted Bootstrap column classes.
Attributes
Number of columns
Indicates whether breakpoints should be responsive, or not.
Vertical column alignments.
List of column widths on screens of size 'lg' or bigger (>=992px).
List of column widths on screens of size 'md' or bigger (>=768px).
List of column widths on screens of size 'sm' or bigger (>=576px).
List of column widths on screens of size 'xl' or bigger (>=1200px).
List of column widths on screens of size 'xs' or bigger (<576px).