npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ef2/react-api-forms

v2.0.0

Published

React plugin for Strapi API Forms

Readme

@ef2/react-api-forms

A React form renderer for the Strapi API-forms plugin. It reads a form definition from the CMS, renders its fields and posts the submission back.

Installation (2.x)

2.x runs on React 19 and HeroUI 3, styled with Tailwind 4. HeroUI's own peer dependencies have to be installed by the consumer as well, because Yarn 1 does not install peers by itself:

yarn add @ef2/react-api-forms @heroui/react @heroui/styles \
  react-aria-components react-aria @internationalized/date @react-aria/ssr @react-aria/utils

In the Tailwind 4 stylesheet of the consumer:

@import 'tailwindcss';
@import '@heroui/styles';
@source '../node_modules/@ef2/react-api-forms/dist';

The @source path is relative to the stylesheet. Without that line the layout classes of this package (field widths, the submit button) are never generated, and nothing reports an error.

Usage

import { ReactApiForm } from '@ef2/react-api-forms';

<ReactApiForm
    endpoint="https://cms.example.com"
    formId="3"
    locale="fr"
    classNames={{
        label: 'mb-2 block font-bold',
        input: 'w-full rounded-sm border border-black px-4 py-3',
        control: 'rounded-sm border border-black',
        error: 'mt-1 text-xs text-danger',
    }}
/>;
  • endpoint is the CMS base URL. The fields come from GET <endpoint>/api/api-forms/fields/<formId>, unless they are passed in as givenFields (the JSON string the CMS stores).
  • The submission goes to POST <endpoint>/api/api-forms/submission/post as multipart form data.
  • locale picks the built-in messages: de, en, fr or nl, matched on the language part (fr-BE gets French), and English for any other language. givenMessages replaces them; set error there too, it is shown when the CMS refuses the submission.
  • renders.renderSubmitButton, renders.renderSelect and renders.renderFileInput replace the default submit button, select and file field.

classNames

One set of classes styles every field type, by part. The classes are added to HeroUI's own; a Tailwind ! wins over them.

| Key | Applies to | | --- | --- | | fieldsWrapper, fieldWrapper | the list of fields, and the wrapper around each field | | field | the root of a field: text field, select, checkbox group, radio group | | label | the label of a field | | input | the control people type in or open: input, textarea, select trigger | | description, error | the help text and the error message of a field | | option, control, optionLabel | one checkbox or radio option, its box or circle, its text | | popover | the popover with the options of a select | | fileWrapper, button | the file field, and the submit button | | errorWrapper, successWrapper | the message shown after a submission |

Upgrading from 1.x

  • The package moved to the @ef2 scope: 1.x is react-api-forms, 2.x is @ef2/react-api-forms. Replace the dependency and every import; the two can sit side by side during a migration.
  • nextUi (variant, radius, labelPlacement, color, size) and the enums behind it are gone; the look comes from HeroUI's styles plus classNames.
  • uiClassNames is gone. Its per-component keys map onto the shared keys above:

| 1.x | 2.x | | --- | --- | | uiClassNames.input.base, textarea.base, select.base, radioGroup.base, checkboxGroup.base | field | | label, uiClassNames.*.label of a field | label | | uiClassNames.input.inputWrapper, input.input, textarea.inputWrapper, textarea.input, select.trigger | input | | uiClassNames.*.description | description | | uiClassNames.*.errorMessage | error | | uiClassNames.checkbox.base, radio.base, itemClasses.base | option | | uiClassNames.checkbox.wrapper, radio.wrapper, radio.control | control | | uiClassNames.checkbox.label, radio.label | optionLabel | | uiClassNames.select.popoverContent, select.listbox, listBox.base | popover | | inputWrapper, file | removed; 1.x did not use them |

  • The field widths set in the CMS (25 to 100 percent) only appear when the @source line is in place. A consumer that did not scan this package before never showed them; to keep every field on its own row, pass fieldWrapper: 'w-full!'.
  • renders.renderSubmitButton receives handleSubmit already bound to the fields, typed as (e?) => Promise<void>.