Files
heroui-vue/packages/styles/components/button-group.css
T

219 lines
6.1 KiB
CSS

/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
/* ==========================================================================
ButtonGroup - Groups related buttons together
========================================================================== */
/* Base button group styles */
.hv-button-group {
@apply inline-flex h-auto items-center justify-center gap-0;
}
/* ==========================================================================
Orientation variants
========================================================================== */
.hv-button-group--horizontal {
@apply flex-row;
}
.hv-button-group--vertical {
@apply flex-col;
}
/* Remove border radius from all buttons in group */
.hv-button-group .hv-button {
@apply rounded-none;
}
/* Apply border radius to first button (start edge) */
.hv-button-group--horizontal .hv-button:first-child {
@apply rounded-s-3xl;
}
/* Apply border radius to last button (end edge) */
.hv-button-group--horizontal .hv-button:last-child {
@apply rounded-e-3xl;
}
/* If only one button, apply both rounded edges */
.hv-button-group--horizontal .hv-button:first-child:last-child {
@apply rounded-3xl;
}
/* Apply border radius to first button (top edge) in vertical */
.hv-button-group--vertical .hv-button:first-child {
@apply rounded-t-3xl;
}
/* Apply border radius to last button (bottom edge) in vertical */
.hv-button-group--vertical .hv-button:last-child {
@apply rounded-b-3xl;
}
/* If only one button in vertical, apply all rounded edges */
.hv-button-group--vertical .hv-button:first-child:last-child {
@apply rounded-3xl;
}
/* Remove scale transform on active/pressed state for buttons in group */
.hv-button-group .hv-button:active,
.hv-button-group .hv-button[data-pressed="true"] {
transform: none;
}
/* Raise focused button so its outward focus ring + gap shows above adjacent buttons */
.hv-button-group .hv-button:focus-visible:not([data-focused]),
.hv-button-group .hv-button[data-focus-visible="true"] {
@apply z-10;
}
/* ==========================================================================
Separator (compound component)
========================================================================== */
.hv-button-group__separator {
@apply rounded-sm bg-current opacity-15;
position: absolute;
pointer-events: none;
/**
* Transitions
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
*/
transition: opacity 150ms var(--ease-smooth);
@apply motion-reduce:transition-none;
/* Horizontal orientation - vertical divider */
.hv-button-group--horizontal & {
inset-inline-start: -1px;
top: 25%;
width: 1px;
height: 50%;
}
/* Vertical orientation - horizontal divider */
.hv-button-group--vertical & {
inset-inline-start: 25%;
top: -1px;
width: 50%;
height: 1px;
}
}
/* ==========================================================================
Outline button border handling
========================================================================== */
/* Remove adjacent borders from outline buttons in horizontal group */
/* First button: remove end border (right in LTR, left in RTL) */
.hv-button-group--horizontal .hv-button--outline:first-child {
@apply border-e-0;
}
/* Last button: remove start border (left in LTR, right in RTL) */
.hv-button-group--horizontal .hv-button--outline:last-child {
@apply border-s-0;
}
/* Middle buttons: remove both inline borders */
.hv-button-group--horizontal
.hv-button--outline:not(:first-child):not(:last-child) {
@apply border-x-0;
}
/* Remove adjacent borders from outline buttons in vertical group */
/* First button: remove bottom border */
.hv-button-group--vertical .hv-button--outline:first-child {
@apply border-b-0;
}
/* Last button: remove top border */
.hv-button-group--vertical .hv-button--outline:last-child {
@apply border-t-0;
}
/* Middle buttons: remove both block borders */
.hv-button-group--vertical
.hv-button--outline:not(:first-child):not(:last-child) {
@apply border-y-0;
}
/* ==========================================================================
Full width modifier
========================================================================== */
.hv-button-group--full-width {
@apply w-full;
}
/* Vue Dropdown keeps a root element for consumer attrs and capture events.
* Its trigger's position belongs to that wrapper, not to the trigger's own
* :first-child/:last-child. Scope the correction to marked direct members;
* ordinary buttons and standalone dropdowns retain the baseline rules. */
.hv-button-group > .hv-dropdown[data-button-group-child] > .hv-button {
@apply rounded-none;
}
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]:first-child
> .hv-button {
@apply rounded-s-3xl;
}
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]:last-child
> .hv-button {
@apply rounded-e-3xl;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]:first-child
> .hv-button {
@apply rounded-t-3xl;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]:last-child
> .hv-button {
@apply rounded-b-3xl;
}
/* Only the outer outline edges remain; utilities on the trigger may still
* override these component-layer defaults, as they do for direct Buttons. */
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]
> .hv-button--outline {
@apply border-x-0;
}
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]:first-child
> .hv-button--outline {
@apply border-s;
}
.hv-button-group--horizontal
> .hv-dropdown[data-button-group-child]:last-child
> .hv-button--outline {
@apply border-e;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]
> .hv-button--outline {
@apply border-y-0;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]:first-child
> .hv-button--outline {
@apply border-t;
}
.hv-button-group--vertical
> .hv-dropdown[data-button-group-child]:last-child
> .hv-button--outline {
@apply border-b;
}