{"id":28055,"library":"prefab-ui","title":"Prefab","description":"Prefab is a generative UI framework for Python by PrefectHQ. It allows building interactive web UIs with pure Python, using reactive components. Current version: 0.19.1, requires Python >=3.10. Release cadence is active with frequent minor/patch releases.","status":"active","version":"0.19.1","language":"python","source_language":"en","source_url":"https://github.com/PrefectHQ/prefab","tags":["ui","generative","reactive","prefect","dashboard"],"install":[{"cmd":"pip install prefab-ui","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Prefab is built by PrefectHQ and often used alongside Prefect workflows, but not required.","package":"prefect","optional":true},{"reason":"Used for form models and data validation.","package":"pydantic","optional":false}],"imports":[{"note":"The PyPI package name differs from the import name; always import as 'prefab'.","wrong":"import prefab_ui","symbol":"prefab","correct":"import prefab"},{"note":"Wrong package name in import path.","wrong":"from prefab_ui import App","symbol":"App","correct":"from prefab import App"},{"note":"Components are submodules; common mistake is to import from prefab directly.","symbol":"Button","correct":"from prefab.components import Button"},{"note":"Form.from_model() is used for model-based forms.","symbol":"Form","correct":"from prefab.components import Form"}],"quickstart":{"code":"import prefab\nfrom prefab import App, components\n\napp = App(\n    components.Button(text=\"Hello, World!\")\n)\n\nif __name__ == \"__main__\":\n    app.serve()","lang":"python","description":"Minimal app with a button, served locally."},"warnings":[{"fix":"Use `import prefab` or `from prefab import ...`","message":"Import as `prefab` not `prefab_ui` – the PyPI package name and import name differ.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from prefab.components import Button, Form, ...`","message":"Components must be imported from `prefab.components` submodule, not directly from `prefab`.","severity":"gotcha","affected_versions":">=0.16.0"},{"fix":"Use `prefab.state.State` or `prefab.state.Reactive` for mutable state.","message":"Reactive state management requires understanding `prefab.state` and reactive variables; misuse can cause silent UI failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to 0.19.1+ or implement prefill manually.","message":"The `Form.from_model` runtime prefill feature was added in v0.19.1; earlier versions do not support `defaults` kwarg.","severity":"gotcha","affected_versions":"<0.19.1"},{"fix":"Upgrade to 0.17.0+ or set `show_legend=True` explicitly.","message":"Charts default to `show_legend=True` only from v0.17.0+; earlier versions had no legend.","severity":"gotcha","affected_versions":"<0.17.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Replace `import prefab_ui` with `import prefab`.","cause":"Importing using the PyPI package name instead of the correct module name.","error":"ModuleNotFoundError: No module named 'prefab_ui'"},{"fix":"Use `from prefab.components import Button`.","cause":"Trying to import a component directly from the top-level prefab module.","error":"AttributeError: module 'prefab' has no attribute 'Button'"},{"fix":"Check App signature: `App(*components, title='', ...)`.","cause":"Passing unsupported arguments to App constructor; App only accepts components and basic config.","error":"TypeError: App.__init__() got an unexpected keyword argument 'something'"},{"fix":"Ensure the class inherits from `pydantic.BaseModel`.","cause":"Form.from_model() called with an object that is not a Pydantic BaseModel subclass.","error":"ValueError: 'from_model' requires a Pydantic model class"},{"fix":"Access reactive state only within component callbacks or render functions.","cause":"Using a reactive state variable outside a component's render context.","error":"prefab.exceptions.PrefabRuntimeError: Reactive state not bound to component"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}