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

라디오

원문 보기 위키 갱신

라디오 (Radio)

Radio 버튼은 여러 옵션 중 하나를 선택할 수 있게 해주는 컴포넌트예요.

출처: 문서

본문

Radio는 하나의 옵션만 선택하는 입력 요소예요. radio 클래스를 <input type="radio">에 붙여서 사용합니다.

각 라디오 세트는 같은 페이지의 다른 라디오 세트와 충돌하지 않도록 고유한 name 속성을 가져야 합니다.

클래스명 타입 설명
radio Component radio 입력용
radio-neutral Color neutral 컬러
radio-primary Color primary 컬러
radio-secondary Color secondary 컬러
radio-accent Color accent 컬러
radio-success Color success 컬러
radio-warning Color warning 컬러
radio-info Color info 컬러
radio-error Color error 컬러
radio-xs Size 아주 작은 크기
radio-sm Size 작은 크기
radio-md Size 중간 크기 [기본값]
radio-lg Size 큰 크기
radio-xl Size 아주 큰 크기

Radio

<input type="radio" name="radio-1" class="radio" checked="checked" />
<input type="radio" name="radio-1" class="radio" />

Radio 크기 (Radio sizes)

<input type="radio" name="radio-2" class="radio radio-xs" checked="checked" />
<input type="radio" name="radio-2" class="radio radio-sm" checked="checked" />
<input type="radio" name="radio-2" class="radio radio-md" checked="checked" />
<input type="radio" name="radio-2" class="radio radio-lg" checked="checked" />
<input type="radio" name="radio-2" class="radio radio-xl" checked="checked" />

neutral 컬러 (Neutral color)

<input type="radio" name="radio-3" class="radio radio-neutral" checked="checked" />
<input type="radio" name="radio-3" class="radio radio-neutral" />

primary 컬러 (Primary color)

<input type="radio" name="radio-4" class="radio radio-primary" checked="checked" />
<input type="radio" name="radio-4" class="radio radio-primary" />

secondary 컬러 (Secondary color)

<input type="radio" name="radio-5" class="radio radio-secondary" checked="checked" />
<input type="radio" name="radio-5" class="radio radio-secondary" />

accent 컬러 (Accent color)

<input type="radio" name="radio-6" class="radio radio-accent" checked="checked" />
<input type="radio" name="radio-6" class="radio radio-accent" />

success 컬러 (Success color)

<input type="radio" name="radio-7" class="radio radio-success" checked="checked" />
<input type="radio" name="radio-7" class="radio radio-success" />

warning 컬러 (Warning color)

<input type="radio" name="radio-8" class="radio radio-warning" checked="checked" />
<input type="radio" name="radio-8" class="radio radio-warning" />

info 컬러 (Info color)

<input type="radio" name="radio-9" class="radio radio-info" checked="checked" />
<input type="radio" name="radio-9" class="radio radio-info" />

error 컬러 (Error color)

<input type="radio" name="radio-10" class="radio radio-error" checked="checked" />
<input type="radio" name="radio-10" class="radio radio-error" />

비활성 (Disabled)

<input type="radio" name="radio-11" class="radio" disabled checked="checked" />
<input type="radio" name="radio-11" class="radio" disabled />

커스텀 컬러 (Radio with custom colors)

bg-*, border-*, checked: 접두사 조합으로 선택된 상태의 색상을 원하는 대로 바꿀 수 있어요.

<input
  type="radio" name="radio-12" checked="checked"
  class="radio bg-red-100 border-red-300 checked:bg-red-200 checked:text-red-600 checked:border-red-600" />
<input
  type="radio" name="radio-12" checked="checked"
  class="radio bg-blue-100 border-blue-300 checked:bg-blue-200 checked:text-blue-600 checked:border-blue-600" />

더 알아보기 (Learn more)

Radio는 한 세트를 하나의 name으로 묶어 여러 옵션 중 하나만 선택하게 합니다. 크기는 radio-xs부터 radio-xl, 색상은 radio-{color} 클래스로 조절할 수 있어요. checked:bg-* 같은 변형 클래스를 쓰면 선택 상태의 색상도 커스터마이징할 수 있습니다.