Skip to content

Button group

For a handful of equal-weight actions that all act on the same thing.

Actions

Live preview

Source

<div class="dc-bgrp" role="group" aria-label="선택한 문서 작업">
  <button type="button" class="dc-bgrp__btn">복사</button>
  <button type="button" class="dc-bgrp__btn">이동</button>
  <button type="button" class="dc-bgrp__btn">이름 바꾸기</button>
</div>
.dc-bgrp { display: inline-flex; }
.dc-bgrp__btn {
  min-height: 44px; padding: 0 var(--dc-4);
  border: 1px solid var(--dc-line-field); border-radius: 0;
  background: var(--dc-surface); color: var(--dc-text);
  font-family: var(--dc-font); font-size: 14px; font-weight: 600; line-height: 1;
  white-space: nowrap;
  transition: background var(--dc-fast);
}
.dc-bgrp__btn:hover { background: var(--dc-sunken); }
.dc-bgrp__btn:focus-visible { position: relative; z-index: 1; }
.dc-bgrp__btn + .dc-bgrp__btn { margin-left: -1px; }
.dc-bgrp__btn:first-child { border-radius: var(--dc-r-sm) 0 0 var(--dc-r-sm); }
.dc-bgrp__btn:last-child { border-radius: 0 var(--dc-r-sm) var(--dc-r-sm) 0; }
.dc-bgrp--vert { flex-direction: column; align-items: stretch; }
.dc-bgrp--vert .dc-bgrp__btn + .dc-bgrp__btn { margin-left: 0; margin-top: -1px; }
.dc-bgrp--vert .dc-bgrp__btn:first-child { border-radius: var(--dc-r-sm) var(--dc-r-sm) 0 0; }
.dc-bgrp--vert .dc-bgrp__btn:last-child { border-radius: 0 0 var(--dc-r-sm) var(--dc-r-sm); }
.dc-bgrp--full { display: flex; width: 100%; }
.dc-bgrp--full .dc-bgrp__btn { flex: 1; }

How to use it

  • Group only actions of equal weight that share one target
  • Three to five. Past that, move the rest into a 'more' menu
  • Name the group with aria-label so its target is clear

Watch out for

  • If people are choosing (view mode, date range) this is a toggle, not a button group
  • On narrow screens switch to the vertical or full-width variant; wrapped labels break the seam

Next