Skip to content
Components

Switch

A control used to switch between two states - often on or off.

First, import the component.

import {Switch} from '@pleo-io/telescope'

Then use it like so:

The component accepts the following props.

PropTypeDefault
checked
boolean
children
React.ReactNode
description
string
labelPosition
enum
right
onCheckedChange
function
Information:

An input[type=checkbox] will also render when used within a form to ensure events propagate correctly.

The component can be controlled by passing the checked and onCheckedChange props.

const [checked, setChecked] = React.useState(false)
return (
    <Switch checked={checked} onCheckedChange={isChecked} labelPosition="left">
        Use Fetch
    </Switch>
)