import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import Switch from '../Switch';

<Meta title="Components/Switch" component={Switch} />

# Switch API

The API documentation of the Switch React component. Learn more about the props and the CSS customization points.

## Import

```javascript
import { Switch } from '@useblu/ocean-react';
```

## Usage

<Canvas withSource="open" withToolbar>
  <Story name="usage">
    <Switch id="switch-usage" checked readOnly />
  </Story>
</Canvas>

## Props

The ref is forwarded to the root element.

Any other props supplied will be provided to the root element (native element).

## CSS

| Global class          | Description                           |
| --------------------- | ------------------------------------- |
| .ods-switch\_\_root   | Styles applied to the root element.   |
| .ods-switch           | Styles applied to the switch element. |
| .ods-switch\_\_slider | Styles applied to the span element.   |

If that's not sufficient, you can check the [implementation of the component](https://github.com/ocean-ds/ocean-web/blob/master/packages/ocean-react/src/Switch/Switch.tsx) for more detail.

## Playground

<Canvas>
  <Story
    name="playground"
    args={{
      disabled: false,
    }}
    argTypes={{
      disabled: {
        control: 'boolean',
      },
    }}
  >
    {(props) => <Switch id="switch-playground" {...props} />}
  </Story>
</Canvas>
