Switch

선택된 항목을 시각적으로 강조 되는 형태의 구조로 같은 콘텐츠 영역 내에서 보기 방식이나 필터를 변경할 때 사용될 수 있습니다.

Basic switch

기본적으로 켜거나 끌 수 있는 기능을 표시할 때 사용합니다.

import { Switch } from '@montage-ui/core';

const Demo = () => {
  return (
    <Switch />
  )
}

export default Demo;

Sizes

2가지 크기를 제공합니다.

  • small
  • medium (default)
import { FlexBox, Switch } from '@montage-ui/core';

const Demo = () => {
  return (
    <FlexBox flexDirection="column" gap="8px">
      <Switch size="small" />
      <Switch size="medium" />
    </FlexBox>
  )
}

export default Demo;

Form control

Form과 관련된 컴포넌트와 함께 사용할 수 있습니다.

  • FormControlGroup
  • FormControl
  • FormControlField
  • FormControlLabel
  • FormControlMessage
  • FormControlNegativeMessage
  • FormControlPositiveMessage
  • FormControlMessageAccessory

Helper Message

import { FlexBox, FormControl, FormControlField, FormControlLabel, FormControlMessage, Switch } from '@montage-ui/core';

const Demo = () => {
  return (
    <FlexBox flexDirection="column" gap="8px">
      <FormControl>
        <FormControlLabel required>알림 설정</FormControlLabel>
        <FormControlField>
          <Switch />
        </FormControlField>
        <FormControlMessage>Helper Message</FormControlMessage>
      </FormControl>
    </FlexBox>
  )
}

export default Demo;

Controlled

기본적으로 비제어 컴포넌트로 동작합니다.

checked, onCheckedChange prop 을 사용하면 제어 컴포넌트로 동작합니다.

제어 컴포넌트와 비제어 컴포넌트는 React 공식 문서 를 참조해주세요.

import { FlexBox, Switch } from '@montage-ui/core';
import { useState } from 'react';

const Demo = () => {
  const [checked, setChecked] = useState(true);

  return (
    <FlexBox flexDirection="column" gap="8px">
      <Switch defaultChecked={false} />
      <Switch checked={checked} onCheckedChange={setChecked} />
    </FlexBox>
  )
}

export default Demo;

Accessibility

WAI-ARIA Switch Pattern 을 준수합니다.

  • Form Control 와 함께 사용할 때 모든 접근성 속성을 주입할 수 있습니다.
  • 그렇지 않은 경우에는 직접 aria-label 등을 사용해서 접근성을 충족시켜야 합니다.

API

NameTypesdefaultValue
defaultChecked
boolean
-
disabled
boolean
-
sx
SxProp
-
xl
Merge<Pick<SwitchDefaultProps, "size">, { sx?: CSSInterpolation; }> | undefined
-
lg
Merge<Pick<SwitchDefaultProps, "size">, { sx?: CSSInterpolation; }> | undefined
-
md
Merge<Pick<SwitchDefaultProps, "size">, { sx?: CSSInterpolation; }> | undefined
-
sm
Merge<Pick<SwitchDefaultProps, "size">, { sx?: CSSInterpolation; }> | undefined
-
xs
Merge<Pick<SwitchDefaultProps, "size">, { sx?: CSSInterpolation; }> | undefined
-
size
"small" | "medium"
"medium"
name
string
-
checked
boolean
-
onCheckedChange
(state: boolean) => void
-
required
boolean
-

© 2026 Wanted Lab, Inc.