본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Join

원문 보기 위키 갱신

Join (아이템 묶기)

Join은 여러 아이템을 하나로 묶기 위한 컨테이너예요. 버튼이나 입력 필드 같은 요소들을 그룹으로 만들 때 씁니다. Join은 첫 번째와 마지막 아이템에 테두리 반경(border radius)을 적용해 줘요. 수평 또는 수직 목록을 만드는 데 사용할 수 있습니다.

출처: 문서

본문

Join은 여러 아이템을 그룹으로 묶을 때 사용하는 컴포넌트예요. 버튼, 입력 필드, 선택 박스 등 다양한 요소를 한 덩어리로 보이게 할 수 있습니다. Join은 그룹의 첫 번째와 마지막 아이템에 자동으로 테두리 반경을 적용해서 깔끔하게 이어 보이게 해 줘요.

클래스명 타입 설명
join Component 여러 아이템을 묶기 위한 컨테이너
join-item Component join 안의 아이템. 버튼이나 입력 필드 등이 될 수 있어요
join-vertical direction 아이템을 수직으로 배치
join-horizontal direction 아이템을 수평으로 배치

Join

<div class="join">
  <button class="btn join-item">Button</button>
  <button class="btn join-item">Button</button>
  <button class="btn join-item">Button</button>
</div>

아이템을 수직으로 묶기 (Group items vertically)

<div class="join join-vertical">
  <button class="btn join-item">Button</button>
  <button class="btn join-item">Button</button>
  <button class="btn join-item">Button</button>
</div>

반응형: 작은 화면에서는 수직, 큰 화면에서는 수평 (Responsive: it's vertical on small screen and horizontal on large screen)

lg: 접두사를 붙이면 화면 크기에 따라 방향이 바뀌게 할 수 있어요.

<div class="join join-vertical lg:join-horizontal">
  <button class="btn join-item">Button</button>
  <button class="btn join-item">Button</button>
  <button class="btn join-item">Button</button>
</div>

그룹에 추가 요소 넣기 (With extra elements in the group)

join-item이 그룹의 직계 자식이 아니어도 스타일이 적용돼요. 예를 들어 중간에 indicator를 감싸도 정상적으로 동작합니다.

<div class="join">
  <div>
    <div>
      <input class="input join-item" placeholder="Search" />
    </div>
  </div>
  <select class="select join-item">
    <option disabled selected>Filter</option>
    <option>Sci-fi</option>
    <option>Drama</option>
    <option>Action</option>
  </select>
  <div class="indicator">
    <span class="indicator-item badge badge-secondary">new</span>
    <button class="btn join-item">Search</button>
  </div>
</div>

커스텀 테두리 반경 (Custom border radius)

join-item에 별도 유틸리티 클래스를 붙여서 테두리 반경을 원하는 대로 바꿀 수 있어요. 아래처럼 rounded-r-full을 붙이면 버튼 쪽 모서리만 둥글게 처리됩니다.

<div class="join">
  <input class="input join-item" placeholder="Email" />
  <button class="btn join-item rounded-r-full">Subscribe</button>
</div>

radio 입력을 btn 스타일로 묶기 (Join radio inputs with btn style)

<div class="join">
  <input class="join-item btn" type="radio" name="options" aria-label="Radio 1" />
  <input class="join-item btn" type="radio" name="options" aria-label="Radio 2" />
  <input class="join-item btn" type="radio" name="options" aria-label="Radio 3" />
</div>

더 알아보기 (Learn more)

Join은 입력 필드와 버튼을 붙여서 하나의 폼 컨트롤처럼 보이게 할 때 특히 유용해요. 아이템 사이에 indicator 같은 컴포넌트를 끼우고 싶을 때는 Join이 직접 자식이 아니어도 스타일이 적용된다는 점을 기억해 두세요. 크기와 컬러는 각 아이템에 붙이는 컴포넌트(버튼, 입력 등)의 클래스를 그대로 따릅니다.