Link

Adds a Link panel in the Makeswift builder to visually edit a LinkValue prop.

Params

label
stringDefaults to On click

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.

Prop type

The Link control passes an object of type LinkValue to your component.

1type LinkValue = {
2 href: string;
3 target?: "_blank" | "_self";
4};

If no value is set in the builder, your component receives { href: '#' }.

Example

The following example adds an Link control to the link prop of a Button component.

1import { Link } from "@makeswift/runtime/controls";
2
3import { runtime } from "../../../../../makeswift/runtime";
4
5import { Button } from "./Button";
6
7runtime.registerComponent(Button, {
8 type: "button",
9 label: "Button",
10 props: {
11 link: Link(),
12 },
13});

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