Gathering detailed insights and metrics for @loipham/material-layout-grid
Gathering detailed insights and metrics for @loipham/material-layout-grid
npm install @loipham/material-layout-grid
Typescript
Module System
Node Version
NPM Version
73.1
Supply Chain
98.9
Quality
75
Maintenance
100
Vulnerability
99.6
License
TypeScript (53.58%)
SCSS (45.16%)
JavaScript (1.16%)
Shell (0.1%)
Total Downloads
195
Last Day
2
Last Week
5
Last Month
16
Last Year
72
17,144 Stars
7,462 Commits
2,140 Forks
374 Watching
311 Branches
385 Contributors
Latest Version
14.0.4
Package Id
@loipham/material-layout-grid@14.0.4
Unpacked Size
101.28 kB
Size
12.52 kB
File Count
13
NPM Version
7.24.0
Node Version
16.10.0
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
66.7%
5
Compared to previous week
Last month
0%
16
Compared to previous month
Last year
-39.5%
72
Compared to previous year
1
Material design’s responsive UI is based on a column-variate grid layout. It has 12 columns on desktop, 8 columns on tablet and 4 columns on phone.
npm install @loipham/material-layout-grid
1<div class="mdc-layout-grid"> 2 <div class="mdc-layout-grid__inner"> 3 <div class="mdc-layout-grid__cell"></div> 4 <div class="mdc-layout-grid__cell"></div> 5 <div class="mdc-layout-grid__cell"></div> 6 </div> 7</div>
When your contents need extra structure that cannot be supported by single layout grid, you can nest layout grid within each other. To nest layout grid, add a new mdc-layout-grid__inner
to wrap around nested mdc-layout-grid__cell
within an existing mdc-layout-grid__cell
.
The nested layout grid behaves exactly like when they are not nested, e.g, they have 12 columns on desktop, 8 columns on tablet and 4 columns on phone. They also use the same gutter size as their parents, but margins are not re-introduced since they are living within another cell.
However, the Material Design guidelines do not recommend having a deeply nested grid as it might mean an over complicated UX.
1<div class="mdc-layout-grid"> 2 <div class="mdc-layout-grid__inner"> 3 <div class="mdc-layout-grid__cell"> 4 <div class="mdc-layout-grid__inner"> 5 <div class="mdc-layout-grid__cell"><span>Second level</span></div> 6 <div class="mdc-layout-grid__cell"><span>Second level</span></div> 7 </div> 8 </div> 9 <div class="mdc-layout-grid__cell">First level</div> 10 <div class="mdc-layout-grid__cell">First level</div> 11 </div> 12</div>
1@use "@loipham/material-layout-grid/mdc-layout-grid";
CSS Class | Description |
---|---|
mdc-layout-grid | Mandatory, for the layout grid element |
mdc-layout-grid__inner | Mandatory, for wrapping grid cell |
mdc-layout-grid__cell | Mandatory, for the layout grid cell |
mdc-layout-grid__cell--span-<NUMBER_OF_COLUMNS> | Optional, specifies the number of columns the cell spans |
mdc-layout-grid__cell--span-<NUMBER_OF_COLUMNS>-<TYPE_OF_DEVICE> | Optional, specifies the number of columns the cell spans on a type of device (desktop, tablet, phone) |
mdc-layout-grid__cell--order-<INDEX> | Optional, specifies the order of the cell |
mdc-layout-grid__cell--align-<POSITION> | Optional, specifies the alignment of cell |
mdc-layout-grid--fixed-column-width | Optional, specifies the grid should have fixed column width |
mdc-layout-grid--align-<GRID_POSITION> | Optional, specifies the alignment of the whole grid |
mdc-layout-grid__cell--span-<NUMBER_OF_COLUMNS>
You can set the cells span by applying one of the span classes, of the form mdc-layout-grid__cell--span-{columns}
, where {columns}
is an integer between 1 and 12. If the chosen span size is larger than the available number of columns at the current screen size, the cell behaves as if its chosen span size were equal to the available number of columns at that screen size. If the span classes are not set, mdc-layout-grid__cell
will fallback to a default span size of 4 columns.
mdc-layout-grid__cell--span-<NUMBER_OF_COLUMNS>-<TYPE_OF_DEVICE>
The same as mdc-layout-grid__cell--span-<NUMBER_OF_COLUMNS>
but for a specific type of device(desktop
, tablet
or phone
).
mdc-layout-grid__cell--order-<INDEX>
By default, items are positioned in the source order. However, you can reorder them by using the
mdc-layout-grid__cell--order-<INDEX>
classes, where <INDEX>
is an integer between 1 and 12.
Please bear in mind that this may have an impact on accessibility, since screen readers and other tools tend to follow
source order.
mdc-layout-grid__cell--align-<POSITION>
Items are defined to stretch, by default, taking up the height of their corresponding row. You can switch to a different
behavior by using one of the mdc-layout-grid__cell--align-<POSITION>
alignment classes, where <POSITION>
is one of
top
, middle
or bottom
.
mdc-layout-grid--fixed-column-width
You can designate each column to have a certain width by using mdc-layout-grid--fixed-column-width
modifier. The column width can be specified through sass map $mdc-layout-grid-column-width
or css custom properties --mdc-layout-grid-column-width-{screen_size}
. The column width is set to 72px on all devices by default.
mdc-layout-grid--align-<GRID_POSITION>
The grid is by default center aligned. You can add mdc-layout-grid--align-left
or mdc-layout-grid--align-right
modifier class to change this behavior. Note, these
modifiers will have no effect when the grid already fills its container.
Mixin | Description |
---|---|
mdc-layout-grid($size, $margin, $max-width) | Generates CSS for a grid container on certain device type |
mdc-layout-grid-inner($size, $margin, $gutter) | Generates CSS for a grid cell wrapper on certain device type |
mdc-layout-grid-cell($size, $default-span, $gutter) | Generates CSS for a grid cell on certain device type |
mdc-layout-grid-fixed-column-width($size, $margin, $gutter, $column-width) | Generates CSS for a fixed column width container on certain device type |
mdc-layout-grid-cell-order($order) | Reorders a cell inside a grid |
mdc-layout-grid-cell-align($position) | Aligns a cell vertically inside a grid |
mdc-layout-grid($size, $margin, $max-width)
Generates CSS for a grid container on certain device type. The mixin takes three parameters:
$size
: the target platform: desktop
, tablet
or phone
.$margin
: the size of the grid margin.$max-width
(optional): the maximum width of the grid, at which point space stops being distributed by the columns.mdc-layout-grid-inner($size, $margin, $gutter)
Generates CSS for a grid cell wrapper on certain device type. The mixin takes three parameters:
$size
: the target platform: desktop
, tablet
or phone
.$margin
: the size of the grid margin.$gutter
: the size of the gutter between cells.mdc-layout-grid-cell($size, $default-span, $gutter)
Generates CSS for a grid cell on certain device type. The mixin takes three parameters:
$size
: the target platform: desktop
, tablet
or phone
.$default-span
(optional, default 4): how many columns this cell should span (1 to 12).$gutter
: the size of the gutter between cells. Be sure to use the same value as for the parent grid.Note even though size is passed in as one of the arguments, it won't apply any
media-query
rules. It is set for using the correct CSS custom properties to overriden the margin and gutter at runtime (See Margins and gutters section for detail).
mdc-layout-grid-fixed-column-width($size, $margin, $gutter, $column-width)
Generates CSS for a fixed column width container on certain device type. The mixin takes four parameters:
$size
: the target platform: desktop
, tablet
or phone
.$margin
: the size of the grid margin.$gutter
: the size of the gutter between cells.$column-width
: the width of the column within the grid.Variables | Description |
---|---|
mdc-layout-grid-breakpoints | A SASS Map specifies the breakpoints width |
mdc-layout-grid-columns | A SASS Map specifies the number of columns |
mdc-layout-grid-default-margin | A SASS Map specifies the space between the edge of the grid and the edge of the first cell |
mdc-layout-grid-default-gutter | A SASS Map specifies the space between edges of adjacent cells |
mdc-layout-grid-column-width | A SASS Map specifies the column width of grid columns |
mdc-layout-grid-default-column-span | Specifies a cell's default span |
mdc-layout-grid-max-width | Restricts max width of the layout grid |
CSS Custom Properties | Description |
---|---|
mdc-layout-grid-margin-<TYPE_OF_DEVICE> | Specifies the space between the edge of the grid and the edge of the first cell |
mdc-layout-grid-gutter-<TYPE_OF_DEVICE> | Specifies the space between edges of adjacent cells |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
Found 10/30 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
project is archived
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
105 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More