• Log inStart now

Form

Usage

import { Form } from 'nr1'

Examples

Props

childrennode

Form fields to display.

classNamestring

Appends class names to the component.

Should be used only for positioning and spacing purposes.

layoutTypeenum
DEFAULT
Form.LAYOUT_TYPE.NORMAL

Layout of the form:

  • Form.LAYOUT_TYPE.NORMAL: The form fields will be aligned vertically
  • Form.LAYOUT_TYPE.SPLIT: Except for Radio and Checkbox components, the form field labels will be placed on the left side and the input on the right.

The SPLIT layout supports various sizes which can be specified through the splitSizeType prop.

<One of
Form.LAYOUT_TYPE.NORMAL,
Form.LAYOUT_TYPE.SPLIT,
>
spacingTypeenum[]

Spacing property. Spacing is defined as a tuple of zero to four values, which follow the same conventions as CSS properties like margin or padding. To omit a value, use SPACING_TYPE.OMIT.

<Array of
<One of
Form.SPACING_TYPE.EXTRA_LARGE,
Form.SPACING_TYPE.LARGE,
Form.SPACING_TYPE.MEDIUM,
Form.SPACING_TYPE.NONE,
Form.SPACING_TYPE.OMIT,
Form.SPACING_TYPE.SMALL,
>
>
splitSizeTypeenum
DEFAULT
Form.SPLIT_SIZE_TYPE.MEDIUM

Specifies the size of the columns when using the split layout.

<One of
Form.SPLIT_SIZE_TYPE.LARGE,
Form.SPLIT_SIZE_TYPE.MEDIUM,
Form.SPLIT_SIZE_TYPE.SMALL,
>
styleobject

Inline style for custom styling.

Should be used only for positioning and spacing purposes.

testIdstring

Adds a data-test-id attribute. Use it to target the component in unit and E2E tests.

For a test id to be valid, prefix it with your nerdpack id, followed up by a dot.

For example, my-nerdpack.some-element.

Note: You might not see data-test-id attributes as they are removed from the DOM, to debug them pass a e2e-test query parameter to the URL.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.