Follow these steps to use the Sigil UI library in your project.
-
Install Panda 🐼:
bun add -D @pandacss/dev
-
Create a Panda config file similar to this (Panda looks for
panda.config.ts
by default):// panda.config.ts import { sigilPreset } from "@omnidev/sigil"; import { defineConfig } from "@pandacss/dev"; const pandaConfig = defineConfig({ preflight: true, jsxFramework: "react", presets: ["@pandacss/preset-base", sigilPreset], include: ["src/**/*.{ts,tsx}"], outdir: "src/generated/panda", }); export default pandaConfig;
Feel free to modify the Panda config as needed, for example if you need to add more patterns to
include
. -
Create a
postcss.config.js
file in your project root with the following content:module.exports = { plugins: { "@pandacss/dev/postcss": {}, }, };
There is no need to install
postcss
as an explicit dependency in your project, the config will be picked up by the UI library bundle.
You may want to customize the config snippets above to your liking. Treat them as a starting point.
-
Create a CSS file and import it into your project. You can name the CSS file anything you want, just make sure you import it early in your project. For example:
/* main.css */ @layer reset, base, tokens, recipes, utilities; @import url("@omnidev/sigil/index.css");
// App.tsx import "main.css"; const App = () => <></>;
-
(for TypeScript users) If you are using TypeScript, make sure your consuming application has
compilerOptions.moduleResolution
set tonode16
or higher (e.g.nodenext
) intsconfig.json
. This will allow you to properly import from subpaths from the library. Read more about this here.
Now you are ready to install the UI library. You can either install it from the published package or from a local clone on your local filesystem. The latter is useful if you are developing the library.
Install from remote repository along with required dependencies: bun add @omnidev/sigil @ark-ui/react react-icons
This workflow is ideal for local development.
-
Install knit
-
Within the root UI library directory, build the UI library:
bun run build
(orbun dev
for continuous builds) -
Within the project directory:
-
Install dependencies:
bun i
-
Link the UI library:
knit link @omnidev/sigil
. Linking will not modifypackage.json
, it will just symlink the package into yournode_modules
. Note that the package must be published to theknit
store first (this happens automatically after a successful build of the UI library)💡 Note: if you receive a
Cannot find module '@omnidev/sigil' [...]
error andbun i && knit link @omnidev/sigil
does not resolve the issue, try removing theknit.lock
file and then relink:rm knit.lock && knit link @omnidev/sigil
💡 Note: every time you install or modify dependencies (e.g. run
bun i
orbun add [...]
), the package symlink will be cleared, and will need to be relinked:bun i && knit link @omnidev/sigil
💡 Note: if the UI library build fails, this will cause trickling errors. Make sure the UI library builds successfully if you are still having issues.
-