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

Select

원문 보기 위키 갱신

Select (선택)

Select는 여러 옵션 중에서 하나를 고를 때 쓰는 컴포넌트예요.

출처: 문서

본문

<select> 요소에 select 클래스를 붙이면 됩니다. 색상과 크기를 골라 쓸 수 있고, 고스트 스타일도 있어요.

클래스명 타입 설명
select Component <select> 요소에 사용
select-ghost Style 고스트 스타일
select-neutral Color neutral 컬러
select-primary Color primary 컬러
select-secondary Color secondary 컬러
select-accent Color accent 컬러
select-info Color info 컬러
select-success Color success 컬러
select-warning Color warning 컬러
select-error Color error 컬러
select-xs Size 아주 작은 크기
select-sm Size 작은 크기
select-md Size 중간 크기 [기본값]
select-lg Size 큰 크기
select-xl Size 아주 큰 크기

Select (선택)

<select class="select">
  <option disabled selected>Pick a color</option>
  <option>Crimson</option>
  <option>Amber</option>
  <option>Velvet</option>
</select>

Ghost (no background) (고스트, 배경 없음)

<select class="select select-ghost">
  <option disabled selected>Pick a font</option>
  <option>Inter</option>
  <option>Poppins</option>
  <option>Raleway</option>
</select>

With fieldset and labels (fieldset과 label 사용)

<fieldset class="fieldset">
  <legend class="fieldset-legend">Browsers</legend>
  <select class="select">
    <option disabled selected>Pick a browser</option>
    <option>Chrome</option>
    <option>FireFox</option>
    <option>Safari</option>
  </select>
  <span class="label">Optional</span>
</fieldset>

Primary color (primary 컬러)

<select class="select select-primary">
  <option disabled selected>Pick a text editor</option>
  <option>VScode</option>
  <option>VScode fork</option>
  <option>Another VScode fork</option>
</select>

Secondary color (secondary 컬러)

<select class="select select-secondary">
  <option disabled selected>Pick a language</option>
  <option>Zig</option>
  <option>Go</option>
  <option>Rust</option>
</select>

Accent color (accent 컬러)

<select class="select select-accent">
  <option selected disabled>Color scheme</option>
  <option>Light mode</option>
  <option>Dark mode</option>
  <option>System</option>
</select>

Neutral color (neutral 컬러)

<select class="select select-neutral">
  <option disabled selected>Server location</option>
  <option>North America</option>
  <option>EU west</option>
  <option>South East Asia</option>
</select>

Info color (info 컬러)

<select class="select select-info">
  <option disabled selected>Pick a Framework</option>
  <option>React</option>
  <option>Vue</option>
  <option>Angular</option>
</select>

Success color (success 컬러)

<select class="select select-success">
  <option disabled selected>Pick a Runtime</option>
  <option>npm</option>
  <option>Bun</option>
  <option>yarn</option>
</select>

Warning color (warning 컬러)

<select class="select select-warning">
  <option disabled selected>Pick an OS</option>
  <option>Windows</option>
  <option>MacOS</option>
  <option>Linux</option>
</select>

Error color (error 컬러)

<select class="select select-error">
  <option disabled selected>Pick an AI Model</option>
  <option>GPT-4</option>
  <option>Claude</option>
  <option>Llama</option>
</select>

Sizes (크기)

<select class="select select-xs">
  <option disabled selected>Xsmall</option>
  <option>Xsmall Apple</option>
  <option>Xsmall Orange</option>
  <option>Xsmall Tomato</option>
</select>
<select class="select select-sm">
  <option disabled selected>Small</option>
  <option>Small Apple</option>
  <option>Small Orange</option>
  <option>Small Tomato</option>
</select>
<select class="select select-md">
  <option disabled selected>Medium</option>
  <option>Medium Apple</option>
  <option>Medium Orange</option>
  <option>Medium Tomato</option>
</select>
<select class="select select-lg">
  <option disabled selected>Large</option>
  <option>Large Apple</option>
  <option>Large Orange</option>
  <option>Large Tomato</option>
</select>
<select class="select select-xl">
  <option disabled selected>Xlarge</option>
  <option>Xlarge Apple</option>
  <option>Xlarge Orange</option>
  <option>Xlarge Tomato</option>
</select>

Disabled (비활성)

<select class="select" disabled>
  <option>You can't touch this</option>
</select>

Using OS native style for the options dropdown (옵션 드롭다운에 OS 기본 스타일 사용)

<select class="select appearance-none">
  <option disabled selected>Pick a color</option>
  <option>Crimson</option>
  <option>Amber</option>
  <option>Velvet</option>
</select>

Select with custom dropdown height (커스텀 드롭다운 높이)

<select class="select [&::picker(select)]:max-h-26">
  <option disabled selected>Pick a color</option>
  <option>Crimson</option>
  <option>Amber</option>
  <option>Velvet</option>
</select>

더 알아보기 (Learn more)

Select는 폼에서 옵션 하나를 고를 때 가장 흔하게 쓰는 요소예요. select 클래스에 색상·크기 클래스를 조합하면 디자인에 맞출 수 있습니다. 고른 값을 검증해야 한다면 validator 클래스와 함께 쓰면 유효하지 않은 경우 오류 스타일이 적용돼요.