Skip to main content

Documentation Index

Fetch the complete documentation index at: https://makeswift-openapi-sync-cosmos-pr-2639.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The Shape control can be nested as deeply as you want within Shape and List controls.

Params

type
{ [key: string]: Control }
required
An object of controls in which the type and values returned from each control determines the shape of the overall value passed to your component. May consist of any of the Makeswift controls.

Prop type

The Shape control passes an object based on the controls used in the type field. The keys of the object are the keys of the controls in the type field, and the values are based on the corresponding control’s prop type.

Example

This example adds a Shape control to the type field of a List control for a Feature Grid component.
import {
  List,
  Shape,
  TextInput,
  TextArea,
  Image,
} from "@makeswift/runtime/controls"

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

import { FeatureGrid } from "./FeatureGrid"

runtime.registerComponent(FeatureGrid, {
  type: "feature-grid",
  label: "Feature Grid",
  props: {
    features: List({
      label: "Features",
      type: Shape({
        type: {
          icon: Image({ label: "Icon" }),
          iconAltText: TextInput({
            label: "Icon alt text",
            defaultValue: "icon",
          }),
          heading: TextArea({
            label: "Heading",
            defaultValue: "This is a heading",
          }),
          description: TextArea({
            label: "Description",
            defaultValue: "This is a description.",
          }),
        },
      }),
    }),
  },
})
.makeswift.ts is a naming convention for organizing Makeswift registration code. Learn more.