
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@markdown-ui/react
Advanced tools
React renderer for markdown-ui widgets. This package provides React components that work with the markdown-ui widget system.
npm install @markdown-ui/react @markdown-ui/marked-ext
import React from 'react';
import { MarkdownUI } from '@markdown-ui/react';
import '@markdown-ui/react/widgets.css'; // Optional styling
import { marked } from 'marked';
import { markedUiExtension } from '@markdown-ui/marked-ext';
// Configure marked with the UI extension
marked.use(markedUiExtension);
const App = () => {
const markdown = `
# My Form
\`\`\`markdown-ui-widget
{
"type": "textInput",
"label": "Your Name",
"placeholder": "Enter your name"
}
\`\`\`
`;
const html = marked(markdown);
const handleWidgetEvent = (data: any) => {
console.log('Widget event:', data);
};
return (
<MarkdownUI
html={html}
onWidgetEvent={handleWidgetEvent}
/>
);
};
All widgets from the Svelte implementation are available:
\`\`\`markdown-ui-widget
{
"type": "textInput",
"label": "Name",
"placeholder": "Enter your name",
"default": "John Doe"
}
\`\`\`
\`\`\`markdown-ui-widget
{
"type": "buttonGroup",
"label": "Choose an option",
"choices": ["Option A", "Option B", "Option C"],
"default": "Option A"
}
\`\`\`
\`\`\`markdown-ui-widget
{
"type": "slider",
"label": "Value",
"min": 0,
"max": 100,
"step": 1,
"default": 50
}
\`\`\`
\`\`\`markdown-ui-widget
{
"type": "form",
"submitLabel": "Submit Form",
"fields": [
{
"type": "textInput",
"id": "name",
"label": "Name",
"placeholder": "Your name"
},
{
"type": "select",
"id": "country",
"label": "Country",
"choices": ["USA", "Canada", "UK"]
}
]
}
\`\`\`
Import the CSS file for default styling:
import '@markdown-ui/react/widgets.css';
You can also customize the styling by overriding the CSS classes:
.widget - Base widget container.widget-form - Form container.widget-button-group - Button group container.widget-button - Text input container.selector - Select dropdown container.selector-multi - Multi-select container.widget-slider - Slider containerThe onWidgetEvent callback receives data when widget values change:
const handleWidgetEvent = (data: { id: string, value: any }) => {
console.log(`Widget ${data.id} changed to:`, data.value);
};
This package includes full TypeScript definitions. All components are typed and provide IntelliSense support.
Due to the use of Web Components and browser APIs, this library requires client-side rendering. Use dynamic imports with SSR disabled:
import dynamic from 'next/dynamic';
const MarkdownUI = dynamic(() => import('@markdown-ui/react').then(mod => ({ default: mod.MarkdownUI })), {
ssr: false
});
export default function Page() {
const handleWidgetEvent = (data: any) => {
console.log('Widget event:', data);
};
return (
<MarkdownUI
html={yourProcessedHtml}
onWidgetEvent={handleWidgetEvent}
/>
);
}
FAQs
React renderer for markdown-ui
The npm package @markdown-ui/react receives a total of 23 weekly downloads. As such, @markdown-ui/react popularity was classified as not popular.
We found that @markdown-ui/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.