Skip to main content

SPHButton Documentation

HTML


<button class="sph-button">
<i class="sph-button__icon bx bxs-like" aria-hidden="true"></i>
<span class="sph-button__label">BUTTON</span>
</button>

SCSS/CSS

CSS Classes & HTML Attributes API

ClassEffect
.sph-buttonThe main button component.
.sph-button__iconThe icon element of the button component.
.sph-button__labelThe label element of the button component.
.sph-button--outlinedAn additional class to be put on top of the .sph-button class to render the component with its outlined style.
.sph-button--filledAn additional class to be put on top of the .sph-button class to render the component with its filled style.
Adding the disabled attributeRenders the component in its disabled state.

The use() mixin API

  • The parameters in the use() mixin API only accept css custom properties from the theme config.
ParameterEffect
$typesSelectively renders the styles of the types of buttons you want to use. Available types are: all (*this
is the default*), outlined, filled. You can also list multiple types.

SCSS variables API (using with ())

PropertyEffect
$button-fillChanges the component's default state background color.
$button-inkChanges the component's default state text color.
$button-sizeChanges the component's text size.
$button-elevation-colorChanges the component's elevation/shadow color.
$button-active-fillChanges the component's active state background color.
$button-disabled-fillChanges the component's disabled state background color.
$button-radiusChanges the component's border radius.
$button-icon-inkChanges the component's icon color.
$button-icon-sizeChanges the component's icon size.
@use '~@surpathhub/ugnay/SPHButton' with (
$button-fill: blue,
$button-ink: #ffffff,
$button-elevation-color: #ffffff
);

@include SPHButton.use($type: 'all');

CSS custom properties API

PropertyEffect
--sph-button-fillChanges the component's default state background color.
--sph-button-inkChanges the component's default state text color.
--sph-button-sizeChanges the component's text size.
--sph-button-active-fillChanges the component's active state background color.
--sph-button-disabled-fillChanges the component's disabled state background color.
--sph-button-radiusChanges the component's border radius.
--sph-button-icon-inkChanges the component's icon color.
--sph-button-icon-sizeChanges the component's icon size.
.sph-button {
--sph-button-fill: blue;
--sph-button-ink: #FFF;
--sph-button-icon-ink: #FF9900;
}