1.0.1 • Published 2 years ago
unocss-preset-columns v1.0.1
Unocss Preset columns
A dead-simple uno preset that adds a new unit to unocss, the "c" unit, that is equal to the size of a column.
For example, if your design has 14 columns, px-1c will generate the following styles:
.px-1c {
padding-left: 7.1428571429vw; /* 1/14 * 100vw */
padding-right: 7.1428571429vw;
}The following features are supported:
widthwithw-Xcheightwithh-Xcmax-widthwithmax-w-Xcmax-heightwithmax-h-Xcpadding-leftwithpl-Xcpadding-topwithpt-Xcpadding-rightwithpr-Xcpadding-bottomwithpb-Xcpadding-left", "padding-rightwithpx-Xcpadding-top", "padding-bottomwithpy-Xcpaddingwithp-Xcmargin-leftwithml-Xcmargin-topwithmt-Xcmargin-rightwithmr-Xcmargin-bottomwithmb-Xcmargin-left", "margin-rightwithmx-Xcmargin-top", "margin-bottomwithmy-Xcmarginwithm-Xcleftwithleft-Xctopwithtop-Xcrightwithright-Xcbottomwithbottom-Xcleft", "right", "top", "bottomwithinset-Xcflex-basiswithbasis-Xcgapwithgap-Xccolumn-gapwithgap-x-Xcrow-gapwithgap-y-Xctext-indentwithindent-Xc
Usage
In uno.config.ts
import { presetColumns } from "unocss-preset-columns";
export default defineConfig({
// ...
presets: [
// ...
presetColumns(14), // The parameter is the number of columns in your design
],
// ...
});