Components
MDX component library for reusable content blocks
Components
Components are reusable MDX blocks you can include in articles. Build once, use everywhere.
What are components?
MDX components are React components embedded in your content. Use them for:
- Callouts and alerts
- Code examples with tabs
- Interactive elements
- Standardized formatting
Accessing components
Go to Components in the left sidebar to see your component library.
Using components in articles
In the editor, insert a component:
<Callout type="info">
This is an informational callout.
</Callout>Components render when the article is viewed.
Creating components
- Go to Components in the sidebar
- Click Create component
- Enter:
- Name: How you'll reference it (e.g.,
Callout) - Code: The component implementation
- Name: How you'll reference it (e.g.,
- Click Save
Component structure
A basic component:
export function Callout({ type, children }) {
const styles = {
info: 'bg-blue-50 border-blue-200',
warning: 'bg-yellow-50 border-yellow-200',
error: 'bg-red-50 border-red-200',
};
return (
<div className={`p-4 border rounded ${styles[type]}`}>
{children}
</div>
);
}Built-in components
Boki provides default components:
| Component | Use |
|---|---|
Callout | Information boxes |
Tabs | Tabbed content |
CodeGroup | Code examples with tabs |
Steps | Numbered step sequences |
Managing components
Edit a component
- Find the component in the library
- Click to open
- Edit the code
- Save
Warning: Editing a component affects all articles using it.
Delete a component
- Open the component
- Click Delete
Warning: Deleting a component breaks articles that use it.
Best practices
Name clearly: InfoCallout is better than Box1.
Keep them simple: Components should do one thing well.
Document props: Add comments explaining what props do.
Test before using: Preview components before adding to articles.