Switch

A control that allows the user to toggle between checked and not checked.

  • Name@spark-ui/switch
    Version2.1.2
    LicenseMIT
    npmgithubReported IssuesReport a bug
  • Switch#

    AttributeTypeDescriptionDefault
    defaultCheckedbooleanThe state of the switch when it is initially rendered. Use when you do not need to control its state.null
    checkedbooleanThe controlled state of the switch. Must be used in conjunction with `onCheckedChange`.null
    onCheckedChange(checked: boolean) => voidEvent handler called when the state of the switch changes.null
    disabledbooleanWhen `true`, prevents the user from interacting with the switch.null
    requiredbooleanWhen true, indicates that the user must check the switch before the owning form can be submitted.null
    namestringThe name of the switch. Submitted with its owning form as part of a name/value pair.null
    valuestringThe value given as data when submitted with a name.null
    checkedIconReactNodeIcon shown inside the thumb of the Switch whenever it is checkednull
    uncheckedIconReactNodeIcon shown inside the thumb of the Switch whenever it is uncheckednull
    size"sm" | "md"-md
    intent"main" | "support" | "accent" | "basic" | "success" | "alert" | "error" | "info" | "neutral"-null