A Strapi v5 custom field plugin that provides an enum field with the ability to dynamically create new options on the fly.
- 🎯 Single select dropdown (like standard enum)
- ✨ Create new options directly from the input field
- 🔍 Search/filter existing options
- 💾 Automatically includes saved values in options list
- 🎨 Clean UX with Strapi Design System
npm install @tunghtml/strapi-plugin-dynamic-enum
# or
yarn add @tunghtml/strapi-plugin-dynamic-enumAdd the plugin to your config/plugins.js:
module.exports = {
// ...
'dynamic-enum': {
enabled: true,
},
};- Go to Content-Type Builder
- Select a content type or create a new one
- Add a new field and select Dynamic Enum from custom fields
- In the field settings, add initial options as JSON array:
["Option 1", "Option 2", "Option 3"]
- Save and use!
When editing an entry:
- Select from existing options in the dropdown
- Type to search/filter options
- If you type a value that doesn't exist, the plugin will show a "Create '...'" option
- Click to create and select the new option immediately
- Newly created options are automatically added to the list for future use
Initial options: ["Pending", "In Progress", "Completed"]
User types "Cancelled" → Plugin shows "Create 'Cancelled'" → User clicks → "Cancelled" is now available as an option.
Values are stored as strings in the database, just like standard enum fields.
- Strapi v5.x
- Node.js >= 18.0.0
MIT
https://github.com/finnwasabi/strapi-plugin-dynamic-enum
Built by Tung Le. More Strapi plugins and case studies at tungln.is-a.dev.