Theme

npm_versionnpm Paragon package page

A form control renders a space for user input (input or select). It can be decorated with leading or trailing elements, and have a floating label.

Prefer to use the Form.Control component inside a Form.Group. The Form.Group provides a context for the control to ensure accessibility requirements for labels and descriptions are met.

Note: extra props added to this component are passed as attributes to the underlying DOM node (input by default). See MDN for documentation on available input attributes or select attributes.

Usage with decorators and floating label

Any Paragon component or export may be added to the code example.

Input types

Any Paragon component or export may be added to the code example.

Input masks

Paragon uses the react-imask library, which allows you to add masks of different types for inputs. To create your own mask, you need to pass the required mask pattern (+{1} (000) 000-0000) to the inputMask property.
See react-imask for documentation on available props.

Any Paragon component or export may be added to the code example.

Input masks with clear value

To get a value without a mask, you need to use onChange instead of onAccept to handle changes.

Any Paragon component or export may be added to the code example.

Textarea autoResize

autoResize prop allows input to be resized according to the content height.

Any Paragon component or export may be added to the code example.

Validation

Any Paragon component or export may be added to the code example.

Sizes

Any Paragon component or export may be added to the code example.

Theme Variables#

CSS VariableComputed Value










Props API#

FormControl Props API

This is a pass through component from React-Bootstrap, see original props documentation here.

  • className string

    Specifies class name to append to the base element.

  • as elementType

    Specifies base element for the control component.

    Default'input'
  • onChange func

    Specifies function that is triggered on input value change.

  • defaultValue string | number

    Specifies default value of the input component.

  • value string | number

    Specifies current value of the input component.

  • id string

    Specifies id of the control component.

  • controlClassName string

    Specifies class name for the control component.

  • size enum'sm' | 'lg'

    Specifies size for the control component.

  • leadingElement node

    Specifies leading element to display for the input component.

  • trailingElement node

    Specifies trailing element to display for the input component.

  • floatingLabel node

    Specifies floating label to display for the input component.

  • plaintext bool

    Specifies whether to render input as plain text.

    Defaultfalse
  • isValid bool

    Specifies whether to display control in valid state, this affects styling.

  • isInvalid bool

    Specifies whether to display control in invalid state, this affects styling.

  • autoResize bool

    Only for as="textarea". Specifies whether the input can be resized according to the height of content.

    Defaultfalse
  • inputMask string

    Specifies what format to use for the input mask.

Usage Insights#

FormControl

Project NameParagon VersionInstance Count
frontend-app-admin-portal20.46.31
frontend-app-learner-dashboard20.46.22
frontend-lib-content-components21.5.61
prospectus20.46.21