Switch

Default

Default switch button

Switch()

Label

With Label

Switch({ label: "Switch Button" })

Disabled

Initial Value

Switch({ label: "Active by default", checked: true })

Bind Value

Content
View({ $data: { visible: true } }, [ Switch({ label: "Visible", name: "visible" }), View({ $show: "visible", pt: 'xl' }, "Content"), ])

With Form

Form( { style: 'max-width: 400px', method: "GET", action: "/ui/switch", $data: { username: "", password: "", remember: false }, }, [ Input({ name: "username", label: "Username" }), Input({ name: "password", label: "Password", type: "password" }), Switch({ name: "remember", label: "Remember Me" }), Button({ color: "primary" }, "Login"), ] )