Registration
Register components in thecomponents array of your config. Each entry needs a name, an importPath for Studio to resolve the component, and optionally a description and propHints:
mdcms.config.ts
Registration options
Prop extraction
MDCMS uses TypeScript’s compiler API to extract prop types from your component source files. Each prop is mapped to a form control in Studio based on its type:Props with function types, ref types, or other non-serializable types are
automatically excluded from the form. Only serializable props appear in the
Studio editor.
Example component
components/mdx/Callout.tsx
typeasenumwith values["info", "warning", "error"](dropdown)titleasstring(text input)childrenasrich-text(nested content editor)
Prop hints
Prop hints override the auto-detected form control for a given prop. Use them when the default control doesn’t match the intended input experience.Available hints
format: url
format: url
Renders a text input with URL validation. Only valid for
string props.widget: color-picker
widget: color-picker
Renders a color picker input. Only valid for
string props.widget: textarea
widget: textarea
Renders a multi-line textarea instead of a single-line text input. Only valid for
string props.widget: slider
widget: slider
Renders a range slider. Only valid for
number props. Requires min and max; step is optional.widget: image
widget: image
Renders an image picker/uploader. Only valid for
string props (stores the image URL).widget: select
widget: select
Renders a dropdown with explicit options. Valid for
string, number, boolean, or enum props. Options can be simple values or { label, value } objects.widget: json
widget: json
Renders a JSON editor for complex structured data. Only valid for props whose TypeScript type is JSON-serializable.
Inserting components in Studio
Content authors can insert registered components in two ways:1
Slash command
Type
/ in the editor to open the command palette. The component catalog
shows all registered components with their names and descriptions.2
Toolbar
Use the editor toolbar to browse and insert components from the catalog.
3
Configure props
After insertion, the prop editor panel appears. Fill in the form controls to
configure the component.
Output format
Inserted components are written as standard MDX syntax in the document body:children (rich-text) props render as wrapper tags with nested content.
Wrapper components
If your component accepts achildren prop typed as ReactNode, it becomes a wrapper component. Studio renders a content hole inside the component block where authors can write rich text, insert other components, or add any editor content.
components/mdx/Callout.tsx
children prop are void components — they render as self-closing tags and don’t accept nested content.