Toggle

An advanced animating component based on the input[type="checkbox"].

Demo

View Toggle

API

Component takes all input related props given along with custom props below:

Props Type Required Default Description
active Boolean false false Changes active state
callback Func false null Returns active value onClick

Example:

import { Toggle, Button } from 'react-horcrux';

export default YourForm function({doSomething, notifications, updateState}) {
  return(
    <form onSubmit={doSomething}>
      <label>
        Get Quidditch notifications
        <Toggle
          active={notifications}
          callback={updateState}
          name="quidditch_notifications"
        />
      </label>

      <Button type="submit">do it</Button>
    </form>
  );
}

results matching ""

    No results matching ""