Socket
Book a DemoInstallSign in
Socket

@gravity-ui/dialog-fields

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gravity-ui/dialog-fields

The library helps to create dialogs with forms by using registered field-types. Also it is possible to extend it with your own field-types.

latest
Source
npmnpm
Version
6.0.6
Version published
Maintainers
3
Created
Source

Short description

The purpose of DFDialog component is to ease of creating of forms, it is used react-final-form internally. It supports several predefined types of fields but user can extend it by registering new ones by using registerDialogControl.

Controls

  • Base controls
    • plain - static text
    • text - editable text
    • multi-text - user defined array of string
    • checkbox - checkbox
    • tumbler - tumbler
    • radio - radio button
    • editable-list - list of removable strings
    • multi-editable-list - multi list of removable strings
    • text area - text area
    • select - select
    • block - allows to add ReactNode
  • Custom control registration

Features

Install

$ npm install @gravity-ui/dialog-fields
# Use required version of react/react-dom in case you haven't installed them yet
$ npm install @gravity-ui/dialog-fields react@18 react-dom@18

Depending on your package manager you may need to install peerDependencies manually.

Usage

import {DFDialog, FormApi} from '@gravity-ui/dialog-fields';

interface FormValues {
  firstName: string;
  lastName: string;
}

function MyForm() {
  return (
    <DFDialog<FormValues>
      visible={true}
      headerProps={{
        title: 'My form',
      }}
      onAdd={(form) => {
        console.log(form.getState().values);
        return Promise.resolve();
      }}
      fields={[
        {
          name: 'firstName',
          type: 'text',
          caption: 'First name',
          tooltip: 'Description for first name field',
        },
        {
          name: 'lastName',
          type: 'text',
          caption: 'LastName',
          tooltip: 'Description for last name field',
        },
      ]}
    />
  );
}

See more examples in storybook.

FAQs

Package last updated on 08 Oct 2025

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