Asia/Jakarta
BlogApril 20, 2025

Using custom components in markdown

Selene Yu
Magic Portfolio will replace some default HTML elements to Once UI components to integrate better in the design and add additional functionality. Furthermore, many common Once UI components are already imported and available for use.

Feedback

The feedback component is used to display critical information to visitors.

Table

Tables are used to display data in a structured format.

Code

Use the CodeBlock component to display code snippets with code highlighting, preview, and copy to clipboard functionality. Use the InlineCode component for inline code snippets.

CodeBlock

The code block component works based on Once UI's CodeBlock. You can access it with the complete syntax for full customization, or by using the standard markdown syntax (triple backticks) with pre-configured props.

InlineCode

The InlineCode is another Once UI component that you can access either through the complete syntax or the short syntax (backticks). Usually the standard markdown syntax is recommended, since it doesn't have that much configuration options.

Accordion

Accordions are used to toggle between hiding and showing content.

Button

Buttons are used to trigger actions or navigate to other pages.

Card

Cards are used to group related content and actions.

Icon

Icons are used to visually represent actions, objects, or concepts. For instructions on importing new icons, head over to the Once UI documentation.

Layout

Layout components help structure content on the page.

Flex

The Flex component is accessible as Column and Row and can handle a wide range of layout options and style properties.

Grid

Use the grid to construct responsive grid layouts. It can be styled similarly to the Flex element.

Media

Media provides an optimized way to display images. Access it with the Media component for full customization or use the markdown syntax. You can also use it to embed YouTube videos.
SmartLink provides an enhanced way to link to internal and external resources. You can access it with the SmartLink component for full customization or with the standard markdown syntax.

Math

Write formulas in LaTeX between double dollar signs. Inline, E=mc2E = mc^2 sits in the sentence; on lines of their own, they render as a centered block: L=1N∑k=1N∣zk−zˉk∣\mathcal{L} = \frac{1}{N} \sum_{k=1}^{N} \left| z_k - \bar{z}_k \right| Single dollar signs stay plain text, so prices like $20 are safe.

Custom components

Since Magic Portfolio is based on Once UI, you can use all the components provided by Once UI in the .mdx files, but you need to import them first in the src/product/mdx.tsx file and pass it to the components object.
Share this post: