@potok/switch

Potok.io UI Switch component

Usage no npm install needed!

<script type="module">
  import potokSwitch from 'https://cdn.skypack.dev/@potok/switch';
</script>

README

Switch component

Install

yarn add @potok/switch

Usage

import Switch from "@potok/switch";

const Example = () => (
  <div>
    <Switch value={true} enabledContent="Enabled" disabledContent="Disabled" />
  </div>
);

Example

const CreateIcon = require("@potok/icons/glyph/clear/add").default;
const FavIcon = require("@potok/icons/glyph/misc/fav").default;
initialState = { checked: false, iconChecked: true };

<>
  <div>
    <Switch
      enabledContent="Enabled"
      disabledContent="Disabled"
      value={state.checked}
      onChange={e => setState({ checked: e.target.checked })}
    />
  </div>

  <div style={{ marginTop: 10 }}>
    <Switch
      enabledContent="Some enabled text"
      disabledContent="Some disabled text"
      value={true}
      disabled
    />
  </div>
</>;