OptionalInput

Type: React component

How to get OptionalInput?

JavaScript

import { OptionalInput } from 'fds/components';

Wraps a form component to make it support optionally adding a value. OptionalInput renders a Checkbox next to the form component which allows toggling its disabled state.

Props

  1. isDisabled

    (Optional)

    Type: Boolean

    Whether or not the component should be rendered in a disabled state.

    Default value

  2. onChange

    (Optional)

    Type: Function

    A callback that is called whenever a component's value changes.

    This callback is called just before the "validate" prop is called.

    Use this callback to update local state which in turn should update the value prop of the component whose callback just fired.

    Arguments

    Default value

  3. renderFormField

    (Required)

    Type: Function

    A callback that is called at render time, which should return a form field instance.

    Arguments

  4. tooltipContent

    (Optional)

    Type: String | ReactElement

    The content of the tooltip that is displayed when hovering over the whole component.

    • string: the textual content of the tooltip

    • ReactElement: a React Element (instance of a React Component, usually created with JSX)

    Default value

  5. value

    (Optional)

    Type: Boolean

    The current value of the component. This value should be true or false.

    Default value