1.0.1 • Published 9 months 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:
width
withw-Xc
height
withh-Xc
max-width
withmax-w-Xc
max-height
withmax-h-Xc
padding-left
withpl-Xc
padding-top
withpt-Xc
padding-right
withpr-Xc
padding-bottom
withpb-Xc
padding-left", "padding-right
withpx-Xc
padding-top", "padding-bottom
withpy-Xc
padding
withp-Xc
margin-left
withml-Xc
margin-top
withmt-Xc
margin-right
withmr-Xc
margin-bottom
withmb-Xc
margin-left", "margin-right
withmx-Xc
margin-top", "margin-bottom
withmy-Xc
margin
withm-Xc
left
withleft-Xc
top
withtop-Xc
right
withright-Xc
bottom
withbottom-Xc
left", "right", "top", "bottom
withinset-Xc
flex-basis
withbasis-Xc
gap
withgap-Xc
column-gap
withgap-x-Xc
row-gap
withgap-y-Xc
text-indent
withindent-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
],
// ...
});