A minimal, fast alternative to Storybook for testing components in your monorepo.
- Zero Config: Add as a workspace, write
.sample.ts
files, done - Fast: Instant hot-reloading, no build step
- Simple: Test components from other workspaces without ceremony
- Practical: Built-in parameter controls that just work
- Add to your monorepo:
{
"workspaces": [
"packages/*",
"preview"
]
}
- Install your workspace dependencies:
{
"dependencies": {
"@your-org/components": "workspace:*"
}
}
- Create a
.sample.ts
file:
import { Button } from '@your-org/components';
export const Primary = () => {
const button = Button({ variant: 'primary' });
const tweaker = createTweakerUI()
.addDropdown({
label: 'Variant',
options: ['primary', 'secondary'],
get: () => button.variant,
set: value => button.setVariant(value)
});
return [button.element, tweaker.dom];
};
Control your components with zero boilerplate:
createTweakerUI()
.addButton({ label: 'Click', trigger: fn })
.addStringInput({ label: 'Text', get: fn, set: fn })
.addNumericInput({ label: 'Width', get: fn, set: fn })
.addRangeInput({ label: 'Opacity', get: fn, set: fn })
.addDropdown({ label: 'Size', options: [], get: fn, set: fn })
.addVectorInput({ label: 'Position', get: fn, set: fn })
npm install
npm run dev
MIT