Attributes & specifiers
Asterix relies in a few attributes to work.
Attributes are filled with specifiers to enable related css rules. They can be chained.
<div data-layout="--grid--items-center" data-cols="--2--l4" data-gap="--2">
<div>Items</div>
<div>Items</div>
<div>Items</div>
<div>Items</div>
<div data-col="--2--l4">Fullwidth items</div>
</div>Asterix provides a bunch of specifiers.
Specifiers can be added anywhere in your code. They can be set globally, locally and responsively.
Built-in attributes and specifiers
All builtins specifiers are responsive
Adding a specifier
You can use the --spe($name[, $responsively: false, $attribute: data-spe]) mixin.
Let's say you want to create a button design system.
Implementing buttons variations with --spe() provides a reliable pattern allowing unlimited chaining. This is perfect for extending a basic design system item.
It could start like this:
Optional parameters
Create a new attribute
You design system will probably need extra values, and you want to be able to use them responsively on the HTML side.
Let's say you want to implement a basic design-system buttons layout.
First step is to implement the basic button styling. By using css variables internally, we make it simpler to extend, but you can perfectly use sass variables... Write your own rules !
This makes any HTML element having data-btn as attribute a button
Then, you need to extend from this basic layout to make your declinals:
And you'll have on the html side plenty specifiers available for setting easily your buttons:

Last updated