@kelvininc/ui-components
Version:
Kelvin UI Components
92 lines (90 loc) • 2.1 kB
CSS
/** HEADINGS **/
/** LABELS **/
/** SPANS **/
/** PARAGRAPHS **/
/** CODE/CONSOLE **/
@property --rotation {
syntax: "<angle>";
initial-value: 0deg;
inherits: false;
}
@keyframes rotate-border {
to {
--rotation: 360deg;
}
}
:host {
/**
* @prop --off-background-color: Button background color when's OFF.
* @prop --on-background-color: Button background color when's ON.
* @prop --sqr-background-color: Icon square container background color.
*/
--off-background-color: var(--kv-neutral-5, #707070);
--on-background-color: var(--kv-primary, #005cc7);
--sqr-background-color: var(--kv-primary-contrast, #fff);
display: flex;
align-items: center;
gap: var(--kv-spacing-2x, 8px);
}
.switch-button {
display: flex;
box-sizing: border-box;
cursor: pointer;
border-radius: 4px;
background-color: var(--off-background-color);
transition: background-color 0.3s ease-out;
}
.switch-button--disabled {
cursor: not-allowed;
user-select: none;
}
.switch-button--on {
background-color: var(--on-background-color);
}
.switch-button--on .icon-square kv-icon::part(icon) {
fill: var(--on-background-color);
}
.switch-button--large {
height: 20px;
width: 40px;
padding: 2px 2px;
}
.switch-button--large .icon-square {
height: 16px;
width: 16px;
}
.switch-button--large .icon-square kv-icon {
--icon-width: 12px;
--icon-height: 12px;
}
.switch-button--large.switch-button--on .icon-square {
transform: translateX(20px);
}
.switch-button--small {
height: 16px;
width: 32px;
padding: 2.5px 2.5px;
}
.switch-button--small .icon-square {
height: 11px;
width: 11px;
}
.switch-button--small .icon-square kv-icon {
--icon-width: 8px;
--icon-height: 8px;
}
.switch-button--small.switch-button--on .icon-square {
transform: translateX(16px);
}
.icon-square {
display: inline-flex;
align-items: center;
justify-content: center;
transition: transform 0.3s ease-out;
border-radius: 2px;
background-color: var(--sqr-background-color);
font-size: 0;
}
.icon-square kv-icon {
--icon-color: var(--off-background-color);
}