mirror of
https://github.com/tabler/tabler.git
synced 2026-08-11 22:02:22 +04:00
236 lines
5.2 KiB
SCSS
236 lines
5.2 KiB
SCSS
//
|
|
// Button
|
|
//
|
|
.btn {
|
|
--#{$prefix}btn-icon-size: #{$icon-size};
|
|
--#{$prefix}btn-color: var(--#{$prefix}body-color);
|
|
--#{$prefix}btn-border-color: var(--#{$prefix}border-color);
|
|
--#{$prefix}btn-box-shadow: var(--#{$prefix}shadow-button);
|
|
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
white-space: nowrap;
|
|
box-shadow: var(--#{$prefix}btn-box-shadow);
|
|
|
|
.icon {
|
|
width: var(--#{$prefix}btn-icon-size);
|
|
height: var(--#{$prefix}btn-icon-size);
|
|
min-width: var(--#{$prefix}btn-icon-size);
|
|
margin: 0 calc(var(--#{$prefix}btn-padding-x) / 2) 0 calc(var(--#{$prefix}btn-padding-x) / -4);
|
|
vertical-align: bottom;
|
|
color: inherit;
|
|
}
|
|
|
|
.avatar {
|
|
width: var(--#{$prefix}btn-icon-size);
|
|
height: var(--#{$prefix}btn-icon-size);
|
|
margin: 0 calc(var(--#{$prefix}btn-padding-x) / 2) 0 calc(var(--#{$prefix}btn-padding-x) / -4);
|
|
}
|
|
|
|
.icon-right {
|
|
margin: 0 calc(var(--#{$prefix}btn-padding-x) / -4) 0 calc(var(--#{$prefix}btn-padding-x) / 2);
|
|
}
|
|
|
|
.badge {
|
|
top: auto;
|
|
}
|
|
}
|
|
|
|
.btn-link {
|
|
color: $link-color;
|
|
background-color: transparent;
|
|
border-color: transparent;
|
|
box-shadow: none;
|
|
|
|
.icon {
|
|
color: inherit;
|
|
}
|
|
|
|
&:hover {
|
|
color: $link-hover-color;
|
|
border-color: transparent;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Button color variations
|
|
//
|
|
.btn-white {
|
|
--#{$prefix}btn-bg: var(--#{$prefix}card-bg, var(--#{$prefix}bg-surface));
|
|
--#{$prefix}btn-hover-bg: var(--#{$prefix}card-bg-hover, var(--#{$prefix}bg-surface));
|
|
}
|
|
|
|
@each $color, $value in $theme-colors {
|
|
.btn-#{$color} {
|
|
--#{$prefix}btn-border-color: transparent;
|
|
--#{$prefix}btn-color: var(--#{$prefix}#{$color}-fg);
|
|
--#{$prefix}btn-bg: var(--#{$prefix}#{$color});
|
|
--#{$prefix}btn-hover-border-color: transparent;
|
|
--#{$prefix}btn-hover-color: var(--#{$prefix}#{$color}-fg);
|
|
--#{$prefix}btn-hover-bg: rgba(var(--#{$prefix}#{$color}-rgb), .8);
|
|
--#{$prefix}btn-active-border-color: transparent;
|
|
--#{$prefix}btn-active-color: var(--#{$prefix}#{$color}-fg);
|
|
--#{$prefix}btn-active-bg: rgba(var(--#{$prefix}#{$color}-rgb), .8);
|
|
--#{$prefix}btn-disabled-bg: rgba(var(--#{$prefix}#{$color}-rgb), .5);
|
|
--#{$prefix}btn-disabled-color: var(--#{$prefix}#{$color}-fg);
|
|
--#{$prefix}btn-box-shadow: var(--#{$prefix}shadow-button), var(--#{$prefix}shadow-button-inset);
|
|
}
|
|
|
|
.btn-outline-#{$color} {
|
|
--#{$prefix}btn-color: var(--#{$prefix}#{$color});
|
|
--#{$prefix}btn-border-color: var(--#{$prefix}#{$color});
|
|
--#{$prefix}btn-active-color: var(--#{$prefix}#{$color});
|
|
}
|
|
}
|
|
|
|
@each $color, $value in $theme-colors {
|
|
.btn-ghost-#{$color} {
|
|
@include button-ghost-variant($value);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Button sizes
|
|
//
|
|
.btn-sm, .btn-group-sm > .btn {
|
|
--#{$prefix}btn-line-height: 1.5;
|
|
--#{$prefix}btn-icon-size: .75rem;
|
|
}
|
|
|
|
.btn-lg, .btn-group-lg > .btn {
|
|
--#{$prefix}btn-line-height: 1.5;
|
|
--#{$prefix}btn-icon-size: 2rem;
|
|
}
|
|
|
|
//
|
|
// Button shapes
|
|
//
|
|
.btn-pill {
|
|
padding-right: 1.5em;
|
|
padding-left: 1.5em;
|
|
border-radius: 10rem;
|
|
|
|
&[class*="btn-icon"] {
|
|
padding: 0.375rem 15px;
|
|
}
|
|
}
|
|
|
|
.btn-square {
|
|
border-radius: 0;
|
|
}
|
|
|
|
//
|
|
// Icon button
|
|
//
|
|
.btn-icon {
|
|
min-width: calc((var(--#{$prefix}btn-line-height) * var(--#{$prefix}btn-font-size)) + (var(--#{$prefix}btn-padding-y) * 2) + (var(--#{$prefix}btn-border-width) * 2));
|
|
min-height: calc((var(--#{$prefix}btn-line-height) * var(--#{$prefix}btn-font-size)) + (var(--#{$prefix}btn-padding-y) * 2) + (var(--#{$prefix}btn-border-width) * 2));
|
|
padding-left: 0;
|
|
padding-right: 0;
|
|
|
|
.icon {
|
|
margin: calc(-1 * var(--#{$prefix}btn-padding-x));
|
|
}
|
|
}
|
|
|
|
//
|
|
// Button list
|
|
//
|
|
.btn-list {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
margin-bottom: -.5rem !important;
|
|
margin-right: -.5rem;
|
|
|
|
> * {
|
|
margin: 0 .5rem .5rem 0 !important;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Button floating
|
|
//
|
|
.btn-floating {
|
|
position: fixed;
|
|
z-index: $zindex-fixed;
|
|
bottom: 1.5rem;
|
|
right: 1.5rem;
|
|
border-radius: $border-radius-pill;
|
|
}
|
|
|
|
//
|
|
// Button loading
|
|
//
|
|
.btn-loading {
|
|
position: relative;
|
|
color: transparent !important;
|
|
text-shadow: none !important;
|
|
pointer-events: none;
|
|
|
|
> * {
|
|
opacity: 0;
|
|
}
|
|
|
|
&:after {
|
|
content: '';
|
|
display: inline-block;
|
|
vertical-align: text-bottom;
|
|
border: $spinner-border-width var(--#{$prefix}border-style) currentColor;
|
|
border-right-color: transparent;
|
|
border-radius: $border-radius-pill;
|
|
color: var(--#{$prefix}btn-color);
|
|
position: absolute;
|
|
width: var(--#{$prefix}btn-icon-size);
|
|
height: var(--#{$prefix}btn-icon-size);
|
|
left: calc(50% - var(--#{$prefix}btn-icon-size) / 2);
|
|
top: calc(50% - var(--#{$prefix}btn-icon-size) / 2);
|
|
animation: spinner-border .75s linear infinite;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Action button
|
|
//
|
|
.btn-action {
|
|
padding: 0;
|
|
border: 0;
|
|
color: $text-muted;
|
|
display: inline-flex;
|
|
width: 2rem;
|
|
height: 2rem;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: var(--#{$prefix}border-radius);
|
|
|
|
&:after {
|
|
content: none;
|
|
}
|
|
|
|
&:focus {
|
|
outline: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
&:hover,
|
|
&.show {
|
|
color: $body-color;
|
|
background: $body-bg;
|
|
}
|
|
|
|
&.show {
|
|
color: var(--#{$prefix}primary);
|
|
}
|
|
|
|
.icon {
|
|
margin: 0;
|
|
width: 1.25rem;
|
|
height: 1.25rem;
|
|
font-size: 1.25rem;
|
|
stroke-width: 1;
|
|
}
|
|
}
|
|
|
|
.btn-actions {
|
|
display: flex;
|
|
} |