Pular para o conteúdo

Switch

Este conteúdo não está disponível em sua língua ainda.

The Switch component allows users to toggle between two states, commonly on and off. It is often used in settings, preferences, or to enable/disable features.

  • Customizable labels: Can display text, icons, or snippets for on/off states.
  • Sizes: Supports multiple sizes (sm, md, lg, xl) to fit your UI.
  • Colors: Colors can reflect semantic meaning or theme.
  • Disabled: Can be rendered inactive for readonly or unavailable actions.
label custom snippet
xs
sm
md
lg
xl
PropTypeDefaultDescription
checkedbooleanfalseDetermines whether the switch is on or off.
disabledbooleanfalseDisables the switch interaction.
size"sm" | "md" | "lg" | "xl""md"Sets the visual size of the switch.
labelstring | componentOptional label or snippet displayed next to the switch.
indicatorColor{ checked?: string; unchecked?: string }Customizes the color of the indicator based on state.
styleCSSPropertiesInline styles for the switch container.
classstringOptional CSS class for custom styling.
  • Supports icons or custom HTML inside the switch for visual feedback.
  • Can be combined with labels or text for clear state indication.
  • Ideal for forms, dashboards, or settings panels.