A checkbox panel on a Navigation component to show the logo

Params

label
string
default: "Label"

Text for the panel label in the Makeswift builder.

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.

import { Checkbox } from "@makeswift/runtime/controls"

import { runtime } from "@/makeswift/runtime"

import { Navigation } from "./Navigation"

runtime.registerComponent(Navigation, {
  type: "navigation",
  label: "Navigation",
  props: {
    showLogo: Checkbox({
      label: "Show Logo",
      defaultValue: false,
    }),
  },
})

.makeswift.ts is a naming convention for organizing Makeswift registration code. Read more about this pattern here.