> ## Documentation Index
> Fetch the complete documentation index at: https://docs.assistantscenter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Switch

```
DBD.formTypes.switch(disabled),
```

<ParamField path="disabled" type="boolean" required>
  Indicate if the switch should be disabled or not.
</ParamField>

## Data required for getActualSet function

Boolean, to be turned on or not.

**Important:**

Please note that `if(saved.state)` will return false if data is not set. If you want to default state to be true, use this:

```javascript theme={null}
getActualSet: ({ guild, user }) => {
  return SAVED_STATE == null || SAVED_STATE == undefined
    ? DEFAULT_STATE
    : SAVED_STATE;
};
```

## Data returned

Boolean, true if turned on - false if turned off.

## Example Usage

```js theme={null}
{
  optionId: 'switch_coffee',
  optionName: "Coffee switch",
  optionDescription: "Do you want coffee to be sent daily to you?",
  optionType: DBD.formTypes.switch(false),
  getActualSet: async ({guild}) => {
      const SAVED_STATE = switchData[guild.id];
      const DEFAULT_STATE = true;
      return (SAVED_STATE == null || SAVED_STATE == undefined) ? DEFAULT_STATE : SAVED_STATE;
  },
  setNew: async ({guild,newData}) => {
      switchData[guild.id] = newData;
      return;
  }
},
```

<img height="200" src="https://mintcdn.com/assistantscenter/e0fzjuWUPc5-sSJC/images/formtypes/dbd-switch.png?fit=max&auto=format&n=e0fzjuWUPc5-sSJC&q=85&s=65a9ba11a9ac3e5d448df9418f72d51c" data-path="images/formtypes/dbd-switch.png" />
