For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign in
DocsAPI ReferenceChangelog
DocsAPI ReferenceChangelog
  • Get started
    • Quickstart
    • Concepts
  • Guides
    • Environments
  • Reference
        • Checkbox
        • Code
        • Color
        • Combobox
        • Group
        • Image
        • Font
        • Link
        • List
        • Number
        • Rich Text
        • Select
        • Slot
        • Style
        • Text Area
        • Text Input
      • Makeswift API Handler
    • Product docs
    • Blog
    • Support
Sign in
LogoLogo
On this page
  • Params
  • Example
Reference@makeswift/runtimeControls

Style

Was this page helpful?
Previous

Slot

Next

TextArea

Built with

Add a Style control to your component in the Makeswift builder to visually edit a CSS class string prop.

Style controls for an Image component

The Style control is the only control that is responsive; its values can be changed at different viewport sizes without affecting the others. For example, you could set a width of 1200px in desktop and 100% in mobile.

Params

properties
StyleProperty[] | Style.All | Style.DefaultDefaults to Style.Default

An array of style properties that can be visually edited. These values include:

  • Style.Width
  • Style.Margin
  • Style.Padding
  • Style.Border
  • Style.BorderRadius
  • Style.TextStyle

The following presets are also available:

  • Style.Default which is equivalent to [Style.Width, Style.Margin]
  • Style.All which includes all properties.

Example

The following example adds a Style control to the className prop of an Image component.

1import { Style } from "@makeswift/runtime/controls"
2
3import { runtime } from "../../../../../makeswift/runtime"
4
5import { Image } from "./Image"
6
7runtime.registerComponent(Image, {
8 type: "image",
9 label: "Image",
10 props: {
11 className: Style({ properties: Style.All }),
12 },
13})

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