
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.
react-dynamic-var
Advanced tools
A React component for content-editable text input with variable autocompletion, displaying labels and outputting IDs.
A React component for content-editable text input with variable autocompletion. It displays variables as {{label}} in the UI and outputs {{id}} in the plain text, with automatic spacing around inserted variables.

{{{{label}} display{{id}} for processingnpm install react-dynamic-var
# or
yarn add react-dynamic-var
import React from 'react';
import { VariableInputBox } from 'react-dynamic-var';
const variables = [
{ id: 1, label: 'name' },
{ id: 2, label: 'email' },
{ id: 3, label: 'phone' },
];
function App() {
return (
<VariableInputBox
variables={variables}
onChange={(value) => console.log('Editor content:', value)}
placeholder="Type here with {{variable}}"
className="custom-class"
/>
);
}
| Prop | Type | Required | Description |
|---|---|---|---|
variables | Array<{ id: number, label: string }> | Yes | Array of variables for suggestions |
onChange | (value: string) => void | No | Callback fired when content changes |
defaultValue | string | No | Initial value for the editor. Variables should be in {{id}} format |
placeholder | string | No | Placeholder text when editor is empty |
className | string | No | Additional CSS classes for the editor |
{{ to trigger suggestionsHello {{name}}, your {{email}} is confirmedHello {{1}}, your {{2}} is confirmedThe component is styled with Tailwind CSS classes by default:
bg-blue-200, text-blue-900, etc.hover:bg-blue-300, hover:scale-105transition-allAdd these CSS classes to replicate the default styling:
.variable-input-box [contenteditable] {
border: 1px solid #d1d5db;
border-radius: 0.375rem;
padding: 0.5rem 0.75rem;
min-height: 40px;
}
.variable-input-box span {
display: inline-block;
background-color: #bfdbfe;
color: #1e3a8a;
font-weight: 600;
font-size: 0.875rem;
padding: 0.25rem 0.625rem;
border-radius: 0.5rem;
margin-right: 0.25rem;
cursor: pointer;
transition: all 0.2s;
}
.variable-input-box span:hover {
background-color: #93c5fd;
transform: scale(1.05);
}
Contributions are welcome! Please feel free to submit a Pull Request.
MIT © Hossain Azad
FAQs
A React component for content-editable text input with variable autocompletion, displaying labels and outputting IDs.
We found that react-dynamic-var 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
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.