packages/frontend/@n8n/design-system/src/v2/components/Switch/component-switch.md
A toggle control that allows users to switch between two states (on/off). The Switch component is ideal for binary choices where the effect is immediate, such as enabling or disabling a feature.
Props
id?: string - The ID of the switch elementlabel?: string - Text label displayed to the right of the switchmodelValue?: boolean - The controlled checked state of the switch. Can be bound as v-modeldefaultValue?: boolean - The checked state of the switch when initially rendered. Use when you do not need to control the statedisabled?: boolean - When true, prevents the user from interacting with the switchrequired?: boolean - When true, indicates that the user must check the switch before submittingname?: string - The name of the switch for form submissionvalue?: string - The value given as data when submitted with a namesize?: 'small' | 'large' - The size of the switch. Defaults to 'small'as?: string | Component - Change the default rendered element for the one passed as a child, merging their props and behaviorEvents
change(event: Event) - Event fired when the switch value changesupdate:modelValue(value: boolean) - Event fired when the model value updatesSlots
label: { label?: string } - Custom content for the label<script setup lang="ts">
import { ref } from 'vue'
const isEnabled = ref(false)
</script>
<template>
<N8nSwitch2 v-model="isEnabled" label="Enable notifications" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
const sendBody = ref(false)
const timeout = ref(true)
</script>
<template>
<!-- Small size for parameters panel -->
<N8nSwitch2 v-model="sendBody" label="Send Body" size="small" />
<!-- Large size for settings -->
<N8nSwitch2 v-model="timeout" label="Timeout Workflow" size="large" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
const isAccepted = ref(false)
</script>
<template>
<N8nSwitch2 v-model="isAccepted">
<template #label>
I accept the <a href="/terms">terms and conditions</a>
</template>
</N8nSwitch2>
</template>