# Wheel Picker URL: /react/components/wheel-picker Source: https://github.com/daangn/seed-design/blob/dev/docs/content/react/components/wheel-picker.mdx 항목을 세로로 스크롤하여 하나 이상의 값을 선택하는 컴포넌트입니다. 사용 가능 버전: @seed-design/react@2.4.0, @seed-design/css@2.6.0 ## Preview ```tsx "use client"; import { Box, Text, VStack } from "@seed-design/react"; import * as React from "react"; import { WheelPicker } from "seed-design/ui/wheel-picker"; const buildingOptions = Array.from({ length: 10 }, (_, index) => { const value = String(101 + index); return { value, label: `${value}동` }; }); const unitOptions = Array.from({ length: 15 }, (_, floorIndex) => Array.from({ length: 4 }, (_, lineIndex) => { const value = String((floorIndex + 1) * 100 + lineIndex + 1); return { value, label: `${value}호` }; }), ).flat(); export default function WheelPickerPreview() { const [{ building, unit }, setAddress] = React.useState({ building: "103", unit: "1202", }); const columns = [ { id: "building", "aria-label": "동", options: buildingOptions, value: building, onValueChange: (nextBuilding: string) => setAddress((current) => ({ ...current, building: nextBuilding })), }, { id: "unit", "aria-label": "호수", options: unitOptions, value: unit, onValueChange: (nextUnit: string) => setAddress((current) => ({ ...current, unit: nextUnit })), }, ]; return ( {building}동 {unit}호 ); } ``` ## Installation - npm: npx @seed-design/cli@latest add ui:wheel-picker - pnpm: pnpm dlx @seed-design/cli@latest add ui:wheel-picker - yarn: yarn dlx @seed-design/cli@latest add ui:wheel-picker - bun: bun x @seed-design/cli@latest add ui:wheel-picker ## Props ### `WheelPicker` ### `WheelPickerColumn` ## Examples ### Package API ```tsx "use client"; import { Box, Text, VStack, WheelPicker } from "@seed-design/react"; import * as React from "react"; const options = ["작게", "보통", "크게"].map((label) => ({ value: label, label })); export default function WheelPickerPackageApi() { const [value, setValue] = React.useState("보통"); return ( ( {option.label} )} /> 선택값: {value} ); } ``` `@seed-design/react`의 compound API는 컬럼을 직접 조합할 때 사용합니다. `Root`와 각 `Column`의 `className`으로 전체 또는 컬럼 단위 스타일을 조정할 수 있습니다. `renderLabel`은 기본 ItemLabel을 반환한 요소로 대체합니다. 기본 여백과 정렬이 필요하면 예시처럼 `WheelPicker.ItemLabel`을 다시 조합할 수 있습니다. 내부 항목과 선택 표시의 slot 스타일 API는 제공하지 않습니다. ### Value Change `onIndexChange`는 사용자가 스크롤하거나 항목을 탭해 중앙 항목이 바뀔 때마다 호출됩니다. 정착 전에도 통과한 각 항목의 인덱스와 값을 순서대로 전달하므로 항목별 햅틱에 사용할 수 있습니다. 최종 선택값은 스크롤이 정착한 뒤 `onValueChange`로 처리하세요. ### React Element Label ```tsx "use client"; import { Box, HStack, Text, VStack } from "@seed-design/react"; import * as React from "react"; import { WheelPicker } from "seed-design/ui/wheel-picker"; function ColorDot({ color }: { color: string }) { return (