
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@ffsm/html-factory
Advanced tools
A lightweight utility for creating React HTML factory components with TypeScript support, ref forwarding, and className merging.
A lightweight utility for creating React HTML factory components with proper TypeScript support, ref forwarding, and className merging.
# npm
npm i @ffsm/html-factory
# yarn
yarn add @ffsm/html-factory
# pnpm
pnpm add @ffsm/html-factory
import { factory } from '@ffsm/html-factory';
// Create typesafe HTML components with default props
const Heading = factory('h1', 'Heading', { className: 'text-2xl font-bold' });
const Paragraph = factory('p', 'Paragraph', { className: 'text-base mb-4' });
// Use them in your components
function Article() {
return (
<article>
<Heading className="text-blue-600">
This heading combines default and custom classes
</Heading>
<Paragraph>This paragraph has the default classes applied.</Paragraph>
</article>
);
}
// components/typography.tsx
import { factory } from '@ffsm/html-factory';
export const H1 = factory('h1', 'H1', { className: 'text-4xl font-bold mb-4' });
export const H2 = factory('h2', 'H2', { className: 'text-3xl font-bold mb-3' });
export const H3 = factory('h3', 'H3', { className: 'text-2xl font-bold mb-2' });
export const P = factory('p', 'P', { className: 'text-base mb-4' });
export const Blockquote = factory('blockquote', 'Blockquote', {
className: 'pl-4 border-l-4 border-gray-300 italic',
});
import { factory } from '@ffsm/html-factory';
import { useRef } from 'react';
const Button = factory('button', 'Button', {
className: 'px-4 py-2 bg-blue-500 text-white rounded',
type: 'button',
});
function Form() {
const buttonRef = useRef<HTMLButtonElement>(null);
return (
<form>
{/* Refs are properly forwarded */}
<Button ref={buttonRef} onClick={() => buttonRef.current?.focus()}>
Click me
</Button>
</form>
);
}
import { clsx } from '@ffsm/html-factory';
// Combines classes with automatic deduplication
const className = clsx(
'base-class',
isActive && 'active',
isPrimary && 'primary',
'base-class' // Duplicated class will be removed
);
factory<El>(tag, displayName, initialProps?)Creates a React component factory for the specified HTML tag.
tag: The HTML tag name (e.g., 'div', 'span', 'button')displayName: The React component display nameinitialProps: (Optional) Default props to apply to all instancesReturns a React component with forwarded refs.
clsx(...classes)Utility to combine class names with deduplication.
classes: Any number of string, boolean, null, or undefined valuespropsHTML<El>(overrideProps, ref?, initialProps?)Internal utility for processing HTML props.
overrideProps: Props passed by the userref: React ref to forwardinitialProps: Default props from factoryMIT © FFSM Team
FAQs
A lightweight utility for creating React HTML factory components with TypeScript support, ref forwarding, and className merging.
We found that @ffsm/html-factory demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.