Switch

Switch

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

Usage

It's mandatory to wrap the whole component with the Tailwind tag.

const { Tailwind } = VM.require("uiisnear.near/widget/tailwind");
 
const { Switch } = VM.require("uiisnear.near/widget/switch");
 
if (Tailwind == undefined) return "";
<Tailwind>
  <Switch />
</Tailwind>

API Reference

Switch

Contains all the parts of a switch. An input will also render when used within a form to ensure events propagate correctly.

PropTypeDefault
defaultChecked
boolean
---
checked
boolean
---
onCheckedChange
function
---
disabled
boolean
---
required
boolean
---
name
string
---
value
string
on
Data attributeValues
[data-state]"checked" | "unchecked"
[data-disabled]Present when disabled

Classnames

Classnames available to customize the component.

FunctionClassname
SwitchswitchClassname

Examples

Control Panel

Marketing emails

Receive emails about new products, features, and more.

Security emails

Receive emails about your account security.