Toggle
A two-state button that can be either on or off.
Usage
Import the component. It's mandatory to wrap the whole component with the Tailwind tag.
const { Tailwind } = VM.require("uiisnear.near/widget/tailwind");
const { Toggle } = VM.require("uiisnear.near/widget/toggle");
if (Tailwind == undefined) return "";<Tailwind>
<Toggle>Toggle</Toggle>
</Tailwind>API Reference
Toggle
The toggle.
| Prop | Type | Default |
|---|---|---|
defaultPressed | boolean | --- |
pressed | boolean | --- |
defaultPressed | function | --- |
disabled | boolean | --- |
| Data attribute | Values |
|---|---|
| [data-state] | "on" | "off" |
| [data-disabled] | Present when disabled |
Variants
Variants available and how to use them.
| Attribute | Value |
|---|---|
| variant | "default" | "outline" |
| size | "default" | "sm" | "lg" |