MCPcopy Index your code
hub / github.com/Raathigesh/retoggle

github.com/Raathigesh/retoggle @1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.0 ↗ · + Follow
55 symbols 151 edges 41 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Retoggle is a collection of React hooks which provides UI toggles to manipulate your component state from outside. Like Storybook Knobs. This library is inspired by ideas from Dan Abramov.

  • 🎉 A wide range of toggles
  • 💡 Frictionless integration
  • 🎨 Themeable components
  • 🎁 Extensible. Write your custom toggles.

Available knobs

  • 📝 useLog() - Keeps track of a variable value
  • 🅰 useTextKnob() - Shows a text box
  • 1️⃣ useNumberKnob() - Shows a number box
  • ✅️ useBooleanKnob() - Shows a check box
  • 🎚 useRangeKnob() - Shows a slider
  • 🎛 useRangesKnob() - Shows multiple sliders
  • 🎏 useSelectKnob() - Shows a select box
  • useObjectKnob() - Shows an object editor
  • 🎨 useColorKnob() - Shows a color picker
  • useTimemachine() - Shows a slider and tracks the state of a given variable and allows to travel back in time

📚 API Docs with live preview available here

🔮 Codesandbox Demo

An example

The value of state will be displayed in the inspector component.

import React, { useState } from "react";
import { Inspector, useLog } from "retoggle";

export default function Demo() {
  const [state, setState] = useState({ value: 5 });

  // logs your state to inspector
  useLog("My state", state);

  return (



      <Inspector />



  );
}

Contribute

Preparing dev environment

  • yarn install to install dev dependencies

Running and building the library

  • yarn start will start the dev server and expose the sample app
  • yarn build will output the build artifact to ./lib folder

Docs

  • docz:dev will start the docz development server
  • docz:build will build the docs

License

MIT

Contributors

| [

Raathigeshan](https://twitter.com/Raathigesh)

💻 📖 💬 👀 🤔 🎨 | [Het Patel

Het Patel](http://hetpatel33.github.io)

💻 | | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------: |

This project follows the all-contributors specification. Contributions of any kind are welcome!

Extension points exported contracts — how you extend this code

Props (Interface)
(no doc)
src/lib/knobs/useNumberKnob/number.tsx
Props (Interface)
(no doc)
src/lib/knobs/useSelectKnob/select.tsx
Props (Interface)
(no doc)
src/lib/knobs/useBooleanKnob/boolean.tsx
Props (Interface)
(no doc)
src/lib/knobs/useObject/object.tsx
Props (Interface)
(no doc)
src/lib/knobs/useTimeMachine/timeMachine.tsx

Core symbols most depended-on inside this repo

useInspector
called by 11
src/lib/inspector/useInspector/index.ts
onChange
called by 8
src/lib/knobs/useTimeMachine/index.ts
useBooleanKnob
called by 2
src/lib/knobs/useBooleanKnob/index.ts
useRangeKnob
called by 2
src/lib/knobs/useRangeKnob/index.ts
useChartKnob
called by 1
src/example/custom-chart-knob/index.ts
useSelectKnob
called by 1
src/lib/knobs/useSelectKnob/index.ts
useObjectKnob
called by 1
src/lib/knobs/useObject/index.ts
useTimeMachine
called by 1
src/lib/knobs/useTimeMachine/index.ts

Shape

Function 37
Interface 16
Class 2

Languages

TypeScript100%

Modules by API surface

src/lib/components/slider/parts.tsx4 symbols
src/lib/inspector/logs/log.tsx3 symbols
src/lib/inspector/inspector.tsx3 symbols
src/lib/knobs/useTimeMachine/timeMachine.tsx2 symbols
src/lib/knobs/useTimeMachine/index.ts2 symbols
src/lib/knobs/useTextKnob/text.tsx2 symbols
src/lib/knobs/useSelectKnob/select.tsx2 symbols
src/lib/knobs/useRangeKnob/range.tsx2 symbols
src/lib/knobs/useObject/object.tsx2 symbols
src/lib/knobs/useNumberKnob/number.tsx2 symbols
src/lib/knobs/useColor/color.tsx2 symbols
src/lib/knobs/useBooleanKnob/boolean.tsx2 symbols

For agents

$ claude mcp add retoggle \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact