New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@slimr/forms

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slimr/forms

A slim (< 1kB), enhanced HTML form with auto-disabling, auto-reset, error handling, more JS events, and context to its children.

latest
Source
npmnpm
Version
5.0.47
Version published
Weekly downloads
18
-53.85%
Maintainers
1
Weekly downloads
 
Created
Source

🪶 @slimr/forms npm package

A slim (< 1kB), enhanced HTML form with auto-disabling, auto-reset, error handling, more JS events, and context to its children.

  • optimizes for vanilla, uncontrolled input elements
  • does not cause re-renders
  • disables form elements while submitting
  • can auto-reset the form is desired
  • uses browser accessibility APIs to share errors to form elements
  • wraps onSubmit to
    • auto call event.preventsDefault()
    • pass form values as an Object
  • provide JS events and React context for rejected, submitted, accepted states
  • < 1kB when bundled+gzipped with a broader application

Context

@slimr is a set of slim React (hence '@slimr') libs. Check them all out on github!

Usage

<SForm onSubmit={(_, vals) => console.log(vals)}>
  {[
    'checkbox',
    'color',
    'date',
    'email',
    'number',
    'password',
    'search',
    'text',
    'textarea',
    'tel',
    'url',
  ].map(type => (
    <InputBox key={type} label={type} name={type} type={type} required />
  ))}
  <RadioBox
    label="Radios"
    name="radio1"
    options={[
      {label: 'Choice 1', value: 'choice1'},
      {label: 'Choice 2', value: 'choice2'},
      {label: 'Choice 3', value: 'choice3'},
    ]}
    required
  />
  <SelectBox
    label={'Select Single'}
    name="select1"
    options={[
      {label: '--', value: ''},
      {label: 'Choice 1', value: 'choice1'},
      {label: 'Choice 2', value: 'choice2'},
      {label: 'Choice 3', value: 'choice3'},
    ]}
    required
  />
  <SelectBox
    label={'Select multiple'}
    multiple
    name="select2"
    options={[
      {label: 'Choice 1', value: 'choice1'},
      {label: 'Choice 2', value: 'choice2'},
      {label: 'Choice 3', value: 'choice3'},
    ]}
    required
  />
  <FormFooter />
  <RenderCheck />
</SForm>

API

SForm

An enhanced HTML form with auto-disabling, auto-reset, error handling, more JS events, and context to its children.

SFormError

An extension of Error that accepts an errorSet as a constructor property. It is used to share errors to form elements

throw new FormError({field1: 'This field is invalid'})

useSFormContext

A hook to get the current state of the form

Keywords

preact

FAQs

Package last updated on 21 Jan 2026

Did you know?

Socket

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.

Install

Related posts