<Toggle> Component

A simple toggle, used primarily in consent manager.

Share
Code Editor
<Toggle />

Where it's used

0.x.x
Loading 0.x.x releases...
1.x.x
Loading 1.x.x releases...
2.x.x
Loading 2.x.x releases...
3.x.x
Loading 3.x.x releases...
4.x.x
Loading 4.x.x releases...
5.x.x
Loading 5.x.x releases...

Props

NameDescription
enabled
boolean
Whether the toggle is on or off
onChange
function
Function that will be called when the toggle is changed to on or off

Examples

You can pass the enabled prop in to toggle.

Share
Code Editor
<Toggle enabled />

You can also pass the onChange function to react when the toggle changes state

Share
Code Editor
<Toggle onChange={() => console.log('toggle changed')} />

Appearance set to dark

Share
Code Editor
<div style={{ padding: 32, background: 'black' }}><Toggle appearance="dark" /></div>