There may be times when you want to design your own custom button, but you still want to use specific values from ACSS’s global button settings. If this is the case, you can use button variables.
Available button variables
The following variables reference the global button styles you’ve set in ACSS.
var(--btn-border-size)
– Button border widthvar(--btn-radius)
– Button border-radiusvar(--outline-btn-border-size)
– Outline button border widthvar(--btn-letter-spacing)
– Button letter spacingvar(--btn-line-height)
– Button line heightvar(--btn-pad-x)
– Button inline padding (left/right)var(--btn-pad-y)
– Button block padding (top/bottom)var(--btn-text-decoration)
– Button text-decorationvar(--btn-text-style)
– Button font style valuevar(--btn-text-transform)
– Button text transform valuevar(--btn-weight)
– Button font-weightvar(--btn-width)
– Button minimum width
Example custom button
Let’s say we want to create a button that shares all the same general styling as our default buttons but has a gradient background instead of a solid background:
.gradient-button {
background: linear-gradient(var(--action-medium), var(--action));
padding: var(--btn-pad-y) var(--btn-pad-x);
font-size: var(--text-m);
line-height: var(--btn-line-height);
letter-spacing: var(--btn-letter-spacing);
border-width: var(--btn-border-size);
border-style: var(--btn-border-style);
border-color: transparent;
font-weight: var(--btn-weight);
text-decoration: var(--text-decoration);
font-style: var(--btn-text-style);
text-transform: var(--btn-text-transform);
min-inline-size: var(--btn-width);
}
Code language: CSS (css)
Now you have a custom gradient button that will still inherit any changes you make to your global button styles in the ACSS dashboard.