Checkbox

Adds a Checkbox panel in the Makeswift builder to visually edit a boolean prop.

A checkbox panel on a Navigation component to show the logo

Params

label
stringDefaults to Label

Text for the panel label in the Makeswift builder.

description
string

The description shown in the Panel of the Makeswift builder. This can be written in Markdown format. Added in v0.24.8.

defaultValue
boolean

The value passed to your component when nothing is set in the Makeswift builder.

Prop type

The Checkbox control passes a boolean to your component. If you don’t set a defaultValue and no value is set in the builder, your component receives undefined.

Example

The following example adds a Checkbox control to the showLogo prop of a Navigation component.

1import { Checkbox } from "@makeswift/runtime/controls";
2
3import { runtime } from "../../../../../makeswift/runtime";
4
5import { Navigation } from "./Navigation";
6
7runtime.registerComponent(Navigation, {
8 type: "navigation",
9 label: "Navigation",
10 props: {
11 showLogo: Checkbox({
12 label: "Show Logo",
13 defaultValue: false,
14 }),
15 },
16});

.makeswift.ts is a naming convention for organizing Makeswift registration code. Learn more.