SwitchField

The SwitchField is a type of checkbox that represents on/off values.

View source code

Basic usage

const Demo = () => {
  const [isChecked, setChecked] = useState(false);

  return (
    <SwitchField
      label="Use a default account"
      isChecked={isChecked}
      onChange={(event) => {
        setChecked(event.target.checked);
      }}
    />
  );
};

Help text

The helpText prop lets you add more information about the switch field.

<SwitchField
  helpText="This default account will be used for all employees without dedicated accounts."
  {...otherProps}
/>