Buttons - Vertical Segmented Buttons
Vertical Segmented Buttons
Options
| Name | Value | Type | Default | Description |
|---|---|---|---|---|
label | string | required | Provides the accessible group name. | |
orientation | "horizontal" | "vertical" | "horizontal" | Joins items in a row or column. | |
allowToggle | boolean | true | Enables pressed states for direct Button children. | |
allowMultiple | boolean | false | Allows more than one button to remain pressed. | |
allowDepress | boolean | false | Allows the active button to return to an unpressed state. | |
disabled | boolean | false | Disables the complete group. |
| Name | Value | Type | Default | Description |
|---|---|---|---|---|
size | "small" | "medium" | "large" | "small" | Sets the button size. | |
type | "button" | "submit" | "reset" | "button" | Controls the native button behavior in a form. | |
disabled | boolean | false | Prevents interaction with the button. | |
toggle | boolean | false | Enables persistent pressed and unpressed states. | |
pressed | boolean | false | Sets the initial toggle state. | |
iconPosition | "left" | "top" | "right" | "bottom" | "left" | Places the named icon slot around the label. | |
textAlign | "left" | "center" | "right" | "center" | Aligns content inside a fixed-width button. | |
href | string | None | Renders a link styled as a button. | |
class | string | None | Adds a CSS class to the button. |
| Name | Value | Type | Default | Description |
|---|---|---|---|---|
label | string | required | Text shown on the trigger. | |
size | "small" | "medium" | "large" | "small" | Sets the trigger size. | |
disabled | boolean | false | Disables the trigger. | |
arrowPosition | "right" | "bottom" | "right" | Places the menu arrow beside or below the content. | |
iconPosition | "left" | "top" | "right" | "bottom" | "left" | Places an icon supplied through the label slot. | |
textAlign | "left" | "center" | "right" | "center" | Aligns content inside a fixed-width trigger. |
| Name | Value | Type | Default | Description |
|---|---|---|---|---|
label | string | required | Primary button label. | |
menuLabel | string | label + options | Accessible name for the menu trigger. | |
size | "small" | "medium" | "large" | "small" | Sets both button sizes. | |
disabled | boolean | false | Disables both actions. | |
arrowPosition | "right" | "bottom" | "right" | Places the menu trigger beside or below the primary action. | |
iconPosition | "left" | "top" | "right" | "bottom" | "left" | Places the primary action icon around its label. | |
textAlign | "left" | "center" | "right" | "center" | Aligns primary content inside a fixed-width action. | |
toggle | boolean | false | Makes the primary action toggleable. | |
pressed | boolean | false | Sets its initial toggle state. |
| Name | Value | Type | Default | Description |
|---|---|---|---|---|
href | string | None | Renders the item as a link. | |
disabled | boolean | false | Prevents activation. |
Styles
--cj-button-background#E7E7E7--cj-button-color#333333--cj-button-border-color#D1D1D1--cj-button-hover-background#C6DCF6--cj-button-hover-border-color#B0CCF2--cj-button-active-background#B6CBE4/* Choose a color to generate CSS overrides. */_button.scssscss
.cj-button,
.cj-split-button {
--cj-button-surface: var(
--cj-button-background,
#fff linear-gradient(#fff, #f9f9f9 48%, #e2e2e2 52%, #e7e7e7)
);
--cj-button-frame: var(--cj-button-border-color, #d1d1d1);
}
.cj-button {
appearance: none;
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
border: 1px solid var(--cj-button-frame);
border-radius: 3px;
background: var(--cj-button-surface);
color: var(--cj-button-color, #333);
font: normal 11px/16px var(--cj-font);
padding: 2px 6px;
gap: 4px;
cursor: pointer;
white-space: nowrap;
vertical-align: middle;
text-decoration: none;
}
.cj-button[aria-label]:has(> .cj-button__content > svg:only-child) {
padding-inline: 2px;
}
.cj-button__content {
display: flex;
align-items: inherit;
justify-content: inherit;
flex-direction: inherit;
gap: inherit;
}
.cj-button--text-left > .cj-button__content {
justify-content: flex-start;
width: 100%;
}
.cj-button--text-right > .cj-button__content {
justify-content: flex-end;
width: 100%;
}
.cj-button--icon-right > .cj-button__content {
flex-direction: row-reverse;
}
.cj-button--icon-top > .cj-button__content {
flex-direction: column;
}
.cj-button--icon-bottom > .cj-button__content {
flex-direction: column-reverse;
}
.cj-button:hover:not(:disabled):not([aria-disabled="true"]) {
border-color: var(--cj-button-hover-border-color, #b0ccf2);
background: var(
--cj-button-hover-background,
#e4f3ff linear-gradient(#e4f3ff, #d9edff 48%, #c2d8f2 52%, #c6dcf6)
);
}
.cj-button:active:not(:disabled):not([aria-disabled="true"]),
.cj-button[aria-pressed="true"]:not(:disabled):not([aria-disabled="true"]) {
border-color: #9ebae1;
background: var(
--cj-button-active-background,
linear-gradient(#b6cbe4, #bfd2e6 48%, #8dc0f5 52%, #98c5f5)
);
}
.cj-button:focus {
outline: none;
}
.cj-button:focus::after {
content: "";
position: absolute;
inset: 2px;
outline: 1px dotted #333;
pointer-events: none;
}
.cj-button:focus-visible:not(:hover):not(:active):not([aria-pressed="true"]) {
border-color: var(--cj-button-hover-border-color, #b0ccf2);
background: var(
--cj-button-background,
#fff linear-gradient(#fff, #f9f9f9 48%, #e7e7e7 52%, #ececec)
);
}
.cj-button:disabled,
.cj-button[aria-disabled="true"] {
border-color: #e1e1e1;
background: #f7f7f7
linear-gradient(#f7f7f7, #f1f1f1 48%, #dadada 52%, #dfdfdf);
cursor: default;
}
.cj-button:is(:disabled, [aria-disabled="true"]) > .cj-button__content,
.cj-menu-popup__trigger:disabled > span {
opacity: 0.5;
}
.cj-button svg {
display: block;
flex: none;
inline-size: 16px;
block-size: 16px;
}
.cj-button__badge {
min-width: 2ch;
margin-left: 3px;
padding-left: 8px;
border-left: 1px solid #b5b8c8;
text-align: center;
font-weight: bold;
}
.cj-button--small {
min-height: 22px;
}
.cj-button--medium {
min-height: 32px;
padding: 3px 7px;
}
.cj-button--large {
min-height: 40px;
padding: 3px 7px;
}
.cj-button:is(.cj-button--medium, .cj-button--large)[aria-label]:has(
> .cj-button__content > svg:only-child
) {
padding-inline: 3px;
}
.cj-button--medium svg {
inline-size: 24px;
block-size: 24px;
}
.cj-button--large svg {
inline-size: 32px;
block-size: 32px;
}
.cj-icon,
.cj-button .cj-icon {
display: inline-block;
flex: none;
inline-size: var(--cj-icon-size, 16px);
block-size: var(--cj-icon-size, 16px);
vertical-align: middle;
}
.cj-button--vertical {
flex-direction: column;
}
.cj-segmented-button {
display: inline-flex;
width: max-content;
max-width: 100%;
justify-self: start;
align-self: start;
vertical-align: middle;
}
.cj-segmented-button--horizontal {
flex-direction: row;
overflow: visible;
}
.cj-segmented-button--vertical {
flex-direction: column;
align-items: stretch;
}
.cj-segmented-button > :is(.cj-button, cj-menu-popup, .cj-split-button) {
margin: 0;
}
.cj-segmented-button--horizontal > .cj-button {
border-radius: 0;
}
.cj-segmented-button--horizontal > .cj-button:first-child {
border-start-start-radius: 3px;
border-end-start-radius: 3px;
}
.cj-segmented-button--horizontal > .cj-button:not(:first-child) {
border-inline-start-width: 0;
}
.cj-segmented-button--horizontal > .cj-button:last-child {
border-start-end-radius: 3px;
border-end-end-radius: 3px;
}
.cj-segmented-button--vertical > .cj-button {
width: 100%;
border-radius: 0;
}
.cj-segmented-button--vertical > .cj-button:first-child {
border-start-start-radius: 3px;
border-start-end-radius: 3px;
}
.cj-segmented-button--vertical > .cj-button:not(:first-child) {
border-block-start-width: 0;
}
.cj-segmented-button--vertical > .cj-button--small:not(:first-child) {
min-height: 21px;
}
.cj-segmented-button--vertical > .cj-button--medium:not(:first-child) {
min-height: 31px;
}
.cj-segmented-button--vertical > .cj-button--large:not(:first-child) {
min-height: 39px;
}
.cj-segmented-button--vertical > .cj-button:last-child {
border-end-start-radius: 3px;
border-end-end-radius: 3px;
}
.cj-segmented-button > .cj-button:is(:hover, :focus) {
z-index: 1;
}
.cj-segmented-button--disabled {
pointer-events: none;
}
.cj-segmented-button--disabled > * {
opacity: 0.5;
}
.cj-menu-popup {
position: relative;
display: inline-flex;
vertical-align: middle;
}
.cj-menu-popup:not(.cj-menu-popup--split) .cj-menu-popup__trigger {
padding-inline-end: 2px;
}
.cj-menu-popup--arrow-bottom:not(.cj-menu-popup--split)
.cj-menu-popup__trigger {
flex-direction: column;
padding-inline: 6px;
padding-block-end: 0;
}
.cj-menu-popup--arrow-bottom:not(.cj-menu-popup--split) .cj-menu-popup__arrow {
position: relative;
width: 8px;
height: 8px;
background: none;
}
.cj-menu-popup--arrow-bottom:not(.cj-menu-popup--split)
.cj-menu-popup__arrow::after,
.cj-split-button--arrow-bottom
> .cj-menu-popup--split
.cj-menu-popup__arrow::after {
content: "";
position: absolute;
top: 0;
left: 1px;
width: 5px;
height: 3px;
background: url("./menu-arrow-glyph.svg") 0 -7px / 38px 16px no-repeat;
}
.cj-menu-popup__arrow {
width: 8px;
height: 16px;
background: url("./menu-arrow-glyph.svg") 0 0 / 38px 16px no-repeat;
}
.cj-menu-popup__content {
position: absolute;
box-sizing: border-box;
z-index: var(--cj-z-popup, 1000);
top: 100%;
right: 0;
width: min(126px, calc(100vw - 16px));
min-width: min(126px, calc(100vw - 16px));
max-width: calc(100vw - 16px);
overflow: auto;
overflow: auto;
}
.cj-menu-popup__content:has(.cj-menu-item__shortcut:not(:empty)) {
width: max-content;
}
.cj-menu-popup__content[data-rightward] {
right: auto;
left: 0;
}
.cj-menu::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 29px;
width: 2px;
box-sizing: border-box;
border-left: 1px solid #e0e0e0;
background: #fff;
pointer-events: none;
}
.cj-menu-popup__content[hidden] {
display: none;
}
.cj-menu-popup__content[data-above] {
top: auto;
bottom: 100%;
}
.cj-menu-item {
position: relative;
box-sizing: border-box;
display: block;
width: 100%;
height: 24px;
padding: 1px 6px 0 35px;
border: 1px solid transparent;
background: transparent;
color: #222;
font: 11px/21px var(--cj-font);
text-align: left;
text-decoration: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
.cj-menu {
box-sizing: border-box;
width: max-content;
min-width: min(126px, calc(100vw - 16px));
max-width: calc(100vw - 16px);
padding: 2px;
border: 1px solid var(--cj-menu-border-color, #99bce8);
background: var(--cj-menu-background, #f0f0f0);
box-shadow: 2px 2px 3px #0003;
color: #222;
font: 11px/16px var(--cj-font);
}
.cj-menu--inline {
position: relative;
display: inline-block;
vertical-align: top;
}
.cj-menu-item__icon {
position: absolute;
top: 1px;
left: 0;
z-index: 1;
display: grid;
width: 28px;
height: 20px;
place-items: center;
}
.cj-menu-item__icon > :is(svg, img) {
display: block;
width: 16px;
height: 16px;
}
.cj-menu-item__label {
display: block;
overflow: hidden;
text-overflow: ellipsis;
}
.cj-menu-item__shortcut {
position: absolute;
top: 1px;
right: 6px;
min-width: 0;
padding-left: 18px;
color: #555;
text-align: right;
}
.cj-menu-item__shortcut:empty {
display: none;
padding: 0;
}
.cj-menu-item__check-icon {
display: block;
width: 16px;
height: 16px;
background: url("./menu-checkbox-unchecked.svg") center / 16px 16px no-repeat;
}
.cj-menu-item[role="menuitemcheckbox"][aria-checked="true"]
.cj-menu-item__check-icon {
background-image: url("./menu-checkbox-checked.svg");
}
.cj-menu-item__check-icon--radio {
background: none;
}
.cj-menu-item[role="menuitemradio"][aria-checked="true"]
.cj-menu-item__check-icon {
background: url("./menu-radio-checked.svg") center / 16px 16px no-repeat;
}
.cj-menu__separator {
height: 1px;
margin: 2px 3px 2px 32px;
border-top: 1px solid #e0e0e0;
background: #fff;
}
.cj-menu__heading {
position: relative;
min-height: 20px;
padding: 2px 8px 0 35px;
color: #3f5875;
font-weight: bold;
line-height: 18px;
white-space: nowrap;
}
.cj-submenu {
display: block;
}
.cj-submenu__trigger {
padding-right: 20px;
}
.cj-submenu__arrow {
position: absolute;
top: 3px;
right: 5px;
width: 8px;
height: 16px;
background: url("./menu-arrow-glyph.svg") -29px 0 / 38px 16px no-repeat;
}
.cj-submenu__content {
position: fixed;
z-index: calc(var(--cj-z-popup, 1000) + 1);
overflow: auto;
}
.cj-submenu__content[hidden] {
display: none;
}
.cj-menu-item:hover:not(:disabled),
.cj-menu-item:focus-visible {
border-color: #aaccf6;
background: #d6e8fa;
outline: none;
}
.cj-menu-item:disabled,
.cj-menu-item[aria-disabled="true"] {
opacity: 0.5;
cursor: default;
}
.cj-split-button {
position: relative;
display: inline-flex;
vertical-align: middle;
}
.cj-split-button::before {
content: "";
position: absolute;
inset: 0;
border: 1px solid var(--cj-button-frame);
border-radius: 3px;
background: var(--cj-button-surface);
pointer-events: none;
}
.cj-split-button > .cj-button {
border-radius: 3px 0 0 3px;
border-inline-end-color: transparent;
}
.cj-menu-popup--split .cj-menu-popup__trigger {
margin-inline-start: -1px;
width: 15px;
padding-inline: 0;
border-radius: 0 3px 3px 0;
border-inline-start-color: transparent;
}
.cj-split-button
.cj-button:not(
:hover,
:focus,
:active,
:disabled,
[aria-disabled="true"],
[aria-pressed="true"]
) {
border-color: var(--cj-button-border-color, transparent);
background: var(--cj-button-background, none);
}
.cj-menu-popup--split .cj-menu-popup__arrow {
position: absolute;
inset-inline-start: -3px;
width: 14px;
background-position-x: -9px;
}
.cj-split-button:hover .cj-menu-popup__arrow {
background-position-x: -23px;
}
.cj-split-button--arrow-bottom {
flex-direction: column;
}
.cj-split-button--arrow-bottom > .cj-button {
width: 100%;
border-radius: 3px 3px 0 0;
border-block-end-color: #c4c4c4 !important;
border-inline-end-color: var(--cj-button-border-color, transparent);
}
.cj-split-button--arrow-bottom > .cj-menu-popup--split {
display: flex;
width: 100%;
}
.cj-split-button--arrow-bottom > .cj-menu-popup--split .cj-menu-popup__trigger {
width: 100%;
min-height: 16px;
height: 16px;
margin: 0;
padding: 0;
border-radius: 0 0 3px 3px;
border-block-start-width: 0;
border-block-end-color: #d1d1d1 !important;
border-inline-color: #d1d1d1 !important;
background: linear-gradient(
to bottom,
#fff 0 1px,
#e4e4e4 1px 2px,
#e3e3e3 2px 3px,
#e4e4e4 3px 5px,
#e5e5e5 5px 6px,
#e4e4e4 6px 7px,
#e5e5e5 7px 9px,
#e6e6e6 9px 14px,
#e7e7e7 14px 15px
) !important;
}
.cj-split-button--arrow-bottom
> .cj-menu-popup--split
.cj-menu-popup__trigger:hover:not(:disabled) {
border-block-end-color: var(
--cj-button-hover-border-color,
#b0ccf2
) !important;
border-inline-color: var(--cj-button-hover-border-color, #b0ccf2) !important;
background: var(
--cj-button-hover-background,
#e4f3ff linear-gradient(#e4f3ff, #d9edff 48%, #c2d8f2 52%, #c6dcf6)
) !important;
}
.cj-split-button--arrow-bottom
> .cj-menu-popup--split
.cj-menu-popup__trigger:is(:active, [aria-expanded="true"]):not(:disabled) {
border-block-end-color: #9ebae1 !important;
border-inline-color: #9ebae1 !important;
background: var(
--cj-button-active-background,
linear-gradient(#b6cbe4, #bfd2e6 48%, #8dc0f5 52%, #98c5f5)
) !important;
}
.cj-split-button:has(
> .cj-menu-popup--split .cj-menu-popup__trigger:hover:not(:disabled)
)::before,
.cj-split-button:has(
> .cj-menu-popup--split .cj-menu-popup__trigger:focus-visible:not(:disabled)
)::before {
border-color: var(--cj-button-hover-border-color, #b0ccf2);
background: var(
--cj-button-hover-background,
#e4f3ff linear-gradient(#e4f3ff, #d9edff 48%, #c2d8f2 52%, #c6dcf6)
);
}
.cj-split-button:has(
> .cj-menu-popup--split .cj-menu-popup__trigger:hover:not(:disabled)
)
> .cj-button:not(:disabled, [aria-disabled="true"]),
.cj-split-button:has(
> .cj-menu-popup--split .cj-menu-popup__trigger:focus-visible:not(:disabled)
)
> .cj-button:not(:disabled, [aria-disabled="true"]) {
border-color: var(--cj-button-hover-border-color, #b0ccf2);
background: transparent;
}
.cj-split-button:has(
> .cj-menu-popup--split
.cj-menu-popup__trigger:is(:hover, :focus-visible):not(:disabled)
)
> .cj-menu-popup--split
.cj-menu-popup__trigger {
background: transparent !important;
}
.cj-split-button--arrow-bottom:has(
> .cj-menu-popup--split
.cj-menu-popup__trigger:is(:hover, :focus-visible):not(:disabled)
)
> .cj-button:not(:disabled, [aria-disabled="true"]) {
border-block-end-color: #aac8f1 !important;
}
.cj-split-button--arrow-bottom:has(
> .cj-menu-popup--split
.cj-menu-popup__trigger:is(:hover, :focus-visible):not(:disabled)
)
> .cj-menu-popup--split
.cj-menu-popup__trigger {
background: linear-gradient(#eff8ff 0 1px, transparent 1px) !important;
}
.cj-split-button--arrow-bottom > .cj-menu-popup--split .cj-menu-popup__arrow {
position: absolute;
top: 4px;
inset-inline-start: 50%;
width: 8px;
height: 8px;
margin: 0 0 0 -4px;
background: none;
}
.cj-split-button--arrow-bottom
> .cj-menu-popup--split
.cj-menu-popup__arrow::after {
top: 2px;
}Stack joined button groups vertically.
Toggle Group
Multiple Toggle
No Toggle
Icons/Arrows
Code
---
import { Button, SegmentedButton } from 'classijs';
import 'classijs/styles.css';
---
<SegmentedButton label="View" orientation="vertical">
<Button>List</Button>
<Button toggle pressed>Cards</Button>
<Button>Board</Button>
</SegmentedButton>