
Security News
White House Authorizes Private Companies to Conduct Offensive Cyber Operations
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.
@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 94 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.

Security News
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

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.