React

Segmented Control

여러 옵션 중 하나를 선택하여 관련 콘텐츠를 즉시 필터링하거나 전환할 때 사용하는 컴포넌트입니다.

Installation

npx @seed-design/cli@latest add ui:segmented-control

Props

SegmentedControl

valuedefaultValue 중 적어도 하나를 제공해야 합니다.

Prop

Type

disabled?boolean | undefined
name?string | undefined
form?string | undefined
value?string | undefined
defaultValue?string | undefined
onValueChange?((value: string) => void) | undefined

SegmentedControlItem

Prop

Type

inputProps?React.InputHTMLAttributes<HTMLInputElement> | undefined
rootRef?React.Ref<HTMLLabelElement> | undefined
notification?boolean | undefined
valuestring
disabled?boolean | undefined
invalid?boolean | undefined

Examples

Disabled

Notification

Long Label

Fixed Width

SegmentedControlstyle prop에 width를 제공해서 직접 너비를 설정할 수 있습니다.

Listening to Value Changes

SegmentedControlonValueChange prop을 사용하여 선택 값 변경을 감지할 수 있습니다.

이벤트를 활용해야 하는 경우 SegmentedControlIteminputProps를 통해 내부 <input> 요소에 직접 이벤트 핸들러를 추가할 수 있습니다.

Last updated on

On this page