Apiable

API Portal

Markdoc components

The Markdoc components and variables you can use in API Portal pages: product cards, plan tables, articles, buttons, and the live discovery routes that show every component in your own portal.

Markdoc components are tags you place in API Portal pages to render dynamic content, such as a product card or a plan table, from your portal's own data. You write them in the page editor. They render in the live portal.

How do you discover every component in your portal?

Open three routes on your live portal. Each one renders against your real theme and data, so you see exactly what a component looks like in your portal before you use it.

RouteWhat it shows
/kitchen_sinkThe component gallery, with each component rendered.
/kitchen_sink/examples/:exampleA worked example for a named component.
/kitchen_sink/cssThe CSS reference for portal classes and variables.

What variables can you use in a page?

Variables are prefixed with a dollar sign and supplied by the portal at render time. Read them in tags, most often inside an if to show content only to the right audience. The authentication state is the one you reach for most.

VariableWhat it holds
$isAuthenticatedWhether the visitor is signed in. Wrap an if around content to gate it.
$heroText1, $heroText2The hero heading and subheading from the theme.
$heroDescription1, $heroDescription2The longer hero copy from the theme.
$ctaButton1, $ctaButton2The call-to-action button labels from the theme.
$heroImageThe hero image set in the theme.
$showVideo, $videoUrl, $videoTextThe landing page video toggle, source, and caption.
$productText1, $productText2, $productsLinkThe products area copy and link from the theme.

Which components can you use?

These are the tags the portal renders, confirmed in the component registry. Product tags pull from your products, article tags from your content, and the rest are layout and form helpers. Attributes shown are the ones the schema defines.

TagWhat it rendersKey attributes
productCardOne product's card.slug, tags
productCardsSeveral product cards.numberOfProducts (default 2)
productFeaturesA product's feature list.slug
productPlanTableA product's plans as a comparison table.slug
productDocumentationA product's documentation block.slug
articleCardOne article's card.slug, tags
articlesCollectionA collection of articles.collection, view (card or list)
roundedButtonA button or link.target, variant (primary or secondary), scrollToId, rounded
linkwrapWraps content in a link.link, target
contactFormA contact form.label (default Contact Us), mode (modal or inline)

Tabs are available too: a tabs tag wraps one or more tab tags to lay content out in tabbed panels.

How do you write a component tag?

Each component is a Markdoc tag: a tag name followed by its attributes. Tags that render on their own, such as a product card, are self-closing. You place a tag in a page where you want it to render.

  • Product card. The productCard tag with slug="your-product-slug" renders that product's card, themed to match.
  • Several products. The productCards tag with numberOfProducts=2 renders a set of cards. It defaults to two when you leave the attribute off.
  • Plan comparison. The productPlanTable tag with slug="your-product-slug" renders a product's plans and features as a comparison table.
  • Contact form. The contactForm tag renders a form. Set mode="inline" to place it in the page or mode="modal" to open it in a dialog, and label for the button text.

Where to next